[gimp] Bug 759288 - Unfocused Zoom In/Out in Rotated Canvas View



commit 211d05d1d7fb4dd8a413a72b06fd38f372f01f6a
Author: Michael Natterer <mitch gimp org>
Date:   Tue Jan 5 14:01:57 2016 +0100

    Bug 759288 - Unfocused Zoom In/Out in Rotated Canvas View
    
    gimp_display_shell_scale_to(): calculate the point that should not
    move with GimpDisplayShell's untransform/transform functions before
    and after scaling, then scroll to the right point. Just using the
    scale functions doesn't work any longer when a rotation is
    active. Other functions are affected too, but this most important
    issue can be fixed by fixing just this function.

 app/display/gimpdisplayshell-scale.c |   31 +++++++++++++++++--------------
 1 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-scale.c b/app/display/gimpdisplayshell-scale.c
index 06e8f8d..a9d34e7 100644
--- a/app/display/gimpdisplayshell-scale.c
+++ b/app/display/gimpdisplayshell-scale.c
@@ -1022,9 +1022,8 @@ gimp_display_shell_scale_to (GimpDisplayShell *shell,
                              gdouble           viewport_x,
                              gdouble           viewport_y)
 {
-  gdouble scale_x, scale_y;
-  gdouble image_focus_x, image_focus_y;
-  gdouble target_offset_x, target_offset_y;
+  gdouble image_x, image_y;
+  gdouble new_viewport_x, new_viewport_y;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
@@ -1034,22 +1033,26 @@ gimp_display_shell_scale_to (GimpDisplayShell *shell,
   gimp_display_shell_untransform_xy_f (shell,
                                        viewport_x,
                                        viewport_y,
-                                       &image_focus_x,
-                                       &image_focus_y);
+                                       &image_x,
+                                       &image_y);
 
-  gimp_display_shell_calculate_scale_x_and_y (shell, scale, &scale_x, &scale_y);
-
-  target_offset_x = scale_x * image_focus_x - viewport_x;
-  target_offset_y = scale_y * image_focus_y - viewport_y;
-
-  /* Note that we never come here if we need to
-   * resize_windows_on_zoom
+  /* Note that we never come here if we need to resize_windows_on_zoom
    */
   gimp_display_shell_scale_by_values (shell,
                                       scale,
-                                      target_offset_x,
-                                      target_offset_y,
+                                      shell->offset_x,
+                                      shell->offset_y,
                                       FALSE);
+
+  gimp_display_shell_transform_xy_f (shell,
+                                     image_x,
+                                     image_y,
+                                     &new_viewport_x,
+                                     &new_viewport_y);
+
+  gimp_display_shell_scroll (shell,
+                             new_viewport_x - viewport_x,
+                             new_viewport_y - viewport_y);
 }
 
 static gboolean


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