[gegl] operations: two more area filters clipped to the input extent



commit 4197c1037cb0eb8ac0c83eaa2089432995ea07be
Author: Téo Mazars <teomazars gmail com>
Date:   Sun Nov 17 14:14:50 2013 +0100

    operations: two more area filters clipped to the input extent

 operations/common/antialias.c |   18 ++++++++++++++++--
 operations/common/cartoon.c   |   20 +++++++++++++++++---
 2 files changed, 33 insertions(+), 5 deletions(-)
---
diff --git a/operations/common/antialias.c b/operations/common/antialias.c
index 6b88723..2a00dc8 100644
--- a/operations/common/antialias.c
+++ b/operations/common/antialias.c
@@ -66,6 +66,19 @@ prepare (GeglOperation *operation)
   op_area->bottom = 1;
 }
 
+static GeglRectangle
+get_bounding_box (GeglOperation *operation)
+{
+  GeglRectangle *region;
+
+  region = gegl_operation_source_get_bounding_box (operation, "input");
+
+  if (region != NULL)
+    return *region;
+  else
+    return *GEGL_RECTANGLE (0, 0, 0, 0);
+}
+
 static int
 extrapolate9 (const int components,
               gfloat *E0, gfloat *E1, gfloat *E2,
@@ -255,8 +268,9 @@ gegl_chant_class_init (GeglChantClass *klass)
   operation_class          = GEGL_OPERATION_CLASS (klass);
   filter_class             = GEGL_OPERATION_FILTER_CLASS (klass);
 
-  operation_class->prepare = prepare;
-  filter_class->process    = process;
+  operation_class->prepare          = prepare;
+  operation_class->get_bounding_box = get_bounding_box;
+  filter_class->process             = process;
 
   gegl_operation_class_set_keys (operation_class,
     "name",        "gegl:antialias",
diff --git a/operations/common/cartoon.c b/operations/common/cartoon.c
index f0fe185..33a737c 100644
--- a/operations/common/cartoon.c
+++ b/operations/common/cartoon.c
@@ -218,6 +218,19 @@ prepare (GeglOperation *operation)
     }
 }
 
+static GeglRectangle
+get_bounding_box (GeglOperation *operation)
+{
+  GeglRectangle *region;
+
+  region = gegl_operation_source_get_bounding_box (operation, "input");
+
+  if (region != NULL)
+    return *region;
+  else
+    return *GEGL_RECTANGLE (0, 0, 0, 0);
+}
+
 static gboolean
 process (GeglOperation       *operation,
          GeglBuffer          *input,
@@ -369,9 +382,10 @@ gegl_chant_class_init (GeglChantClass *klass)
   operation_class = GEGL_OPERATION_CLASS (klass);
   filter_class    = GEGL_OPERATION_FILTER_CLASS (klass);
 
-  object_class->finalize   = finalize;
-  operation_class->prepare = prepare;
-  filter_class->process    = process;
+  object_class->finalize            = finalize;
+  operation_class->prepare          = prepare;
+  operation_class->get_bounding_box = get_bounding_box;
+  filter_class->process             = process;
 
   gegl_operation_class_set_keys (operation_class,
     "categories",  "artistic",


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