[gegl] crop: don't depend on the input node's bounding box ...
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gegl] crop: don't depend on the input node's bounding box ...
- Date: Tue, 20 Dec 2016 15:37:33 +0000 (UTC)
commit 808501c60e4843357ac6d7c44e1472ab4ab6879e
Author: Ell <ell_se yahoo com>
Date: Tue Dec 20 10:17:08 2016 -0500
crop: don't depend on the input node's bounding box ...
... in process()
At this point we already have the input buffer, and since what we
really care about is making sure that the output buffer is a
subset of it, we can use its extent directly.
operations/core/crop.c | 21 +++++++++++++++++----
1 files changed, 17 insertions(+), 4 deletions(-)
---
diff --git a/operations/core/crop.c b/operations/core/crop.c
index 3812fa3..1af88ff 100644
--- a/operations/core/crop.c
+++ b/operations/core/crop.c
@@ -143,15 +143,28 @@ gegl_crop_process (GeglOperation *operation,
const GeglRectangle *result,
gint level)
{
- GeglBuffer *input;
- gboolean success = FALSE;
- GeglRectangle extent = gegl_crop_get_bounding_box (operation);
+ GeglProperties *o = GEGL_PROPERTIES (operation);
+ GeglBuffer *input;
+ gboolean success = FALSE;
input = gegl_operation_context_get_source (context, "input");
if (input)
{
- GeglBuffer *output = gegl_buffer_create_sub_buffer (input, &extent);
+ GeglRectangle extent;
+ GeglBuffer *output;
+
+ extent = *GEGL_RECTANGLE (o->x, o->y, o->width, o->height);
+
+ /* The output buffer's extent must be a subset of the input buffer's
+ * extent; otherwise, if the output buffer is reused for in-place output,
+ * we might try to write to areas of the buffer that lie outside the
+ * input buffer, erroneously discarding the data.
+ */
+ gegl_rectangle_intersect (&extent,
+ &extent, gegl_buffer_get_extent (input));
+
+ output = gegl_buffer_create_sub_buffer (input, &extent);
if (gegl_object_get_has_forked (G_OBJECT (input)))
gegl_object_set_has_forked (G_OBJECT (output));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]