[gimp] Issue #1677 - Alpha channel copy / Layer Mask issues
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Issue #1677 - Alpha channel copy / Layer Mask issues
- Date: Tue, 19 Jun 2018 10:40:33 +0000 (UTC)
commit f815a2d922c6a301d34714d623db4f10848f1d5b
Author: Michael Natterer <mitch gimp org>
Date: Tue Jun 19 12:37:59 2018 +0200
Issue #1677 - Alpha channel copy / Layer Mask issues
gimp_layer_create_mask(): make sure we don't do a gamma conversion
when initializing the mask from a channel. This was probably not the
last place to need this fix.
Also get rid of a second switch(add_mask_type), must be some leftover
from long gone logic.
app/core/gimplayer.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index d19e1181b2..75781e8f65 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -1914,20 +1914,10 @@ gimp_layer_create_mask (GimpLayer *layer,
{
case GIMP_ADD_MASK_WHITE:
gimp_channel_all (GIMP_CHANNEL (mask), FALSE);
- return mask;
-
- case GIMP_ADD_MASK_BLACK:
- gimp_channel_clear (GIMP_CHANNEL (mask), NULL, FALSE);
- return mask;
-
- default:
break;
- }
- switch (add_mask_type)
- {
- case GIMP_ADD_MASK_WHITE:
case GIMP_ADD_MASK_BLACK:
+ gimp_channel_clear (GIMP_CHANNEL (mask), NULL, FALSE);
break;
case GIMP_ADD_MASK_ALPHA:
@@ -1996,12 +1986,17 @@ gimp_layer_create_mask (GimpLayer *layer,
if ((copy_width || copy_height) && ! channel_empty)
{
- GeglBuffer *src;
- GeglBuffer *dest;
+ GeglBuffer *src;
+ GeglBuffer *dest;
+ const Babl *format;
src = gimp_drawable_get_buffer (GIMP_DRAWABLE (channel));
dest = gimp_drawable_get_buffer (GIMP_DRAWABLE (mask));
+ format = gegl_buffer_get_format (src);
+
+ /* make sure no gamma conversion happens */
+ gegl_buffer_set_format (dest, format);
gimp_gegl_buffer_copy (src,
GEGL_RECTANGLE (copy_x, copy_y,
copy_width, copy_height),
@@ -2010,6 +2005,7 @@ gimp_layer_create_mask (GimpLayer *layer,
GEGL_RECTANGLE (copy_x - offset_x,
copy_y - offset_y,
0, 0));
+ gegl_buffer_set_format (dest, NULL);
GIMP_CHANNEL (mask)->bounds_known = FALSE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]