From 50acd95e9d718a55f2cf7d256c482a5dd725cc4a Mon Sep 17 00:00:00 2001 From: Martin Nordholts Date: Wed, 7 Sep 2011 16:00:48 +0200 Subject: [PATCH] app: Use pixel_region_has_alpha() For increased readability. --- app/base/color-balance.c | 2 +- app/base/colorize.c | 2 +- app/base/desaturate.c | 9 ++++++--- app/base/hue-saturation.c | 2 +- app/base/threshold.c | 2 +- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/app/base/color-balance.c b/app/base/color-balance.c index fa77683e2b..62a47ac93f 100644 --- a/app/base/color-balance.c +++ b/app/base/color-balance.c @@ -180,7 +180,7 @@ color_balance (ColorBalance *cb, h = srcPR->h; src = srcPR->data; dest = destPR->data; - alpha = (srcPR->bytes == 4) ? TRUE : FALSE; + alpha = pixel_region_has_alpha (srcPR); while (h--) { diff --git a/app/base/colorize.c b/app/base/colorize.c index 1fd14a3933..26e9b4062f 100644 --- a/app/base/colorize.c +++ b/app/base/colorize.c @@ -92,7 +92,7 @@ colorize (Colorize *colorize, h = srcPR->h; src = srcPR->data; dest = destPR->data; - alpha = (srcPR->bytes == 4) ? TRUE : FALSE; + alpha = pixel_region_has_alpha (srcPR); while (h--) { diff --git a/app/base/desaturate.c b/app/base/desaturate.c index 944c6e91aa..0468a137d7 100644 --- a/app/base/desaturate.c +++ b/app/base/desaturate.c @@ -51,15 +51,18 @@ desaturate_region (GimpDesaturateMode *mode, switch (*mode) { case GIMP_DESATURATE_LIGHTNESS: - desaturate_region_lightness (srcPR, destPR, srcPR->bytes == 4); + desaturate_region_lightness (srcPR, destPR, + pixel_region_has_alpha (srcPR)); break; case GIMP_DESATURATE_LUMINOSITY: - desaturate_region_luminosity (srcPR, destPR, srcPR->bytes == 4); + desaturate_region_luminosity (srcPR, destPR, + pixel_region_has_alpha (srcPR)); break; case GIMP_DESATURATE_AVERAGE: - desaturate_region_average (srcPR, destPR, srcPR->bytes == 4); + desaturate_region_average (srcPR, destPR, + pixel_region_has_alpha (srcPR)); break; } } diff --git a/app/base/hue-saturation.c b/app/base/hue-saturation.c index 61e69261fc..c914abdf47 100644 --- a/app/base/hue-saturation.c +++ b/app/base/hue-saturation.c @@ -116,7 +116,7 @@ hue_saturation (HueSaturation *hs, h = srcPR->h; src = srcPR->data; dest = destPR->data; - alpha = (srcPR->bytes == 4) ? TRUE : FALSE; + alpha = pixel_region_has_alpha (srcPR); while (h--) { diff --git a/app/base/threshold.c b/app/base/threshold.c index fbf7605111..f744c13148 100644 --- a/app/base/threshold.c +++ b/app/base/threshold.c @@ -40,7 +40,7 @@ threshold (Threshold *tr, h = srcPR->h; src = srcPR->data; dest = destPR->data; - has_alpha = (srcPR->bytes == 2 || srcPR->bytes == 4); + has_alpha = pixel_region_has_alpha (srcPR); alpha = has_alpha ? srcPR->bytes - 1 : srcPR->bytes; while (h--)