[mapguide-commits] r7896 - trunk/MgDev/Common/Renderers

svn_mapguide at osgeo.org svn_mapguide at osgeo.org
Sun Nov 3 13:48:25 PST 2013


Author: waltweltonlair
Date: 2013-11-03 13:48:24 -0800 (Sun, 03 Nov 2013)
New Revision: 7896

Modified:
   trunk/MgDev/Common/Renderers/AGGRenderer.cpp
   trunk/MgDev/Common/Renderers/AGGW2DRewriter.cpp
Log:
Fix #1987 (Hatches from DWF files renders poorly using AGG Render)

Reviewed patch from Faruk attached to ticket, and applied a simplified version of fix.


Modified: trunk/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/AGGRenderer.cpp	2013-11-03 21:04:06 UTC (rev 7895)
+++ trunk/MgDev/Common/Renderers/AGGRenderer.cpp	2013-11-03 21:48:24 UTC (rev 7896)
@@ -2315,7 +2315,7 @@
     {
         c->ras.reset();
         c->ras.add_path(c->ps, pathids[i]);
-        if(c->bPolyClip)
+        if (c->bPolyClip)
         {
             c->clip_ren.color(agg::argb8_packed(color));
             agg::render_scanlines(c->ras, c->sl, c->clip_ren);
@@ -2669,7 +2669,7 @@
         else
             agg::render_scanlines_bin(cxt->ras, cxt->sl, cxt->ren_pre, sa, sg);
     }
-    else if(format == RS_ImageFormat_ARGB)
+    else if (format == RS_ImageFormat_ARGB)
     {
         mg_pixfmt_type_argb pf(src);
         pf.premultiply(); // we need to premultiply the alpha - the agg sampler will not work correctly around image edges otherwise
@@ -2691,7 +2691,7 @@
         else
             agg::render_scanlines_bin(cxt->ras, cxt->sl, cxt->ren_pre, sa, sg);
     }
-    else if(format == RS_ImageFormat_NATIVE)
+    else if (format == RS_ImageFormat_NATIVE)
     {
         // source image is already premultiplied, declare a pixel format that uses
         // the correct blender

Modified: trunk/MgDev/Common/Renderers/AGGW2DRewriter.cpp
===================================================================
--- trunk/MgDev/Common/Renderers/AGGW2DRewriter.cpp	2013-11-03 21:04:06 UTC (rev 7895)
+++ trunk/MgDev/Common/Renderers/AGGW2DRewriter.cpp	2013-11-03 21:48:24 UTC (rev 7896)
@@ -20,6 +20,9 @@
 #include "AGGImageIO.h"
 #include "AGGW2DRewriter.h"
 
+#include "agg_context.h"
+
+
 ////////////////////////////////////////////////////////////////////
 //------------------------------------------------------------------
 //
@@ -568,8 +571,13 @@
 
         lb.Close();
 
-        AGGRenderer::DrawScreenPolygon((agg_context*)rewriter->GetW2DTargetImage(), &lb, NULL, color.argb());
+        agg_context* c = (agg_context*)rewriter->GetW2DTargetImage();
 
+        // fix for MapGuide ticket 1987 - temporarily lower gamma to 0.3
+        c->ras.gamma(agg::gamma_power(0.3));
+        AGGRenderer::DrawScreenPolygon(c, &lb, NULL, color.argb());
+        c->ras.gamma(agg::gamma_power(1.0)); 
+
         LineBufferPool::FreeLineBuffer(rewriter->GetBufferPool(), spDstLB.release());
     }
 



More information about the mapguide-commits mailing list