[gimp] app: in warp tool, improve update region calc.



commit a0b30d542d04d82dd42eb13eedd5c233e380676b
Author: Ell <ell_se yahoo com>
Date:   Wed May 17 10:52:49 2017 -0400

    app: in warp tool, improve update region calc.
    
    ... as a result of a stroke change.

 app/tools/gimpwarptool.c |   15 +++++++++------
 1 files changed, 9 insertions(+), 6 deletions(-)
---
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index b34deaa..53aade0 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -24,6 +24,7 @@
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
 
+#include "libgimpmath/gimpmath.h"
 #include "libgimpwidgets/gimpwidgets.h"
 
 #include "tools-types.h"
@@ -818,12 +819,14 @@ gimp_warp_tool_stroke_changed (GeglPath            *path,
                                GimpWarpTool        *wt)
 {
   GimpWarpOptions *options       = GIMP_WARP_TOOL_GET_OPTIONS (wt);
-  GeglRectangle    update_region = *roi;
-
-  update_region.x      -= options->effect_size * 0.5;
-  update_region.y      -= options->effect_size * 0.5;
-  update_region.width  += options->effect_size;
-  update_region.height += options->effect_size;
+  GeglRectangle    update_region;
+
+  update_region.x      = floor (roi->x - options->effect_size * 0.5);
+  update_region.y      = floor (roi->y - options->effect_size * 0.5);
+  update_region.width  = ceil (roi->x + roi->width  +
+                               options->effect_size * 0.5) - update_region.x;
+  update_region.height = ceil (roi->y + roi->height +
+                               options->effect_size * 0.5) - update_region.y;
 
 #ifdef WARP_DEBUG
   g_printerr ("update rect: (%d,%d), %dx%d\n",


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