[gimp] app: fix gimp_projection_get_pixel_at() for general bounding boxes



commit 02943e22f68bb1664c260a01ebb585f07d559c78
Author: Ell <ell_se yahoo com>
Date:   Wed Sep 4 18:23:31 2019 +0300

    app: fix gimp_projection_get_pixel_at() for general bounding boxes

 app/core/gimpprojection.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)
---
diff --git a/app/core/gimpprojection.c b/app/core/gimpprojection.c
index 34537551c5..9e31adb556 100644
--- a/app/core/gimpprojection.c
+++ b/app/core/gimpprojection.c
@@ -394,13 +394,19 @@ gimp_projection_get_pixel_at (GimpPickable *pickable,
                               const Babl   *format,
                               gpointer      pixel)
 {
-  GeglBuffer *buffer = gimp_projection_get_buffer (pickable);
+  GimpProjection *proj   = GIMP_PROJECTION (pickable);
+  GeglBuffer     *buffer = gimp_projection_get_buffer (pickable);
+  GeglRectangle   bounding_box;
+
+  bounding_box = gimp_projectable_get_bounding_box (proj->priv->projectable);
 
-  if (x <  0                               ||
-      y <  0                               ||
-      x >= gegl_buffer_get_width  (buffer) ||
-      y >= gegl_buffer_get_height (buffer))
-    return FALSE;
+  if (x <  bounding_box.x                      ||
+      y <  bounding_box.y                      ||
+      x >= bounding_box.x + bounding_box.width ||
+      y >= bounding_box.y + bounding_box.height)
+    {
+      return FALSE;
+    }
 
   gegl_buffer_sample (buffer, x, y, NULL, pixel, format,
                       GEGL_SAMPLER_NEAREST, GEGL_ABYSS_NONE);


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