From 947301c302ca84843300e08abf5ea920693d44dd Mon Sep 17 00:00:00 2001 From: mniip Date: Thu, 8 Nov 2012 14:28:47 +0400 Subject: [PATCH] Better rectangle tool render function, no crappy pixels in edge cases anymore --- src/game/Brush.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/game/Brush.cpp b/src/game/Brush.cpp index 5341f60f6..e57a771ff 100644 --- a/src/game/Brush.cpp +++ b/src/game/Brush.cpp @@ -18,9 +18,13 @@ void Brush::RenderRect(Renderer * ren, ui::Point position1, ui::Point position2) } ren->xor_line(position1.X, position1.Y, position1.X+width, position1.Y); - ren->xor_line(position1.X, position1.Y+height, position1.X+width, position1.Y+height); - ren->xor_line(position1.X+width, position1.Y+1, position1.X+width, position1.Y+height-1); - ren->xor_line(position1.X, position1.Y+1, position1.X, position1.Y+height-1); + if(height>0){ + ren->xor_line(position1.X, position1.Y+height, position1.X+width, position1.Y+height); + if(height>1){ + ren->xor_line(position1.X+width, position1.Y+1, position1.X+width, position1.Y+height-1); + ren->xor_line(position1.X, position1.Y+1, position1.X, position1.Y+height-1); + } + } } void Brush::RenderLine(Renderer * ren, ui::Point position1, ui::Point position2)