[gimp/soc-2011-warp: 56/72] warp-tool: probably bad change to use the apply_region of imagemap



commit 35f324ded39ef5411dd135334b3b4d6b444dd2f7
Author: Michael Murà <batolettre gmail com>
Date:   Sat Jul 23 22:03:24 2011 +0200

    warp-tool: probably bad change to use the apply_region of imagemap

 app/tools/gimpwarptool.c |   45 ++++++++++++++++++---------------------------
 1 files changed, 18 insertions(+), 27 deletions(-)
---
diff --git a/app/tools/gimpwarptool.c b/app/tools/gimpwarptool.c
index 68410da..e6f4fb0 100644
--- a/app/tools/gimpwarptool.c
+++ b/app/tools/gimpwarptool.c
@@ -110,7 +110,7 @@ G_DEFINE_TYPE (GimpWarpTool, gimp_warp_tool, GIMP_TYPE_DRAW_TOOL)
 #define parent_class gimp_warp_tool_parent_class
 
 #define STROKE_PERIOD 100
-#define PREVIEW_PERIOD 1000
+#define PREVIEW_PERIOD 200
 
 void
 gimp_warp_tool_register (GimpToolRegisterCallback  callback,
@@ -512,32 +512,23 @@ gimp_warp_tool_create_image_map (GimpWarpTool *wt,
 static void
 gimp_warp_tool_image_map_update (GimpWarpTool *wt)
 {
-  GimpTool         *tool  = GIMP_TOOL (wt);
-  GimpDisplayShell *shell = gimp_display_get_shell (tool->display);
-  GimpItem         *item  = GIMP_ITEM (tool->drawable);
-  gint              x, y;
-  gint              w, h;
-  gint              off_x, off_y;
-  GeglRectangle     visible;
-
-  gimp_display_shell_untransform_viewport (shell, &x, &y, &w, &h);
-
-  gimp_item_get_offset (item, &off_x, &off_y);
-
-  gimp_rectangle_intersect (x, y, w, h,
-                            off_x,
-                            off_y,
-                            gimp_item_get_width  (item),
-                            gimp_item_get_height (item),
-                            &visible.x,
-                            &visible.y,
-                            &visible.width,
-                            &visible.height);
-
-  visible.x -= off_x;
-  visible.y -= off_y;
-
-  gimp_image_map_apply (wt->image_map, &visible);
+  GimpTool         *tool    = GIMP_TOOL (wt);
+  GimpWarpOptions  *options = GIMP_WARP_TOOL_GET_OPTIONS (wt);
+  GimpDisplayShell *shell   = gimp_display_get_shell (tool->display);
+  GimpCoords        coords, result;
+  GeglRectangle     region;
+
+  coords.x = wt->cursor_x;
+  coords.y = wt->cursor_y;
+
+  gimp_display_shell_untransform_coords (shell, &coords, &result);
+
+  region.x = result.x - options->effect_size / 2.0;
+  region.y = result.y - options->effect_size / 2.0;
+  region.width = options->effect_size;
+  region.height = options->effect_size;
+
+  gimp_image_map_apply_region (wt->image_map, &region);
 }
 
 static void



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