[gimp/gimp-2-6] gimp_layer_transform_color(): don't assume the dest region has alpha
- From: Michael Natterer <mitch src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-6] gimp_layer_transform_color(): don't assume the dest region has alpha
- Date: Tue, 8 Sep 2009 19:06:50 +0000 (UTC)
commit 2872f1d4277aa2aa5d7f0c384db0c122823c8a1a
Author: Michael Natterer <mitch gimp org>
Date: Tue Sep 8 20:54:51 2009 +0200
gimp_layer_transform_color(): don't assume the dest region has alpha
Don't blindly fill the dest region's alpha channel even if it has
none. Fixes longstanding bug that made things without alpha dropped
to indexed images to arrive broken.
(cherry picked from commit 0c57e8c68e256b81cda1de7b8aca66cdfd4afe04)
app/core/gimplayer.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/app/core/gimplayer.c b/app/core/gimplayer.c
index b1d31f9..302a18c 100644
--- a/app/core/gimplayer.c
+++ b/app/core/gimplayer.c
@@ -913,8 +913,9 @@ gimp_layer_transform_color (GimpImage *image,
PixelRegion *destPR,
GimpImageType dest_type)
{
- GimpImageBaseType base_type = GIMP_IMAGE_TYPE_BASE_TYPE (src_type);
- gboolean alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (src_type);
+ GimpImageBaseType base_type = GIMP_IMAGE_TYPE_BASE_TYPE (src_type);
+ gboolean src_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (src_type);
+ gboolean dest_alpha = GIMP_IMAGE_TYPE_HAS_ALPHA (dest_type);
gpointer pr;
for (pr = pixel_regions_register (2, srcPR, destPR);
@@ -935,9 +936,9 @@ gimp_layer_transform_color (GimpImage *image,
{
gimp_image_transform_color (image, dest_type, d, base_type, s);
- /* alpha channel */
- d[destPR->bytes - 1] = (alpha ?
- s[srcPR->bytes - 1] : OPAQUE_OPACITY);
+ if (dest_alpha)
+ d[destPR->bytes - 1] = (src_alpha ?
+ s[srcPR->bytes - 1] : OPAQUE_OPACITY);
s += srcPR->bytes;
d += destPR->bytes;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]