gimp r27067 - in trunk: . plug-ins/flame



Author: martinn
Date: Sat Sep 27 16:03:38 2008
New Revision: 27067
URL: http://svn.gnome.org/viewvc/gimp?rev=27067&view=rev

Log:
Bug 551864 â plugin Flame fails for some settings on 64bit
machines

* plug-ins/flame/rect.c (render_rectangle): To handle p[0] and
p[1] being NaN, make sure that they are "within bounds" instead of
"not outside bounds".


Modified:
   trunk/ChangeLog
   trunk/plug-ins/flame/rect.c

Modified: trunk/plug-ins/flame/rect.c
==============================================================================
--- trunk/plug-ins/flame/rect.c	(original)
+++ trunk/plug-ins/flame/rect.c	Sat Sep 27 16:03:38 2008
@@ -274,21 +274,30 @@
               int k, color_index;
               double *p = points[j];
               bucket *b;
-              if (p[0] < bounds[0] ||
-                  p[1] < bounds[1] ||
-                  p[0] > bounds[2] ||
-                  p[1] > bounds[3])
-                continue;
-              color_index = (int) (p[2] * CMAP_SIZE);
-              if (color_index < 0)
-                color_index = 0;
-              else if (color_index > (CMAP_SIZE-1))
-                color_index = CMAP_SIZE-1;
-              b = buckets +
-                  (int) (width * (p[0] - bounds[0]) * size[0]) +
-                  width * (int) (height * (p[1] - bounds[1]) * size[1]);
-              for (k = 0; k < 4; k++)
-                bump_no_overflow(b[0][k], cmap[color_index][k], short);
+
+              /* Note that we must test if p[0] and p[1] is "within"
+               * the valid bounds rather than "not outside", because
+               * p[0] and p[1] might be NaN.
+               */
+              if (p[0] >= bounds[0] &&
+                  p[1] >= bounds[1] &&
+                  p[0] <= bounds[2] &&
+                  p[1] <= bounds[3])
+                {
+                  color_index = (int) (p[2] * CMAP_SIZE);
+
+                  if (color_index < 0)
+                    color_index = 0;
+                  else if (color_index > CMAP_SIZE - 1)
+                    color_index = CMAP_SIZE - 1;
+
+                  b = buckets +
+                      (int) (width * (p[0] - bounds[0]) * size[0]) +
+                      width * (int) (height * (p[1] - bounds[1]) * size[1]);
+
+                  for (k = 0; k < 4; k++)
+                    bump_no_overflow(b[0][k], cmap[color_index][k], short);
+                }
             }
         }
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]