cppcanvas/source/mtfrenderer/emfplus.cxx | 34 +++++++++++++++++++------------ 1 file changed, 21 insertions(+), 13 deletions(-)
New commits: commit 273bbd2930736087a6b768c939256ed5d9ddcabc Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Jan 1 17:07:56 2014 +0000 EMF+: mapping can rotate the width vector, so use resulting length. Otherwise (i.e. with non-vertical lines) the width will be incorrect, and can result in lines disappearing as the resulting X component can be tiny/approaching zero. Change-Id: Icf3b7c10c627594600b517b8ff445f8df87c56f8 (cherry picked from commit 83f2b3c590120a60b5e94fb1a15054ebe0745dbb) diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 7deb9e2..2855c5b 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -787,7 +787,7 @@ namespace cppcanvas SAL_INFO ("cppcanvas.emf", "TODO: pen with zero width - using minimal which might not be correct\n"); } #endif - rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX()); + rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getLength()); } void SetStrokeAttributes(rendering::StrokeAttributes& rStrokeAttributes) commit 82573fc1ea658a4d1f496aaad6f56320379582c8 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Wed Jan 1 17:36:54 2014 +0000 EMF+: actually use lineJoin attribute for polygons. Change-Id: I5b369703333332598353d9817f0253bbe5fc3601 (cherry picked from commit 9b1ceabd5f696500d4fe2acb89170bd987966a9b) diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index d8ecb7c..7deb9e2 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -618,6 +618,19 @@ namespace cppcanvas return rendering::PathCapType::BUTT; } + sal_Int8 lcl_convertLineJoinType(sal_uInt32 nEmfLineJoin) + { + switch (nEmfLineJoin) + { + case EmfPlusLineJoinTypeMiter: // fall-through + case EmfPlusLineJoinTypeMiterClipped: return rendering::PathJoinType::MITER; + case EmfPlusLineJoinTypeBevel: return rendering::PathJoinType::BEVEL; + case EmfPlusLineJoinTypeRound: return rendering::PathJoinType::ROUND; + } + assert(false); // Line Join type isn't in specification. + return 0; + } + struct EMFPCustomLineCap : public EMFPObject { sal_uInt32 type; @@ -639,14 +652,7 @@ namespace cppcanvas { aAttributes.StartCapType = lcl_convertStrokeCap(strokeStartCap); aAttributes.EndCapType = lcl_convertStrokeCap(strokeEndCap); - - switch (strokeJoin) - { - case EmfPlusLineJoinTypeMiter: // fall-through - case EmfPlusLineJoinTypeMiterClipped: aAttributes.JoinType = rendering::PathJoinType::MITER; break; - case EmfPlusLineJoinTypeBevel: aAttributes.JoinType = rendering::PathJoinType::BEVEL; break; - case EmfPlusLineJoinTypeRound: aAttributes.JoinType = rendering::PathJoinType::ROUND; break; - } + aAttributes.JoinType = lcl_convertLineJoinType(strokeJoin); aAttributes.MiterLimit = miterLimit; } @@ -784,8 +790,10 @@ namespace cppcanvas rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX()); } - void SetStrokeDashing(rendering::StrokeAttributes& rStrokeAttributes) + void SetStrokeAttributes(rendering::StrokeAttributes& rStrokeAttributes) { + rStrokeAttributes.JoinType = lcl_convertLineJoinType(lineJoin); + if (dashStyle != EmfPlusLineStyleSolid) { const float dash[] = {3, 3}; @@ -1390,7 +1398,7 @@ namespace cppcanvas // but eg. dashing has to be additionally set only on the // polygon rendering::StrokeAttributes aPolygonAttributes(aCommonAttributes); - pen->SetStrokeDashing(aPolygonAttributes); + pen->SetStrokeAttributes(aPolygonAttributes); basegfx::B2DPolyPolygon aFinalPolyPolygon; commit 4dfd688b14e72f4011839c3e9aaa0a47fe349bd0 Author: Andrzej Hunt <andrzej.h...@collabora.com> Date: Thu Dec 26 18:57:28 2013 +0000 EMF+: Integer coordinate values are signed. Change-Id: I5babcec50d48dc2a6288a01685db61fbb7058680 (cherry picked from commit d8dedc775cedf0e9daf9284bc7e3a0331ccd2963) diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index c6c719b..d8ecb7c 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -167,8 +167,8 @@ namespace cppcanvas { for (int i = 0; i < nPoints; i ++) { if (pathFlags & 0x4000) { - // points are stored in short 16bit integer format - sal_uInt16 x, y; + // points are stored in signed short 16bit integer format + sal_Int16 x, y; s >> x >> y; SAL_INFO ("cppcanvas.emf", "EMF+\tpoint [x,y]: " << x << "," << y); _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits