[gimp/metadata-browser] engrave: Fix condition as average[] is initialized based on num_channels
- From: Roman Joost <romanofski src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/metadata-browser] engrave: Fix condition as average[] is initialized based on num_channels
- Date: Fri, 2 Dec 2011 02:21:46 +0000 (UTC)
commit 8d5a7f5dd691a91409fff49c112dcaf155d58efe
Author: Mukund Sivaraman <muks banu com>
Date: Thu Oct 13 10:20:34 2011 +0530
engrave: Fix condition as average[] is initialized based on num_channels
plug-ins/common/engrave.c | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
---
diff --git a/plug-ins/common/engrave.c b/plug-ins/common/engrave.c
index 1797cc9..8b9307f 100644
--- a/plug-ins/common/engrave.c
+++ b/plug-ins/common/engrave.c
@@ -522,6 +522,8 @@ engrave_sub (gint height,
gint count;
gint i;
+ g_return_if_fail ((num_channels == 1) || (num_channels == 3));
+
/*
Since there's so many nested FOR's,
put a few of them here...
@@ -555,7 +557,7 @@ engrave_sub (gint height,
for (i = 0; i < num_channels; i++)
average[i] /= count;
- if (bpp < 3)
+ if (num_channels == 1)
inten = average[0] / 254.0 * height;
else
inten = GIMP_RGB_LUMINANCE (average[0],
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]