[gimp] Bug 725112 - Small canvas doesn't update when zoomed out



commit 4be11a8c0ed0eaba1895544fb148c223830cfb4c
Author: Michael Natterer <mitch gimp org>
Date:   Fri Feb 28 22:59:36 2014 +0100

    Bug 725112 - Small canvas doesn't update when zoomed out
    
    Remove all code that tries to calculate the maximum level of the tile
    pyramid, because that's essentially impossible. Instead simply keep
    track of the max_z encountered in GeglTileSource::command().

 app/gegl/gimptilehandlerprojection.c |   38 +++++++++------------------------
 1 files changed, 11 insertions(+), 27 deletions(-)
---
diff --git a/app/gegl/gimptilehandlerprojection.c b/app/gegl/gimptilehandlerprojection.c
index 26d50c8..69ed2f2 100644
--- a/app/gegl/gimptilehandlerprojection.c
+++ b/app/gegl/gimptilehandlerprojection.c
@@ -51,8 +51,6 @@ static gpointer gimp_tile_handler_projection_command      (GeglTileSource  *sour
                                                            gint             z,
                                                            gpointer         data);
 
-static void     gimp_tile_handler_projection_update_max_z (GimpTileHandlerProjection *projection);
-
 
 G_DEFINE_TYPE (GimpTileHandlerProjection, gimp_tile_handler_projection,
                GEGL_TYPE_TILE_HANDLER)
@@ -128,11 +126,9 @@ gimp_tile_handler_projection_set_property (GObject      *object,
       break;
     case PROP_TILE_WIDTH:
       projection->tile_width = g_value_get_int (value);
-      gimp_tile_handler_projection_update_max_z (projection);
       break;
     case PROP_TILE_HEIGHT:
       projection->tile_height = g_value_get_int (value);
-      gimp_tile_handler_projection_update_max_z (projection);
       break;
 
     default:
@@ -258,7 +254,12 @@ gimp_tile_handler_projection_command (GeglTileSource  *source,
                                       gint             z,
                                       gpointer         data)
 {
-  gpointer retval;
+  GimpTileHandlerProjection *projection;
+  gpointer                   retval;
+
+  projection = GIMP_TILE_HANDLER_PROJECTION (source);
+
+  projection->max_z = MAX (projection->max_z, z);
 
   retval = gegl_tile_handler_source_command (source, command, x, y, z, data);
 
@@ -268,24 +269,6 @@ gimp_tile_handler_projection_command (GeglTileSource  *source,
   return retval;
 }
 
-static void
-gimp_tile_handler_projection_update_max_z (GimpTileHandlerProjection *projection)
-{
-  projection->max_z = 0;
-
-  if (projection->proj_width > 0 && projection->proj_height > 0 &&
-      projection->tile_width > 0 && projection->tile_height > 0)
-    {
-      gint n_tiles;
-
-      n_tiles = MAX (projection->proj_width  / projection->tile_width,
-                     projection->proj_height / projection->tile_height) + 1;
-
-      while (n_tiles >>= 1)
-        projection->max_z++;
-    }
-}
-
 GeglTileHandler *
 gimp_tile_handler_projection_new (GeglNode *graph,
                                   gint      proj_width,
@@ -305,9 +288,12 @@ gimp_tile_handler_projection_new (GeglNode *graph,
 }
 
 void
-gimp_tile_handler_projection_assign     (GimpTileHandlerProjection *projection,
-                                         GeglBuffer                *buffer)
+gimp_tile_handler_projection_assign (GimpTileHandlerProjection *projection,
+                                     GeglBuffer                *buffer)
 {
+  g_return_if_fail (GIMP_IS_TILE_HANDLER_PROJECTION (projection));
+  g_return_if_fail (GEGL_IS_BUFFER (buffer));
+
   gegl_buffer_add_handler (buffer, projection);
 
   g_object_get (buffer,
@@ -315,8 +301,6 @@ gimp_tile_handler_projection_assign     (GimpTileHandlerProjection *projection,
                 "tile-width",  &projection->tile_width,
                 "tile-height", &projection->tile_height,
                 NULL);
-
-  gimp_tile_handler_projection_update_max_z (projection);
 }
 
 void


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