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



commit c4be5b1a4fd797d79de96be72d6d87c3cdb5a963
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]