]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sun, 11 Jan 2015 15:08:21 +0000 (15:08 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sun, 11 Jan 2015 15:08:21 +0000 (15:08 +0000)
MagickCore/quantize.c

index 4a1e5e255ec6ec68ed9503d7f335a28b10c0d4f8..290e003f5d118bd644953045ae3dea1573c31ec8 100644 (file)
@@ -3118,8 +3118,7 @@ static void ReduceImageColors(const Image *image,CubeInfo *cube_info)
     span;
 
   cube_info->next_threshold=0.0;
-  if ((cube_info->colors > cube_info->maximum_colors) && 
-      (cube_info->nodes > 256))
+  if (cube_info->colors > cube_info->maximum_colors)
     {
       MagickRealType
         *quantize_error;
@@ -3135,8 +3134,9 @@ static void ReduceImageColors(const Image *image,CubeInfo *cube_info)
             quantize_error);
           qsort(quantize_error,cube_info->nodes,sizeof(MagickRealType),
             MagickRealTypeCompare);
-          cube_info->next_threshold=quantize_error[MagickMax((ssize_t)
-            cube_info->nodes-110*(cube_info->maximum_colors+1)/100,0)];
+          if (cube_info->nodes > (110*(cube_info->maximum_colors+1)/100))
+            cube_info->next_threshold=quantize_error[cube_info->nodes-110*
+              (cube_info->maximum_colors+1)/100];
           quantize_error=(MagickRealType *) RelinquishMagickMemory(
             quantize_error);
         }