gimp r26587 - in trunk: . app/display



Author: martinn
Date: Sat Aug 16 08:59:58 2008
New Revision: 26587
URL: http://svn.gnome.org/viewvc/gimp?rev=26587&view=rev

Log:
2008-08-16  Martin Nordholts  <martinn svn gnome org>

	* app/display/gimpdisplayshell-scale.c
	(gimp_display_shell_scale_to): Reimplement to increase
	readability.


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-scale.c

Modified: trunk/app/display/gimpdisplayshell-scale.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scale.c	(original)
+++ trunk/app/display/gimpdisplayshell-scale.c	Sat Aug 16 08:59:58 2008
@@ -42,6 +42,7 @@
 #include "gimpdisplayshell-scale.h"
 #include "gimpdisplayshell-scroll.h"
 #include "gimpdisplayshell-title.h"
+#include "gimpdisplayshell-transform.h"
 
 #include "gimp-intl.h"
 
@@ -403,29 +404,32 @@
                              gint              viewport_x,
                              gint              viewport_y)
 {
-  gdouble current;
-  gdouble offset_x;
-  gdouble offset_y;
+  gdouble image_focus_x, image_focus_y;
+  gint    target_offset_x, target_offset_y;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
   if (! shell->display)
     return;
 
-  current = gimp_zoom_model_get_factor (shell->zoom);
-
-  offset_x = shell->offset_x + viewport_x;
-  offset_y = shell->offset_y + viewport_y;
-
-  offset_x /= current;
-  offset_y /= current;
+  gimp_display_shell_untransform_xy_f (shell,
+                                       viewport_x,
+                                       viewport_y,
+                                       &image_focus_x,
+                                       &image_focus_y,
+                                       FALSE);
 
-  offset_x *= scale;
-  offset_y *= scale;
+  target_offset_x = scale * image_focus_x - viewport_x;
+  target_offset_y = scale * image_focus_y - viewport_y;
 
-  gimp_display_shell_scale_by_values (shell, scale,
-                                      offset_x - viewport_x, offset_y - viewport_y,
-                                      shell->display->config->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,
+                                      FALSE);
 }
 
 /**



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