[mapguide-commits] r1314 - trunk/MgDev/Common/Stylization
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Wed Mar 21 11:01:23 EDT 2007
Author: traianstanev
Date: 2007-03-21 11:01:23 -0400 (Wed, 21 Mar 2007)
New Revision: 1314
Modified:
trunk/MgDev/Common/Stylization/GDRenderer.cpp
Log:
For image output, only save alpha values if the background color is not opaque, otherwise drop it. This cuts down PNG compression time (by 20% or so) and also image size by a little bit. This will not speed up tile generation though, since tiles use transparent background so that base layer groups can composite on top of each other.
Modified: trunk/MgDev/Common/Stylization/GDRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Stylization/GDRenderer.cpp 2007-03-21 11:21:43 UTC (rev 1313)
+++ trunk/MgDev/Common/Stylization/GDRenderer.cpp 2007-03-21 15:01:23 UTC (rev 1314)
@@ -252,8 +252,12 @@
// Make output image non-interlaced --- it's a little faster to compress that way.
gdImageInterlace(im, 0);
- // Make sure the alpha values get saved
- gdImageSaveAlpha(im, 1);
+ // Make sure the alpha values get saved -- but only if required
+ // it is faster not to save them and makes a smaller PNG
+ if (m_bgcolor.alpha() == 255)
+ gdImageSaveAlpha(im, 1);
+ else
+ gdImageSaveAlpha(im, 0);
//get an in-memory image stream
int size = 0;
More information about the mapguide-commits
mailing list