[gegl] long-shadow: pass-through on infinite planes (issue #179)



commit 9027da5c4e4003cf2aa07dce77fa2c1cab6ef8d3
Author: Thomas Manni <thomas manni free fr>
Date:   Tue Aug 6 21:14:12 2019 +0200

    long-shadow: pass-through on infinite planes (issue #179)

 operations/common/long-shadow.c | 29 ++++++++++++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
---
diff --git a/operations/common/long-shadow.c b/operations/common/long-shadow.c
index 10fd06e00..51a3b1e94 100644
--- a/operations/common/long-shadow.c
+++ b/operations/common/long-shadow.c
@@ -1527,7 +1527,7 @@ get_bounding_box (GeglOperation *operation)
     {
       GeglProperties *o = GEGL_PROPERTIES (operation);
 
-      if (is_finite (o))
+      if (is_finite (o) && ! gegl_rectangle_is_infinite_plane (in_rect))
         result = get_invalidated_by_change (operation, "input", in_rect);
       else
         result = *in_rect;
@@ -1633,6 +1633,32 @@ dispose (GObject *object)
   G_OBJECT_CLASS (gegl_op_parent_class)->dispose (object);
 }
 
+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
 gegl_op_class_init (GeglOpClass *klass)
 {
@@ -1650,6 +1676,7 @@ gegl_op_class_init (GeglOpClass *klass)
   operation_class->get_invalidated_by_change = get_invalidated_by_change;
   operation_class->get_bounding_box          = get_bounding_box;
   operation_class->get_cached_region         = get_cached_region;
+  operation_class->process                   = operation_process;
 
   /* FIXME:  we want 'threaded == TRUE' for finite shadows, and
    * 'threaded == FALSE' for infinite and fading shadows.  right now, there's


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