[gimp] app: use projection and not image sizes



commit bea8b939594aac6918786a58698bd3f21b193219
Author: Massimo Valentini <mvalentini src gnome org>
Date:   Sun Dec 11 17:11:25 2011 +0100

    app: use projection and not image sizes
    
    these are the same nearly always, but during
    an image-scale, the image size is updated early
    and expose redraw following dialog destruction
    uses the projection before the scale.
    
    Basically this patch partly restores the code
    before commit 8b8e67ffe286d78044266fae45141b90d93855a9

 app/display/gimpdisplayshell-draw.c |   16 +++++++++++-----
 1 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c
index 33d369b..2a47978 100644
--- a/app/display/gimpdisplayshell-draw.c
+++ b/app/display/gimpdisplayshell-draw.c
@@ -85,9 +85,11 @@ gimp_display_shell_draw_get_scaled_image_size_for_scale (GimpDisplayShell *shell
                                                          gint             *w,
                                                          gint             *h)
 {
-  GimpImage *image;
-  gdouble    scale_x;
-  gdouble    scale_y;
+  GimpImage      *image;
+  GimpProjection *proj;
+  TileManager    *tiles;
+  gdouble         scale_x;
+  gdouble         scale_y;
 
   g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
 
@@ -95,10 +97,14 @@ gimp_display_shell_draw_get_scaled_image_size_for_scale (GimpDisplayShell *shell
 
   g_return_if_fail (GIMP_IS_IMAGE (image));
 
+  proj = gimp_image_get_projection (image);
+
   gimp_display_shell_calculate_scale_x_and_y (shell, scale, &scale_x, &scale_y);
 
-  if (w) *w = scale_x * gimp_image_get_width (image);
-  if (h) *h = scale_y * gimp_image_get_height (image);
+  tiles = gimp_projection_get_tiles_at_level (proj, 0, NULL);
+
+  if (w) *w = scale_x * tile_manager_width (tiles);
+  if (h) *h = scale_y * tile_manager_height (tiles);
 }
 
 void



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