[gimp/gtk3-port: 228/229] app: move the work of construction the projection into the chunk renderer



commit eb4cab6d79406c33c802a3a711dcf0c8e3e1ec75
Author: Michael Natterer <mitch gimp org>
Date:   Fri Aug 2 20:43:44 2013 +0200

    app: move the work of construction the projection into the chunk renderer
    
    so it is done between ticks of the frame clock. In gtk2 this regulated
    itself because each invalidation would trigger a higher-priority
    expose to be queued, in gtk3 the same code would just loop around the
    invalidation chunk renderer and queue huge parts of the image for
    construction, clearly too much for one frame clock tick.

 app/core/gimpprojection.c |   40 +++++++++++++++++++---------------------
 1 files changed, 19 insertions(+), 21 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 7708b76..1e7e072 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -36,9 +36,8 @@
 #include "gimpprojection.h"
 
 
-/*  halfway between G_PRIORITY_HIGH_IDLE and G_PRIORITY_DEFAULT_IDLE  */
-#define GIMP_PROJECTION_IDLE_PRIORITY ((G_PRIORITY_HIGH_IDLE + \
-                                        G_PRIORITY_DEFAULT_IDLE) / 2)
+/*  just a bit less than GDK_PRIORITY_REDRAW  */
+#define GIMP_PROJECTION_IDLE_PRIORITY (G_PRIORITY_HIGH_IDLE + 20 + 1)
 
 /*  chunk size for one iteration of the chunk renderer  */
 #define GIMP_PROJECTION_CHUNK_WIDTH  256
@@ -94,11 +93,6 @@ static void        gimp_projection_paint_area            (GimpProjection  *proj,
                                                           gint             y,
                                                           gint             w,
                                                           gint             h);
-static void        gimp_projection_invalidate            (GimpProjection  *proj,
-                                                          guint            x,
-                                                          guint            y,
-                                                          guint            w,
-                                                          guint            h);
 
 static void        gimp_projection_projectable_invalidate(GimpProjectable *projectable,
                                                           gint             x,
@@ -681,7 +675,23 @@ gimp_projection_paint_area (GimpProjection *proj,
   x2 = CLAMP (x + w, 0, width);
   y2 = CLAMP (y + h, 0, height);
 
-  gimp_projection_invalidate (proj, x1, y1, x2 - x1, y2 - y1);
+  if (now)
+    {
+      GeglNode *graph = gimp_projectable_get_graph (proj->projectable);
+
+      if (proj->validate_handler)
+        gimp_tile_handler_projection_undo_invalidate (proj->validate_handler,
+                                                      x1, y1, x2 - x1, y2 - y1);
+
+      gegl_node_blit_buffer (graph, proj->buffer,
+                             GEGL_RECTANGLE (x1, y1, x2 - x1, y2 - y1));
+    }
+  else
+    {
+      if (proj->validate_handler)
+        gimp_tile_handler_projection_invalidate (proj->validate_handler,
+                                                 x1, y1, x2 - x1, y2 - y1);
+    }
 
   /*  add the projectable's offsets because the list of update areas
    *  is in tile-pyramid coordinates, but our external API is always
@@ -695,18 +705,6 @@ gimp_projection_paint_area (GimpProjection *proj,
                  y2 - y1);
 }
 
-static void
-gimp_projection_invalidate (GimpProjection *proj,
-                            guint           x,
-                            guint           y,
-                            guint           w,
-                            guint           h)
-{
-  if (proj->validate_handler)
-    gimp_tile_handler_projection_invalidate (proj->validate_handler,
-                                             x, y, w, h);
-}
-
 
 /*  image callbacks  */
 


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