[gegl] operation: fix area-filter bounding-box and invlidated-by-change calc.



commit 3655f18bb2330059f47105561c332fad13edd1d0
Author: Ell <ell_se yahoo com>
Date:   Thu Apr 26 13:43:22 2018 -0400

    operation: fix area-filter bounding-box and invlidated-by-change calc.
    
    In GeglOperationAreaFilter, reverse the use of the left/right and
    top/bottom area parameters in get_bounding_box() and
    get_invalidated_by_change(), since these parameters specify the
    extra area needed when transforming an output region to an input
    region, while the above functions transform an input region to an
    output region.

 gegl/operation/gegl-operation-area-filter.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
---
diff --git a/gegl/operation/gegl-operation-area-filter.c b/gegl/operation/gegl-operation-area-filter.c
index 062fbce..4a9733b 100644
--- a/gegl/operation/gegl-operation-area-filter.c
+++ b/gegl/operation/gegl-operation-area-filter.c
@@ -85,10 +85,10 @@ get_bounding_box (GeglOperation *operation)
   if (result.width != 0 &&
       result.height != 0)
     {
-      result.x-= area->left;
-      result.y-= area->top;
-      result.width += area->left + area->right;
-      result.height += area->top + area->bottom;
+      result.x      -= area->right;
+      result.y      -= area->bottom;
+      result.width  += area->right + area->left;
+      result.height += area->bottom + area->top;
     }
 
   return result;
@@ -109,10 +109,10 @@ get_required_for_output (GeglOperation        *operation,
   if (rect.width  != 0 &&
       rect.height != 0)
     {
-      rect.x -= area->left;
-      rect.y -= area->top;
+      rect.x      -= area->left;
+      rect.y      -= area->top;
       rect.width  += area->left + area->right;
-      rect.height  += area->top + area->bottom;
+      rect.height += area->top + area->bottom;
     }
 
   return rect;
@@ -126,10 +126,10 @@ get_invalidated_by_change (GeglOperation        *operation,
   GeglOperationAreaFilter *area = GEGL_OPERATION_AREA_FILTER (operation);
   GeglRectangle            retval;
 
-  retval.x      = input_region->x - area->left;
-  retval.y      = input_region->y - area->top;
-  retval.width  = input_region->width  + area->left + area->right;
-  retval.height = input_region->height + area->top  + area->bottom;
+  retval.x      = input_region->x      - area->right;
+  retval.y      = input_region->y      - area->bottom;
+  retval.width  = input_region->width  + area->right  + area->left;
+  retval.height = input_region->height + area->bottom + area->top;
 
   return retval;
 }


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