gimp r26479 - in trunk: . app/display



Author: martinn
Date: Sun Aug 10 10:54:00 2008
New Revision: 26479
URL: http://svn.gnome.org/viewvc/gimp?rev=26479&view=rev

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

	* app/display/gimpdisplayshell-scroll.[ch]: It makes more sense
	for gimp_display_shell_get_scaled_image_size() to be moved from
	here to

	* app/display/gimpdisplayshell-draw.[ch]: here, and rename it to
	gimp_display_shell_draw_get_scaled_image_size().

	* app/display/gimpdisplayshell.c: Adapt to name change.


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

Modified: trunk/app/display/gimpdisplayshell-draw.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-draw.c	(original)
+++ trunk/app/display/gimpdisplayshell-draw.c	Sun Aug 10 10:54:00 2008
@@ -63,6 +63,42 @@
 
 /*  public functions  */
 
+/**
+ * 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_draw_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 = gimp_image_get_projection (shell->display->image);
+
+  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)));
+}
+
 void
 gimp_display_shell_draw_guide (const GimpDisplayShell *shell,
                                GimpGuide              *guide,
@@ -511,7 +547,7 @@
     return;
 
   gimp_display_shell_scroll_get_scaled_viewport_offset (shell, &sx, &sy);
-  gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
+  gimp_display_shell_draw_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-draw.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-draw.h	(original)
+++ trunk/app/display/gimpdisplayshell-draw.h	Sun Aug 10 10:54:00 2008
@@ -20,31 +20,34 @@
 #define __GIMP_DISPLAY_SHELL_DRAW_H__
 
 
-void   gimp_display_shell_draw_guide         (const GimpDisplayShell *shell,
-                                              GimpGuide              *guide,
-                                              gboolean                active);
-void   gimp_display_shell_draw_guides        (const GimpDisplayShell *shell);
-void   gimp_display_shell_draw_grid          (GimpDisplayShell       *shell,
-                                              const GdkRectangle     *area);
-void   gimp_display_shell_draw_pen           (GimpDisplayShell       *shell,
-                                              const GimpVector2      *points,
-                                              gint                    num_points,
-                                              GimpContext            *context,
-                                              GimpActiveColor         color,
-                                              gint                    width);
-void   gimp_display_shell_draw_sample_point  (const GimpDisplayShell *shell,
-                                              GimpSamplePoint        *sample_point,
-                                              gboolean                active);
-void   gimp_display_shell_draw_sample_points (const GimpDisplayShell *shell);
-void   gimp_display_shell_draw_vector        (const GimpDisplayShell *shell,
-                                              GimpVectors            *vectors);
-void   gimp_display_shell_draw_vectors       (const GimpDisplayShell *shell);
-void   gimp_display_shell_draw_cursor        (const GimpDisplayShell *shell);
-void   gimp_display_shell_draw_area          (const GimpDisplayShell *shell,
-                                              gint                    x,
-                                              gint                    y,
-                                              gint                    w,
-                                              gint                    h);
+void   gimp_display_shell_draw_get_scaled_image_size (const GimpDisplayShell *shell,
+                                                      gint                   *w,
+                                                      gint                   *h);
+void   gimp_display_shell_draw_guide                 (const GimpDisplayShell *shell,
+                                                      GimpGuide              *guide,
+                                                      gboolean                active);
+void   gimp_display_shell_draw_guides                (const GimpDisplayShell *shell);
+void   gimp_display_shell_draw_grid                  (GimpDisplayShell       *shell,
+                                                      const GdkRectangle     *area);
+void   gimp_display_shell_draw_pen                   (GimpDisplayShell       *shell,
+                                                      const GimpVector2      *points,
+                                                      gint                    num_points,
+                                                      GimpContext            *context,
+                                                      GimpActiveColor         color,
+                                                      gint                    width);
+void   gimp_display_shell_draw_sample_point          (const GimpDisplayShell *shell,
+                                                      GimpSamplePoint        *sample_point,
+                                                      gboolean                active);
+void   gimp_display_shell_draw_sample_points         (const GimpDisplayShell *shell);
+void   gimp_display_shell_draw_vector                (const GimpDisplayShell *shell,
+                                                      GimpVectors            *vectors);
+void   gimp_display_shell_draw_vectors               (const GimpDisplayShell *shell);
+void   gimp_display_shell_draw_cursor                (const GimpDisplayShell *shell);
+void   gimp_display_shell_draw_area                  (const GimpDisplayShell *shell,
+                                                      gint                    x,
+                                                      gint                    y,
+                                                      gint                    w,
+                                                      gint                    h);
 
 
 #endif /* __GIMP_DISPLAY_SHELL_DRAW_H__ */

