[gimp] gimp_projection_projectable_changed(): some fixes and optimizations



commit f3e640f2d28d221cb84d1b413bb58d4c75624993
Author: Michael Natterer <mitch gimp org>
Date:   Wed Sep 2 21:55:14 2009 +0200

    gimp_projection_projectable_changed(): some fixes and optimizations
    
    When the projectable's size or image type changes, stop the idle
    renderer and remove all queued update area because everything needs to
    be re-rendered anyway. Also honor the projectable's offset when
    invalidating the entire projection after clearing the pyramid.

 app/core/gimpprojection.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 8e6221f..8bf6a36 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -849,15 +849,26 @@ static void
 gimp_projection_projectable_changed (GimpProjectable *projectable,
                                      GimpProjection  *proj)
 {
+  gint off_x, off_y;
   gint width, height;
 
+  if (proj->idle_render.idle_id)
+    {
+      g_source_remove (proj->idle_render.idle_id);
+      proj->idle_render.idle_id = 0;
+    }
+
+  gimp_area_list_free (proj->update_areas);
+  proj->update_areas = NULL;
+
   if (proj->pyramid)
     {
       tile_pyramid_destroy (proj->pyramid);
       proj->pyramid = NULL;
     }
 
+  gimp_projectable_get_offset (proj->projectable, &off_x, &off_y);
   gimp_projectable_get_size (projectable, &width, &height);
 
-  gimp_projection_add_update_area (proj, 0, 0, width, height);
+  gimp_projection_add_update_area (proj, off_x, off_y, width, height);
 }



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