[gimp/soc-2011-seamless-clone2] Fix: The offset for seamless cloning should be relative to the drawable



commit c185f221659993bec433ea86e8f8020e0b32e40c
Author: Barak Itkin <lightningismyname gmail com>
Date:   Sat Jun 23 22:56:17 2012 +0300

    Fix: The offset for seamless cloning should be relative to the drawable

 app/tools/gimpseamlessclonetool.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/app/tools/gimpseamlessclonetool.c b/app/tools/gimpseamlessclonetool.c
index bbf84bd..be09c0f 100644
--- a/app/tools/gimpseamlessclonetool.c
+++ b/app/tools/gimpseamlessclonetool.c
@@ -757,8 +757,6 @@ gimp_seamless_clone_tool_create_render_node (GimpSeamlessCloneTool *sc)
 
   op = gegl_node_new_child (node,
                             "operation", "gegl:seamless-clone",
-                            "xoff",      (gint) sc->xoff,
-                            "yoff",      (gint) sc->yoff,
                             NULL);
 
   overlay = gegl_node_new_child (node,
@@ -782,15 +780,25 @@ gimp_seamless_clone_tool_create_render_node (GimpSeamlessCloneTool *sc)
 
   sc->render_node = node;
   sc->sc_node = op;
+
+  gimp_seamless_clone_tool_render_node_update (sc);
 }
 
 static void
 gimp_seamless_clone_tool_render_node_update (GimpSeamlessCloneTool *sc)
 {
+  GimpDrawable *bg = GIMP_TOOL (sc)->drawable;
+  gint xoff, yoff;
+
+  /* Now we should also take into consideration the fact that
+   * we should work with coordinates relative to the background
+   * buffer */
+  gimp_item_get_offset (GIMP_ITEM (bg), &xoff, &yoff);
+
   /* The only thing to update right now, is the location of the paste */
   gegl_node_set (sc->sc_node,
-                 "xoff", (gint) sc->xoff,
-                 "yoff", (gint) sc->yoff,
+                 "xoff", (gint) sc->xoff - xoff,
+                 "yoff", (gint) sc->yoff - yoff,
                  NULL);
 }
 



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