[gimp] app: gimp_image_rotate(): fix rotation of sample points



commit 21ea6216f72d96a8d900b9da609fdc3f56f687f5
Author: Michael Natterer <mitch gimp org>
Date:   Sat May 24 22:41:21 2014 +0200

    app: gimp_image_rotate(): fix rotation of sample points
    
    and also notify the image of guide and sample point movements after
    rotation. This was probably broken since the introduction of canvas
    items.

 app/core/gimpimage-rotate.c |   28 ++++++++++++++++++++++------
 1 files changed, 22 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpimage-rotate.c b/app/core/gimpimage-rotate.c
index ba75fb2..686ee10 100644
--- a/app/core/gimpimage-rotate.c
+++ b/app/core/gimpimage-rotate.c
@@ -211,6 +211,22 @@ gimp_image_rotate (GimpImage        *image,
         gimp_image_set_resolution (image, yres, xres);
     }
 
+  /*  Notify guide movements  */
+  for (list = gimp_image_get_guides (image);
+       list;
+       list = g_list_next (list))
+    {
+      gimp_image_guide_moved (image, list->data);
+    }
+
+  /*  Notify sample point movements  */
+  for (list = gimp_image_get_sample_points (image);
+       list;
+       list = g_list_next (list))
+    {
+      gimp_image_sample_point_moved (image, list->data);
+    }
+
   gimp_image_undo_group_end (image);
 
   if (size_changed)
@@ -365,18 +381,18 @@ gimp_image_rotate_sample_points (GimpImage        *image,
       switch (rotate_type)
         {
         case GIMP_ROTATE_90:
-          sample_point->x = old_y;
-          sample_point->y = gimp_image_get_height (image) - old_x;
+          sample_point->x = gimp_image_get_height (image) - old_y;
+          sample_point->y = old_x;
           break;
 
         case GIMP_ROTATE_180:
-          sample_point->x = gimp_image_get_height (image) - old_x;
-          sample_point->y = gimp_image_get_width  (image) - old_y;
+          sample_point->x = gimp_image_get_width  (image) - old_x;
+          sample_point->y = gimp_image_get_height (image) - old_y;
           break;
 
         case GIMP_ROTATE_270:
-          sample_point->x = gimp_image_get_width (image) - old_y;
-          sample_point->y = old_x;
+          sample_point->x = old_y;
+          sample_point->y = gimp_image_get_width (image) - old_x;
           break;
         }
     }


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