[mapserver-commits] r7961 - trunk/mapserver

svn at osgeo.org svn at osgeo.org
Sun Oct 5 12:24:57 EDT 2008


Author: tbonfort
Date: 2008-10-05 12:24:57 -0400 (Sun, 05 Oct 2008)
New Revision: 7961

Modified:
   trunk/mapserver/HISTORY.TXT
   trunk/mapserver/mapgd.c
Log:
added formatoption QUANTIZE_NEW to force going through the pngquant quantization algorithm instead of the GD one for imagemode RGB


Modified: trunk/mapserver/HISTORY.TXT
===================================================================
--- trunk/mapserver/HISTORY.TXT	2008-10-05 15:59:44 UTC (rev 7960)
+++ trunk/mapserver/HISTORY.TXT	2008-10-05 16:24:57 UTC (rev 7961)
@@ -11,6 +11,10 @@
 
 Current Version (5.3-dev, SVN trunk):
 ------------------------------------
+- added formatoption QUANTIZE_NEW to force going through the pngquant 
+  quantization algorithm instead of the GD one for imagemode RGB (the 
+  GD one can be kind of buggy)
+
 - fix some integer rounding errors in the agg line offseter (#2659)
 
 - fix a bug with shapes with duplicate end points. was causing nans

Modified: trunk/mapserver/mapgd.c
===================================================================
--- trunk/mapserver/mapgd.c	2008-10-05 15:59:44 UTC (rev 7960)
+++ trunk/mapserver/mapgd.c	2008-10-05 16:24:57 UTC (rev 7961)
@@ -3592,7 +3592,7 @@
 #ifdef USE_GD_PNG
     int force_pc256 = MS_FALSE;
     int force_palette = MS_FALSE;
-
+    int force_new_quantize = MS_FALSE;
     if( format->imagemode == MS_IMAGEMODE_RGB  || format->imagemode == MS_IMAGEMODE_RGBA ) {
       const char *force_string = msGetOutputFormatOption( format, "QUANTIZE_FORCE", "OFF" );
       if( strcasecmp(force_string,"on") == 0  || strcasecmp(force_string,"yes") == 0 || strcasecmp(force_string,"true") == 0 )
@@ -3601,10 +3601,15 @@
       force_string = msGetOutputFormatOption( format, "PALETTE_FORCE", "OFF" );
       if( strcasecmp(force_string,"on") == 0  || strcasecmp(force_string,"yes") == 0 || strcasecmp(force_string,"true") == 0 )
         force_palette = MS_TRUE;
+    
+     force_string = msGetOutputFormatOption( format, "QUANTIZE_NEW", "OFF" );
+      if( strcasecmp(force_string,"on") == 0  || strcasecmp(force_string,"yes") == 0 || strcasecmp(force_string,"true") == 0 )
+        force_new_quantize = MS_TRUE;
     }
+
 #ifdef USE_RGBA_PNG
-    if( format->imagemode == MS_IMAGEMODE_RGBA ) {
-      if( force_palette )
+    if( format->imagemode == MS_IMAGEMODE_RGBA || (force_pc256 && force_new_quantize)) {
+      if( force_palette)
         return msSaveImageRGBAPalette(img, ctx ,format);
       else if( force_pc256 )
         return msSaveImageRGBAQuantized(img, ctx ,format);



More information about the mapserver-commits mailing list