[gimp] app: don't "fix" the extents of filled rectangles and circles



commit 7c63af506e01f27e4da3cdb19cfddb97bd1bd25a
Author: Michael Natterer <mitch gimp org>
Date:   Sun Feb 21 20:41:48 2010 +0100

    app: don't "fix" the extents of filled rectangles and circles
    
    Apply the fix for Xlib evilness (non-filled rectangles and circles are
    drawn one pixel larger) only for non-filled things, filled drawing is
    right by default.

 app/tools/gimpdrawtool.c |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/app/tools/gimpdrawtool.c b/app/tools/gimpdrawtool.c
index a6226f0..54a8b21 100644
--- a/app/tools/gimpdrawtool.c
+++ b/app/tools/gimpdrawtool.c
@@ -552,12 +552,18 @@ gimp_draw_tool_draw_rectangle (GimpDrawTool *draw_tool,
   w = PROJ_ROUND (MAX (0.0, tx2));
   h = PROJ_ROUND (MAX (0.0, ty2));
 
+  if (! filled)
+    {
+      w--;
+      h--;
+    }
+
   if (w > 0 && h > 0)
     gimp_canvas_draw_rectangle (GIMP_CANVAS (shell->canvas),
                                 GIMP_CANVAS_STYLE_XOR,
                                 filled,
                                 PROJ_ROUND (tx1), PROJ_ROUND (ty1),
-                                w - 1, h - 1);
+                                w, h);
 }
 
 void
@@ -594,6 +600,12 @@ gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool,
   w = PROJ_ROUND (MAX (0.0, tx2));
   h = PROJ_ROUND (MAX (0.0, ty2));
 
+  if (! filled)
+    {
+      w--;
+      h--;
+    }
+
   if (w > 0 && h > 0)
     {
       if (w != 1 && h != 1)
@@ -602,7 +614,7 @@ gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool,
                                 GIMP_CANVAS_STYLE_XOR,
                                 filled,
                                 PROJ_ROUND (tx1), PROJ_ROUND (ty1),
-                                w - 1, h - 1,
+                                w, h,
                                 angle1, angle2);
         }
       else
@@ -614,7 +626,7 @@ gimp_draw_tool_draw_arc (GimpDrawTool *draw_tool,
                                       GIMP_CANVAS_STYLE_XOR,
                                       filled,
                                       PROJ_ROUND (tx1), PROJ_ROUND (ty1),
-                                      w - 1, h - 1);
+                                      w, h);
         }
     }
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]