[gegl] transform: sometimes do less work in gegl_transform_get_invalidated_by_change



commit 34f217b7d4297c7c49e16fd27ff601e9a0d07c83
Author: Øyvind Kolås <pippin gimp org>
Date:   Wed Mar 28 00:07:21 2018 +0200

    transform: sometimes do less work in gegl_transform_get_invalidated_by_change
    
    As spotted by massimo in bug #694917 - the construction of this object is not
    neccesary in the case where we return early (finding the context rect could
    further also be special cased to always avoid the overhead of
    constructing/destroying a gobject).

 operations/transform/transform-core.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
---
diff --git a/operations/transform/transform-core.c b/operations/transform/transform-core.c
index 8d439dd..20f7f6f 100644
--- a/operations/transform/transform-core.c
+++ b/operations/transform/transform-core.c
@@ -989,6 +989,12 @@ gegl_transform_get_invalidated_by_change (GeglOperation       *op,
    * to be enough.
    */
 
+  gegl_transform_create_composite_matrix (transform, &matrix);
+
+  if (gegl_transform_is_intermediate_node (transform) ||
+      gegl_matrix3_is_identity (&matrix))
+    return region;
+
   sampler = gegl_buffer_sampler_new_at_level (NULL,
                                      babl_format("RaGaBaA float"),
                                      transform->sampler,
@@ -996,12 +1002,6 @@ gegl_transform_get_invalidated_by_change (GeglOperation       *op,
   context_rect = *gegl_sampler_get_context_rect (sampler);
   g_object_unref (sampler);
 
-  gegl_transform_create_composite_matrix (transform, &matrix);
-
-  if (gegl_transform_is_intermediate_node (transform) ||
-      gegl_matrix3_is_identity (&matrix))
-    return region;
-
   /*
    * Fatten (dilate) the input region by the context_rect.
    */


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