engrave: Fix condition as average[] is initialized based on num_channels

This commit is contained in:
Mukund Sivaraman
2011-10-13 10:20:34 +05:30
parent 35a62be10a
commit c4be5b1a4f

View File

@ -522,6 +522,8 @@ engrave_sub (gint height,
gint count; gint count;
gint i; gint i;
g_return_if_fail ((num_channels == 1) || (num_channels == 3));
/* /*
Since there's so many nested FOR's, Since there's so many nested FOR's,
put a few of them here... put a few of them here...
@ -555,7 +557,7 @@ engrave_sub (gint height,
for (i = 0; i < num_channels; i++) for (i = 0; i < num_channels; i++)
average[i] /= count; average[i] /= count;
if (bpp < 3) if (num_channels == 1)
inten = average[0] / 254.0 * height; inten = average[0] / 254.0 * height;
else else
inten = GIMP_RGB_LUMINANCE (average[0], inten = GIMP_RGB_LUMINANCE (average[0],