Modified: trunk/app/display/gimpdisplayshell-scroll.c
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.c	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.c	Sun Aug 10 10:54:00 2008
@@ -36,6 +36,7 @@
 #include "gimpdisplay.h"
 #include "gimpdisplay-foreach.h"
 #include "gimpdisplayshell.h"
+#include "gimpdisplayshell-draw.h"
 #include "gimpdisplayshell-private.h"
 #include "gimpdisplayshell-scale.h"
 #include "gimpdisplayshell-scroll.h"
@@ -229,7 +230,7 @@
   target_offset_x = shell->offset_x;
   target_offset_y = shell->offset_y;
 
-  gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
+  gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
 
   if (horizontally)
     {
@@ -360,42 +361,6 @@
 }
 
 /**
- * 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 = gimp_image_get_projection (shell->display->image);
-
-  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_scroll_get_disp_offset:
  * @shell:
  * @disp_xoffset:
@@ -478,7 +443,7 @@
       ! shell->display->image)
     return;
 
-  gimp_display_shell_get_scaled_image_size (shell, &sw, NULL);
+  gimp_display_shell_draw_get_scaled_image_size (shell, &sw, NULL);
 
   if (shell->disp_width < sw)
     {
@@ -520,7 +485,7 @@
       ! shell->display->image)
     return;
 
-  gimp_display_shell_get_scaled_image_size (shell, NULL, &sh);
+  gimp_display_shell_draw_get_scaled_image_size (shell, NULL, &sh);
 
   if (shell->disp_height < sh)
     {

Modified: trunk/app/display/gimpdisplayshell-scroll.h
==============================================================================
--- trunk/app/display/gimpdisplayshell-scroll.h	(original)
+++ trunk/app/display/gimpdisplayshell-scroll.h	Sun Aug 10 10:54:00 2008
@@ -49,10 +49,6 @@
                                                              gint                   *x,
                                                              gint                   *y);
 
-void   gimp_display_shell_get_scaled_image_size             (const GimpDisplayShell *shell,
-                                                             gint                   *w,
-                                                             gint                   *h);
-
 void   gimp_display_shell_scroll_get_disp_offset            (const GimpDisplayShell *shell,
                                                              gint                   *disp_xoffset,
                                                              gint                   *disp_yoffset);

Modified: trunk/app/display/gimpdisplayshell.c
==============================================================================
--- trunk/app/display/gimpdisplayshell.c	(original)
+++ trunk/app/display/gimpdisplayshell.c	Sun Aug 10 10:54:00 2008
@@ -67,6 +67,7 @@
 #include "gimpdisplayshell-cursor.h"
 #include "gimpdisplayshell-dnd.h"
 #include "gimpdisplayshell-draw.h"
+#include "gimpdisplayshell-draw.h"
 #include "gimpdisplayshell-filter.h"
 #include "gimpdisplayshell-handlers.h"
 #include "gimpdisplayshell-progress.h"
@@ -1334,7 +1335,7 @@
   gboolean center_horizontally;
   gboolean center_vertically;
 
-  gimp_display_shell_get_scaled_image_size (shell, &sw, &sh);
+  gimp_display_shell_draw_get_scaled_image_size (shell, &sw, &sh);
 
   /* We only want to center on the axes on which the image is smaller
    * than the display canvas. If it is larger, it will be centered on



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