[gimp/gimp-2-10] app: avoid NULL output in layer-mode ops
- From: Ell <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: avoid NULL output in layer-mode ops
- Date: Fri, 31 May 2019 16:26:08 +0000 (UTC)
commit 818570d6cc55c052fa1cf4f55b2cefe9d707dd6c
Author: Ell <ell_se yahoo com>
Date: Fri May 31 12:19:21 2019 -0400
app: avoid NULL output in layer-mode ops
In GimpOperationLayerMode and GimpOperationReplace, make sure we
don't return a NULL output buffer, or forward a NULL input buffer,
but rather create an appropriate empty buffer in this case. This
avoids wrong results when the layer-mode op's output is connected
to the aux input of a subsequent op, as a result of the op behaving
differently with a NULL aux buffer (in particular, this can happen
when a drawable filter's output bounding box is smaller than the
drawable.)
(cherry picked from commit 8fcac3298c4947fa1535ae11d6e268e6760d6156)
app/operations/layer-modes/gimpoperationlayermode.c | 7 ++++++-
app/operations/layer-modes/gimpoperationreplace.c | 11 +++++++++--
2 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/app/operations/layer-modes/gimpoperationlayermode.c
b/app/operations/layer-modes/gimpoperationlayermode.c
index 6fa277e4de..f925df735e 100644
--- a/app/operations/layer-modes/gimpoperationlayermode.c
+++ b/app/operations/layer-modes/gimpoperationlayermode.c
@@ -450,7 +450,12 @@ gimp_operation_layer_mode_parent_process (GeglOperation *operation,
else
{
/* ... the output is empty. */
- gegl_operation_context_set_object (context, "output", NULL);
+ gegl_operation_context_take_object (
+ context, "output",
+ G_OBJECT (gegl_buffer_new (result,
+ gegl_operation_get_format (operation,
+ "output"))));
+
return TRUE;
}
}
diff --git a/app/operations/layer-modes/gimpoperationreplace.c
b/app/operations/layer-modes/gimpoperationreplace.c
index 18111fd402..121801879f 100644
--- a/app/operations/layer-modes/gimpoperationreplace.c
+++ b/app/operations/layer-modes/gimpoperationreplace.c
@@ -96,9 +96,16 @@ gimp_operation_replace_parent_process (GeglOperation *op,
{
GObject *aux;
- aux = gegl_operation_context_get_object (context, "aux");
+ aux = gegl_operation_context_dup_object (context, "aux");
- gegl_operation_context_set_object (context, "output", aux);
+ if (! aux)
+ {
+ aux = G_OBJECT (
+ gegl_buffer_new (result,
+ gegl_operation_get_format (op, "output")));
+ }
+
+ gegl_operation_context_take_object (context, "output", aux);
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]