[gegl] tile-seamless: pass-through on infinite planes



commit 69f20cf994213faed8b935b5fe21424579c49721
Author: Thomas Manni <thomas manni free fr>
Date:   Wed Jul 24 11:38:41 2019 +0200

    tile-seamless: pass-through on infinite planes

 operations/common/tile-seamless.c | 49 +++++++++++++++++++++++++++++++++++++--
 1 file changed, 47 insertions(+), 2 deletions(-)
---
diff --git a/operations/common/tile-seamless.c b/operations/common/tile-seamless.c
index 15d07b6eb..1d6a691d1 100644
--- a/operations/common/tile-seamless.c
+++ b/operations/common/tile-seamless.c
@@ -139,14 +139,58 @@ get_required_for_output (GeglOperation       *operation,
                          const gchar         *input_pad,
                          const GeglRectangle *roi)
 {
-  return *gegl_operation_source_get_bounding_box (operation, "input");
+  GeglRectangle *in_rect =
+      gegl_operation_source_get_bounding_box (operation, "input");
+
+  if (! in_rect)
+    return *roi;
+
+  if (in_rect && gegl_rectangle_is_infinite_plane (in_rect))
+    return *roi;
+
+  return *in_rect;
 }
 
 static GeglRectangle
 get_cached_region (GeglOperation       *operation,
                    const GeglRectangle *roi)
 {
-  return *gegl_operation_source_get_bounding_box (operation, "input");
+  GeglRectangle *in_rect =
+      gegl_operation_source_get_bounding_box (operation, "input");
+
+  if (! in_rect)
+    return *roi;
+
+  if (in_rect && gegl_rectangle_is_infinite_plane (in_rect))
+    return *roi;
+
+  return *in_rect;
+}
+
+static gboolean
+operation_process (GeglOperation        *operation,
+                   GeglOperationContext *context,
+                   const gchar          *output_prop,
+                   const GeglRectangle  *result,
+                   gint                  level)
+{
+  GeglOperationClass  *operation_class;
+
+  const GeglRectangle *in_rect =
+    gegl_operation_source_get_bounding_box (operation, "input");
+
+  if (in_rect && gegl_rectangle_is_infinite_plane (in_rect))
+    {
+      gpointer in = gegl_operation_context_get_object (context, "input");
+      gegl_operation_context_take_object (context, "output",
+                                          g_object_ref (G_OBJECT (in)));
+      return TRUE;
+    }
+
+  operation_class = GEGL_OPERATION_CLASS (gegl_op_parent_class);
+
+  return operation_class->process (operation, context, output_prop, result,
+                                   gegl_operation_context_get_level (context));
 }
 
 static void
@@ -160,6 +204,7 @@ gegl_op_class_init (GeglOpClass *klass)
 
   filter_class->process                    = process;
   operation_class->prepare                 = prepare;
+  operation_class->process                 = operation_process;
   operation_class->get_required_for_output = get_required_for_output;
   operation_class->get_cached_region       = get_cached_region;
 


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