[gimp] app: in gimp_gegl_apply_cached_operation(), intersect cached rects with dest rect
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: in gimp_gegl_apply_cached_operation(), intersect cached rects with dest rect
- Date: Sun, 30 Dec 2018 13:06:27 +0000 (UTC)
commit d9b4ffe09e055ee5109e104605c060ce09c77fa0
Author: Ell <ell_se yahoo com>
Date: Sun Dec 30 07:47:47 2018 -0500
app: in gimp_gegl_apply_cached_operation(), intersect cached rects with dest rect
In gimp_gegl_apply_cached_operation(), intersect the cached rects
with the dest rect, so that we don't unnecessarily (if not
erroneously) copy cached regions outside the dest rect to the dest
buffer. This can happen when the op's applicator crop-rect changes
dynamically.
app/gegl/gimp-gegl-apply-operation.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/app/gegl/gimp-gegl-apply-operation.c b/app/gegl/gimp-gegl-apply-operation.c
index 46e4a67996..df4f3dd96e 100644
--- a/app/gegl/gimp-gegl-apply-operation.c
+++ b/app/gegl/gimp-gegl-apply-operation.c
@@ -212,14 +212,22 @@ gimp_gegl_apply_cached_operation (GeglBuffer *src_buffer,
for (i = 0; i < n_valid_rects; i++)
{
- gimp_gegl_buffer_copy (cache, valid_rects + i, GEGL_ABYSS_NONE,
- dest_buffer, valid_rects + i);
+ GeglRectangle valid_rect;
+
+ if (! gegl_rectangle_intersect (&valid_rect,
+ &valid_rects[i], &rect))
+ {
+ continue;
+ }
+
+ gimp_gegl_buffer_copy (cache, &valid_rect, GEGL_ABYSS_NONE,
+ dest_buffer, &valid_rect);
cairo_region_subtract_rectangle (region,
(cairo_rectangle_int_t *)
- valid_rects + i);
+ &valid_rect);
- done_pixels += valid_rects[i].width * valid_rects[i].height;
+ done_pixels += valid_rect.width * valid_rect.height;
if (progress)
gimp_progress_set_value (progress,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]