[gegl] map-{absolute, relative}: don't extend required/invalidated ROI when using NEAREST



commit 46dcf4d088ec48b753f39268867d8728ed901370
Author: Ell <ell_se yahoo com>
Date:   Sun Mar 3 13:22:11 2019 -0500

    map-{absolute,relative}: don't extend required/invalidated ROI when using NEAREST
    
    In gegl:map-{absolute,relative}, don't extend the required/
    invalidated ROI by one pixel when using a NEAREST sampler, since
    the extra pixels are only required to calculate the sampler's scale
    matrix, which isn't used in this case.

 operations/common/map-common.h | 26 ++++++++++++++++++--------
 1 file changed, 18 insertions(+), 8 deletions(-)
---
diff --git a/operations/common/map-common.h b/operations/common/map-common.h
index 1e89b00ae..4a98ee2e7 100644
--- a/operations/common/map-common.h
+++ b/operations/common/map-common.h
@@ -40,6 +40,8 @@ get_required_for_output (GeglOperation       *operation,
                          const gchar         *input_pad,
                          const GeglRectangle *region)
 {
+  GeglProperties *o = GEGL_PROPERTIES (operation);
+
   if (! strcmp (input_pad, "input"))
     {
       return *gegl_operation_source_get_bounding_box (operation, "input");
@@ -48,10 +50,13 @@ get_required_for_output (GeglOperation       *operation,
     {
       GeglRectangle rect = *region;
 
-      rect.x      -= 1;
-      rect.y      -= 1;
-      rect.width  += 2;
-      rect.height += 2;
+      if (o->sampler_type != GEGL_SAMPLER_NEAREST)
+        {
+          rect.x      -= 1;
+          rect.y      -= 1;
+          rect.width  += 2;
+          rect.height += 2;
+        }
 
       return rect;
     }
@@ -62,6 +67,8 @@ get_invalidated_by_change (GeglOperation       *operation,
                            const gchar         *input_pad,
                            const GeglRectangle *region)
 {
+  GeglProperties *o = GEGL_PROPERTIES (operation);
+
   if (! strcmp (input_pad, "input"))
     {
       return gegl_operation_get_bounding_box (operation);
@@ -70,10 +77,13 @@ get_invalidated_by_change (GeglOperation       *operation,
     {
       GeglRectangle rect = *region;
 
-      rect.x      -= 1;
-      rect.y      -= 1;
-      rect.width  += 2;
-      rect.height += 2;
+      if (o->sampler_type != GEGL_SAMPLER_NEAREST)
+        {
+          rect.x      -= 1;
+          rect.y      -= 1;
+          rect.width  += 2;
+          rect.height += 2;
+        }
 
       return rect;
     }


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