[gimp/gimp-2-8] Bug 683050 - Copying a layer group to a new xcf results in portions...



commit e2059dde74878d303a140aa0236a53c3b754d3bc
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 5 13:03:47 2012 +0200

    Bug 683050 - Copying a layer group to a new xcf results in portions...
    
    Use gimp_item_translate() not gimp_item_set_offset() to position
    dropped layers, because the latter doesn't affect child layers.
    (cherry picked from commit 9ab3abc98b76c47132dc06dc44514a3be63468d4)

 app/display/gimpdisplayshell-dnd.c |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-dnd.c b/app/display/gimpdisplayshell-dnd.c
index 3e19c43..3a382d3 100644
--- a/app/display/gimpdisplayshell-dnd.c
+++ b/app/display/gimpdisplayshell-dnd.c
@@ -167,13 +167,13 @@ gimp_display_shell_dnd_position_item (GimpDisplayShell *shell,
 {
   gint item_width  = gimp_item_get_width  (item);
   gint item_height = gimp_item_get_height (item);
+  gint off_x, off_y;
 
   if (item_width  >= gimp_image_get_width  (image) &&
       item_height >= gimp_image_get_height (image))
     {
-      gimp_item_set_offset (item,
-                            (gimp_image_get_width  (image) - item_width)  / 2,
-                            (gimp_image_get_height (image) - item_height) / 2);
+      off_x = (gimp_image_get_width  (image) - item_width)  / 2;
+      off_y = (gimp_image_get_height (image) - item_height) / 2;
     }
   else
     {
@@ -182,10 +182,14 @@ gimp_display_shell_dnd_position_item (GimpDisplayShell *shell,
 
       gimp_display_shell_untransform_viewport (shell, &x, &y, &width, &height);
 
-      gimp_item_set_offset (item,
-                            x + (width  - item_width)  / 2,
-                            y + (height - item_height) / 2);
+      off_x = x + (width  - item_width)  / 2;
+      off_y = y + (height - item_height) / 2;
     }
+
+  gimp_item_translate (item,
+                       off_x - gimp_item_get_offset_x (item),
+                       off_y - gimp_item_get_offset_y (item),
+                       FALSE);
 }
 
 static void



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