gimp r26111 - in trunk: . app/display app/tools



Author: martinn
Date: Thu Jul 10 20:19:17 2008
New Revision: 26111
URL: http://svn.gnome.org/viewvc/gimp?rev=26111&view=rev

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

	* app/display/gimpdisplayshell-scroll.c
	(gimp_display_shell_get_scaled_viewport): Extend the interface
	with this function

	* app/tools/gimprectangletool.c
	(gimp_rectangle_tool_update_handle_sizes): Forget anything we knew
	about how to interpret the icky GimpDisplayShell offset variables


Modified:
   trunk/ChangeLog
   trunk/app/display/gimpdisplayshell-scroll.c
   trunk/app/display/gimpdisplayshell-scroll.h
   trunk/app/tools/gimprectangletool.c

Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.c	Thu Jul 10 20:19:17 2008
@@ -133,3 +133,27 @@
       shell->offset_y = 0;
     }
 }
+
+/**
+ * gimp_display_shell_get_scaled_viewport:
+ * @shell:
+ * @x:
+ * @y:
+ * @w:
+ * @h:
+ *
+ * Gets the viewport in screen coordinates, with origin at (0, 0) in
+ * the image
+ **/
+void
+gimp_display_shell_get_scaled_viewport (GimpDisplayShell *shell,
+                                        gint             *x,
+                                        gint             *y,
+                                        gint             *w,
+                                        gint             *h)
+{
+  if (x) *x = -shell->disp_xoffset + shell->offset_x;
+  if (y) *y = -shell->disp_yoffset + shell->offset_y;
+  if (w) *w =  shell->disp_width;
+  if (h) *h =  shell->disp_height;
+}

Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.h	Thu Jul 10 20:19:17 2008
@@ -26,5 +26,11 @@
 
 void       gimp_display_shell_scroll_clamp_offsets (GimpDisplayShell *shell);
 
+void       gimp_display_shell_get_scaled_viewport  (GimpDisplayShell *shell,
+                                                    gint             *x,
+                                                    gint             *y,
+                                                    gint             *w,
+                                                    gint             *h);
+
 
 #endif  /*  __GIMP_DISPLAY_SHELL_SCROLL_H__  */

Modified: trunk/app/tools/gimprectangletool.c
==============================================================================
--- trunk/app/tools/gimprectangletool.c	(original)
+++ trunk/app/tools/gimprectangletool.c	Thu Jul 10 20:19:17 2008
@@ -41,6 +41,7 @@
 
 #include "display/gimpdisplay.h"
 #include "display/gimpdisplayshell.h"
+#include "display/gimpdisplayshell-scroll.h"
 #include "display/gimpdisplayshell-transform.h"
 
 #include "gimpdrawtool.h"
@@ -1847,15 +1848,14 @@
     /* Calculate rectangles of the selection rectangle and the display shell,
      * with origin at (0, 0) of image, and in screen coordinate scale.
      */
-    gint    x1 =  pub_x1 * shell->scale_x;
-    gint    y1 =  pub_y1 * shell->scale_y;
-    gint    w1 = (pub_x2 - pub_x1) * shell->scale_x;
-    gint    h1 = (pub_y2 - pub_y1) * shell->scale_y;
-
-    gint    x2 = -shell->disp_xoffset + shell->offset_x;
-    gint    y2 = -shell->disp_yoffset + shell->offset_y;
-    gint    w2 =  shell->disp_width;
-    gint    h2 =  shell->disp_height;
+    gint x1 =  pub_x1 * shell->scale_x;
+    gint y1 =  pub_y1 * shell->scale_y;
+    gint w1 = (pub_x2 - pub_x1) * shell->scale_x;
+    gint h1 = (pub_y2 - pub_y1) * shell->scale_y;
+
+    gint x2, y2, w2, h2;
+
+    gimp_display_shell_get_scaled_viewport (shell, &x2, &y2, &w2, &h2);
 
     rectangle_width  = w1;
     rectangle_height = h1;



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