]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 16 Jan 2012 00:43:18 +0000 (00:43 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 16 Jan 2012 00:43:18 +0000 (00:43 +0000)
MagickCore/effect.c

index c1a949a5b5f6092a75908a9293ed87033c746b0d..9d5152802a7485747e684bccca02989aca94d2f1 100644 (file)
@@ -1466,32 +1466,39 @@ MagickExport Image *ConvolveImage(const Image *image,
 %
 */
 
-static void Hull(const ssize_t x,const ssize_t y,const int polarity,
+static void inline Hull(const ssize_t x,const ssize_t y,const int polarity,
   Quantum *pixels)
 {
   double
-    a,
-    b,
-    c;
+    pixel;
 
-  b=(double) pixels[4];
-  a=(double) pixels[4-(y*3)-x];
-  c=(double) pixels[4+(y*3)+x];
+  Quantum
+    *a,
+    *b,
+    *c;
+
+  b=pixels+4;
+  a=b-(y*3)-x;
+  c=b+(y*3)+x;
+  pixel=(double) *b;
   if (polarity > 0)
     {
-      if (c >= (b+ScaleCharToQuantum(2)))
-        b+=ScaleCharToQuantum(1);
-      if (a >= (b+ScaleCharToQuantum(2)) && (c > b))
-        b+=ScaleCharToQuantum(1);
+      if ((double) *c >= (pixel+ScaleCharToQuantum(2)))
+        pixel+=ScaleCharToQuantum(1);
     }
   else
+    if ((double) *c <= (pixel-ScaleCharToQuantum(2)))
+      pixel-=ScaleCharToQuantum(1);
+  if (polarity > 0)
     {
-      if (c <= (b-ScaleCharToQuantum(2)))
-        b-=ScaleCharToQuantum(1);
-      if (a <= (b-ScaleCharToQuantum(2)) && (c < b))
-        b-=ScaleCharToQuantum(1);
+      if (((double) *a >= (pixel+ScaleCharToQuantum(2))) &&
+          ((double) *c > pixel))
+        pixel+=ScaleCharToQuantum(1);
     }
-  pixels[4]=ClampToQuantum(b);
+  else
+    if (((double) *a <= (pixel-ScaleCharToQuantum(2))) && ((double) *c < pixel))
+      pixel-=ScaleCharToQuantum(1);
+  pixels[4]=ClampToQuantum(pixel);
 }
 
 MagickExport Image *DespeckleImage(const Image *image,ExceptionInfo *exception)