[mapguide-commits] r4496 - trunk/MgDev/Common/Renderers
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Fri Jan 8 00:00:05 EST 2010
Author: waltweltonlair
Date: 2010-01-08 00:00:03 -0500 (Fri, 08 Jan 2010)
New Revision: 4496
Modified:
trunk/MgDev/Common/Renderers/AGGRenderer.cpp
trunk/MgDev/Common/Renderers/DWFRenderer.cpp
trunk/MgDev/Common/Renderers/GDRenderer.cpp
Log:
Finish fixing #84 (Mapping space line widths can cause extreme memory usage)
This ticket applies to GD renderer.
Notes in the ticket said this had not yet been fixed for borders of areas. That
actually was fixed - polylines and polygon borders are both drawn using the same
code - WritePolylines. The case that wasn't fixed was enhanced stylization -
DrawScreenPolyline. I added the code to limit the line weight.
Also improved a few comments.
Modified: trunk/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/AGGRenderer.cpp 2010-01-07 23:47:33 UTC (rev 4495)
+++ trunk/MgDev/Common/Renderers/AGGRenderer.cpp 2010-01-08 05:00:03 UTC (rev 4496)
@@ -504,7 +504,7 @@
{
m_lineStroke.color = use_lsym.color().argb();
- // convert thickness to equivalent mapping space width
+ // convert thickness to pixels
double thickness = use_lsym.width();
m_lineStroke.weight = max(1.0, _MeterToMapSize(use_lsym.units(), fabs(thickness)) * m_xform.x0);
@@ -610,7 +610,7 @@
{
m_lineStroke.color = use_lsym->color().argb();
- // convert thickness to equivalent mapping space width
+ // convert thickness to pixels
double thickness = use_lsym->width();
m_lineStroke.weight = max(1.0, _MeterToMapSize(use_lsym->units(), fabs(thickness)) * m_xform.x0);
Modified: trunk/MgDev/Common/Renderers/DWFRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/DWFRenderer.cpp 2010-01-07 23:47:33 UTC (rev 4495)
+++ trunk/MgDev/Common/Renderers/DWFRenderer.cpp 2010-01-08 05:00:03 UTC (rev 4496)
@@ -1781,9 +1781,8 @@
{
m_w2dFile->desired_rendition().color() = Util_ConvertColor(stroke.color());
+ //convert thickness to W2D units
double thickness = stroke.width();
-
- //convert thickness to equivalent mapping space width
int line_weight = (int)(_MeterToMapSize(stroke.units(), fabs(thickness)) * m_scale);
m_w2dFile->desired_rendition().line_weight() = WT_Line_Weight(line_weight);
Modified: trunk/MgDev/Common/Renderers/GDRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/GDRenderer.cpp 2010-01-07 23:47:33 UTC (rev 4495)
+++ trunk/MgDev/Common/Renderers/GDRenderer.cpp 2010-01-08 05:00:03 UTC (rev 4496)
@@ -1228,18 +1228,14 @@
double thickness = stroke.width();
- //convert thickness to equivalent mapping space width
+ //convert thickness to pixels
int line_weight = (int)(_MeterToMapSize(stroke.units(), fabs(thickness)) * m_scale);
if (line_weight > m_maxLineWidth)
- {
line_weight = m_maxLineWidth;
- }
- gdImagePtr brush1 = NULL;
+ gdImagePtr brush1 = NULL;
if (line_weight > 1)
- {
brush1 = rs_gdImageThickLineBrush(line_weight, stroke.color());
- }
//draw the lines
for (int i=0; i<srclb->cntr_count(); i++)
@@ -2375,13 +2371,12 @@
//line width is always device space and units are meters.
//so convert to equivalent pixel width
int line_weight = (int)lineStroke.weight;
+ if (line_weight > m_maxLineWidth)
+ line_weight = m_maxLineWidth;
gdImagePtr brush1 = NULL;
-
if (line_weight > 1)
- {
brush1 = rs_gdImageThickLineBrush(line_weight, c);
- }
//draw the lines
for (int i=0; i<srclb->cntr_count(); i++)
@@ -2395,7 +2390,7 @@
{
//draw antialiased only if thickness is single pixel
if (line_weight <= 1)
- gdImageOpenPolygon((gdImagePtr)m_imout, (gdPointPtr)m_wtPointBuffer, cntr_size, gdAntiAliased/*gdc*/);
+ gdImageOpenPolygon((gdImagePtr)m_imout, (gdPointPtr)m_wtPointBuffer, cntr_size, gdAntiAliased);
else
{
gdImageSetBrush((gdImagePtr)m_imout, brush1);
More information about the mapguide-commits
mailing list