[gimp] Bug 793714 - Error when merging layer group with Pass through mode
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 793714 - Error when merging layer group with Pass through mode
- Date: Wed, 25 Apr 2018 12:44:36 +0000 (UTC)
commit 4fce5d2518898b6c98e44238c5ac4891c37855a9
Author: Ell <ell_se yahoo com>
Date: Wed Apr 25 08:40:03 2018 -0400
Bug 793714 - Error when merging layer group with Pass through mode
When merging a pass-through group, change its mode to NORMAL first,
to avoid a critical when duplicating the group as a regular layer.
Preserve the group's blend/composite space/mode while changing its
mode (note that only the composite space currently matters, since
the other parmaeters are immutable for pass-through groups.)
app/core/gimpimage-merge.c | 23 +++++++++++++++++++++++
1 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/app/core/gimpimage-merge.c b/app/core/gimpimage-merge.c
index b65ff0a..a344ed9 100644
--- a/app/core/gimpimage-merge.c
+++ b/app/core/gimpimage-merge.c
@@ -336,6 +336,29 @@ gimp_image_merge_group_layer (GimpImage *image,
parent = gimp_layer_get_parent (GIMP_LAYER (group));
index = gimp_item_get_index (GIMP_ITEM (group));
+ /* if this is a pass-through group, change its mode to NORMAL *before*
+ * duplicating it, since PASS_THROUGH mode is invalid for regular layers.
+ * see bug #793714.
+ */
+ if (gimp_layer_get_mode (GIMP_LAYER (group)) == GIMP_LAYER_MODE_PASS_THROUGH)
+ {
+ GimpLayerColorSpace blend_space;
+ GimpLayerColorSpace composite_space;
+ GimpLayerCompositeMode composite_mode;
+
+ /* keep the group's current blend space, composite space, and composite
+ * mode.
+ */
+ blend_space = gimp_layer_get_blend_space (GIMP_LAYER (group));
+ composite_space = gimp_layer_get_composite_space (GIMP_LAYER (group));
+ composite_mode = gimp_layer_get_composite_mode (GIMP_LAYER (group));
+
+ gimp_layer_set_mode (GIMP_LAYER (group), GIMP_LAYER_MODE_NORMAL, TRUE);
+ gimp_layer_set_blend_space (GIMP_LAYER (group), blend_space, TRUE);
+ gimp_layer_set_composite_space (GIMP_LAYER (group), composite_space, TRUE);
+ gimp_layer_set_composite_mode (GIMP_LAYER (group), composite_mode, TRUE);
+ }
+
layer = GIMP_LAYER (gimp_item_duplicate (GIMP_ITEM (group),
GIMP_TYPE_LAYER));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]