gimp r26141 - in trunk: . app/display



Author: martinn
Date: Fri Jul 11 20:28:37 2008
New Revision: 26141
URL: http://svn.gnome.org/viewvc/gimp?rev=26141&view=rev

Log:
2008-07-11  Martin Nordholts  <martinn svn gnome org>

	* app/display/gimpdisplayshell-transform.c
	(gimp_display_shell_transform_xy_f)
	(gimp_display_shell_untransform_xy_f): We can use
	gimp_display_shell_get_scaled_image_viewport_offset() here

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_get_scaled_viewport): and here.


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-scroll.c
   trunk/app/display/gimpdisplayshell-transform.c

Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.c	Fri Jul 11 20:28:37 2008
@@ -153,10 +153,16 @@
                                         gint                   *w,
                                         gint                   *h)
 {
+  gint scaled_image_viewport_offset_x;
+  gint scaled_image_viewport_offset_y;
+
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
-  if (x) *x = -shell->disp_xoffset + shell->offset_x;
-  if (y) *y = -shell->disp_yoffset + shell->offset_y;
+  gimp_display_shell_get_scaled_image_viewport_offset (shell,
+                                                       &scaled_image_viewport_offset_x,
+                                                       &scaled_image_viewport_offset_y);
+  if (x) *x = -scaled_image_viewport_offset_x;
+  if (y) *y = -scaled_image_viewport_offset_y;
   if (w) *w =  shell->disp_width;
   if (h) *h =  shell->disp_height;
 }

Modified: trunk/app/display/gimpdisplayshell-transform.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-transform.c	(original)
+++ trunk/app/display/gimpdisplayshell-transform.c	Fri Jul 11 20:28:37 2008
@@ -232,6 +232,8 @@
                                     gdouble          *ny,
                                     gboolean          use_offsets)
 {
+  gint scaled_image_viewport_offset_x;
+  gint scaled_image_viewport_offset_y;
   gint offset_x = 0;
   gint offset_y = 0;
 
@@ -247,11 +249,12 @@
       gimp_item_offsets (item, &offset_x, &offset_y);
     }
 
-  *nx = SCALEX (shell, x + offset_x) - shell->offset_x;
-  *ny = SCALEY (shell, y + offset_y) - shell->offset_y;
+  gimp_display_shell_get_scaled_image_viewport_offset (shell,
+                                                       &scaled_image_viewport_offset_x,
+                                                       &scaled_image_viewport_offset_y);
 
-  *nx += shell->disp_xoffset;
-  *ny += shell->disp_yoffset;
+  *nx = SCALEX (shell, x + offset_x) + scaled_image_viewport_offset_x;
+  *ny = SCALEY (shell, y + offset_y) + scaled_image_viewport_offset_y;
 }
 
 /**
@@ -276,6 +279,8 @@
                                      gdouble          *ny,
                                      gboolean          use_offsets)
 {
+  gint scaled_image_viewport_offset_x;
+  gint scaled_image_viewport_offset_y;
   gint offset_x = 0;
   gint offset_y = 0;
 
@@ -294,8 +299,12 @@
       gimp_item_offsets (item, &offset_x, &offset_y);
     }
 
-  *nx = (x + shell->offset_x) / shell->scale_x - offset_x;
-  *ny = (y + shell->offset_y) / shell->scale_y - offset_y;
+  gimp_display_shell_get_scaled_image_viewport_offset (shell,
+                                                       &scaled_image_viewport_offset_x,
+                                                       &scaled_image_viewport_offset_y);
+
+  *nx = (x - scaled_image_viewport_offset_x) / shell->scale_x - offset_x;
+  *ny = (y - scaled_image_viewport_offset_y) / shell->scale_y - offset_y;
 }
 
 /**



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