[gimp/gimp-2-10] app: use gimp_tile_handler_validate_validate() in GimpProjection



commit 378dc07c7b2e7dc849a1a62fbec4471200155954
Author: Ell <ell_se yahoo com>
Date:   Wed Nov 28 13:08:57 2018 -0500

    app: use gimp_tile_handler_validate_validate() in GimpProjection
    
    Use gimp_tile_handler_validate_validate(), added in the last
    commit, in GimpProjection, in order to render the projection,
    instead of separately invalidating the buffer, undoing the
    invalidation, and then rendering the graph.  This is more
    efficient, and more idiomatic.
    
    (cherry picked from commit d6f0ca5531e73f8f002b41e700b71a166e5fe5ae)

 app/core/gimpprojection.c | 32 ++++++++++++++------------------
 1 file changed, 14 insertions(+), 18 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index cd5fbdf074..bc782b9c1d 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -726,16 +726,12 @@ gimp_projection_free_buffer (GimpProjection  *proj)
 
   if (proj->priv->buffer)
     {
-      if (proj->priv->validate_handler)
-        {
-          gimp_tile_handler_validate_unassign (proj->priv->validate_handler,
-                                               proj->priv->buffer);
-        }
+      gimp_tile_handler_validate_unassign (proj->priv->validate_handler,
+                                           proj->priv->buffer);
 
       g_clear_object (&proj->priv->buffer);
+      g_clear_object (&proj->priv->validate_handler);
     }
-
-  g_clear_object (&proj->priv->validate_handler);
 }
 
 static void
@@ -1143,19 +1139,19 @@ gimp_projection_paint_area (GimpProjection *proj,
                                 0, 0, width, height,
                                 &x, &y, &w, &h))
     {
-      if (proj->priv->validate_handler)
-        gimp_tile_handler_validate_invalidate (proj->priv->validate_handler,
-                                               GEGL_RECTANGLE (x, y, w, h));
       if (now)
         {
-          GeglNode *graph = gimp_projectable_get_graph (proj->priv->projectable);
-
-          if (proj->priv->validate_handler)
-            gimp_tile_handler_validate_undo_invalidate (proj->priv->validate_handler,
-                                                        GEGL_RECTANGLE (x, y, w, h));
-
-          gegl_node_blit_buffer (graph, proj->priv->buffer,
-                                 GEGL_RECTANGLE (x, y, w, h), 0, GEGL_ABYSS_NONE);
+          gimp_tile_handler_validate_validate (
+            proj->priv->validate_handler,
+            proj->priv->buffer,
+            GEGL_RECTANGLE (x, y, w, h),
+            FALSE);
+        }
+      else
+        {
+          gimp_tile_handler_validate_invalidate (
+            proj->priv->validate_handler,
+            GEGL_RECTANGLE (x, y, w, h));
         }
 
       /*  add the projectable's offsets because the list of update areas


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