[mapguide-commits] r7897 - branches/2.5/MgDev/Common/Renderers
svn_mapguide at osgeo.org
svn_mapguide at osgeo.org
Mon Nov 4 02:32:14 PST 2013
Author: jng
Date: 2013-11-04 02:32:13 -0800 (Mon, 04 Nov 2013)
New Revision: 7897
Modified:
branches/2.5/MgDev/Common/Renderers/AGGRenderer.cpp
branches/2.5/MgDev/Common/Renderers/AGGW2DRewriter.cpp
Log:
#2285, #1987: Merge fixes to 2.5 branch
Modified: branches/2.5/MgDev/Common/Renderers/AGGRenderer.cpp
===================================================================
--- branches/2.5/MgDev/Common/Renderers/AGGRenderer.cpp 2013-11-03 21:48:24 UTC (rev 7896)
+++ branches/2.5/MgDev/Common/Renderers/AGGRenderer.cpp 2013-11-04 10:32:13 UTC (rev 7897)
@@ -2012,8 +2012,8 @@
xform->transform(tx, ty, tx, ty);
// detect a close segment (in a Linebuffer this is caused by first and
- // last point of the contour being equal
- if (tx == sx && ty == sy)
+ // last point of the contour being equal and size of contour > 2 points)
+ if (tx == sx && ty == sy && ptlast > 1)
c->ps.close_polygon();
else if (ptlast == 1)
{
@@ -2030,11 +2030,21 @@
if (len2 < 100.0*LINE_SEGMENT_DOT_SIZE*LINE_SEGMENT_DOT_SIZE)
{
// found a dot - draw it as a 1-pixel long line
- double len = sqrt(len2);
- dx /= len;
- dy /= len;
- c->ps.move_to(tx-0.5*dx, ty-0.5*dy);
- c->ps.line_to(tx+0.5*dx, ty+0.5*dy);
+ if (len2 > 0.0)
+ {
+ double len = sqrt(len2);
+ dx /= len;
+ dy /= len;
+ c->ps.move_to(tx-0.5*dx, ty-0.5*dy);
+ c->ps.line_to(tx+0.5*dx, ty+0.5*dy);
+ }
+ else
+ {
+ // length of line can be 0 when DOTS_HATCH is rendered from DWF
+ // so use LINE_SEGMENT_DOT_SIZE to render that dots
+ c->ps.move_to(tx-LINE_SEGMENT_DOT_SIZE, ty-LINE_SEGMENT_DOT_SIZE);
+ c->ps.line_to(tx+LINE_SEGMENT_DOT_SIZE, ty+LINE_SEGMENT_DOT_SIZE);
+ }
}
else
{
@@ -2305,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);
@@ -2659,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
@@ -2681,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: branches/2.5/MgDev/Common/Renderers/AGGW2DRewriter.cpp
===================================================================
--- branches/2.5/MgDev/Common/Renderers/AGGW2DRewriter.cpp 2013-11-03 21:48:24 UTC (rev 7896)
+++ branches/2.5/MgDev/Common/Renderers/AGGW2DRewriter.cpp 2013-11-04 10:32:13 UTC (rev 7897)
@@ -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