gimp r26168 - in trunk: . app/display



Author: martinn
Date: Sun Jul 13 07:40:11 2008
New Revision: 26168
URL: http://svn.gnome.org/viewvc/gimp?rev=26168&view=rev

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

	* app/display/gimpdisplayshell-scroll.[ch]
	(gimp_display_shell_get_scaled_image_size): New function that
	contains logic previously kept in gimp_display_shell_draw_area().

	* app/display/gimpdisplayshell-draw.c
	(gimp_display_shell_draw_area): Use the new function.


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

Modified: trunk/app/display/gimpdisplayshell-draw.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-draw.c	(original)
+++ trunk/app/display/gimpdisplayshell-draw.c	Sun Jul 13 07:40:11 2008
@@ -512,32 +512,16 @@
                               gint              w,
                               gint              h)
 {
-  GimpProjection *proj;
-  TileManager    *tiles;
-  gint            level;
-  gint            level_width;
-  gint            level_height;
-  gint            sx, sy;
-  gint            sw, sh;
+  gint sx, sy;
+  gint sw, sh;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
   if (! shell->display->image)
     return;
 
-  proj = shell->display->image->projection;
-
-  level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
-
-  tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
-
-  level_width  = tile_manager_width (tiles);
-  level_height = tile_manager_height (tiles);
-
-  /*  the size and position of the image viewport coordinates  */
   gimp_display_shell_get_scaled_image_viewport_offset (shell, &sx, &sy);
-  sw = PROJ_ROUND (level_width  * (shell->scale_x * (1 << level)));
-  sh = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
+  gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
 
   /*  check if the passed in area intersects with
    *  both the display and the image

Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.c	Sun Jul 13 07:40:11 2008
@@ -26,7 +26,10 @@
 
 #include "display-types.h"
 
+#include "base/tile-manager.h"
+
 #include "core/gimpimage.h"
+#include "core/gimpprojection.h"
 
 #include "gimpdisplay.h"
 #include "gimpdisplay-foreach.h"
@@ -253,6 +256,42 @@
 }
 
 /**
+ * gimp_display_shell_get_scaled_image_size:
+ * @shell:
+ * @w:
+ * @h:
+ *
+ * Gets the size of the rendered image after it has been scaled.
+ *
+ **/
+void
+gimp_display_shell_get_scaled_image_size (const GimpDisplayShell *shell,
+                                          gint                   *w,
+                                          gint                   *h)
+{
+  GimpProjection *proj;
+  TileManager    *tiles;
+  gint            level;
+  gint            level_width;
+  gint            level_height;
+
+  g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+  g_return_if_fail (GIMP_IS_IMAGE (shell->display->image));
+
+  proj = shell->display->image->projection;
+
+  level = gimp_projection_get_level (proj, shell->scale_x, shell->scale_y);
+
+  tiles = gimp_projection_get_tiles_at_level (proj, level, NULL);
+
+  level_width  = tile_manager_width (tiles);
+  level_height = tile_manager_height (tiles);
+
+  if (w) *w = PROJ_ROUND (level_width  * (shell->scale_x * (1 << level)));
+  if (h) *h = PROJ_ROUND (level_height * (shell->scale_y * (1 << level)));
+}
+
+/**
  * gimp_display_shell_get_disp_offset:
  * @shell:
  * @disp_xoffset:

Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.h	Sun Jul 13 07:40:11 2008
@@ -42,6 +42,10 @@
                                                                 gint                   *x,
                                                                 gint                   *y);
 
+void       gimp_display_shell_get_scaled_image_size            (const GimpDisplayShell *shell,
+                                                                gint                   *w,
+                                                                gint                   *h);
+
 void       gimp_display_shell_get_disp_offset                  (const GimpDisplayShell *shell,
                                                                 gint                   *disp_xoffset,
                                                                 gint                   *disp_yoffset);



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