diff options
author | Jan Holesovsky <kendy@collabora.com> | 2013-11-22 17:06:10 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2013-11-26 11:13:03 +0100 |
commit | 1ff6cb553ba67ba5167506a2498d20525b58a087 (patch) | |
tree | 434902b6b2675a6d99b8be4af1cd2396b7ce8c14 /cppcanvas | |
parent | 007f427dd2565eb108ed2292c1fe1af8051f2abb (diff) |
EMF+: Small cleanup & more logging in preparation for line starts & ends.
Change-Id: I584f8a1680c6aa7b51b948a00213c285387b77c3
Diffstat (limited to 'cppcanvas')
-rw-r--r-- | cppcanvas/source/inc/implrenderer.hxx | 2 | ||||
-rw-r--r-- | cppcanvas/source/mtfrenderer/emfplus.cxx | 61 |
2 files changed, 44 insertions, 19 deletions
diff --git a/cppcanvas/source/inc/implrenderer.hxx b/cppcanvas/source/inc/implrenderer.hxx index c70bf548dbd5..02fc0032c575 100644 --- a/cppcanvas/source/inc/implrenderer.hxx +++ b/cppcanvas/source/inc/implrenderer.hxx @@ -280,7 +280,7 @@ static float GetSwapFloat( SvStream& rSt ) /* EMF+ */ void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas ); double setFont( sal_uInt8 objectId, const ActionFactoryParameters& rParms, OutDevState& rState ); - void EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex); + void EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex); void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor); ActionVector maActions; diff --git a/cppcanvas/source/mtfrenderer/emfplus.cxx b/cppcanvas/source/mtfrenderer/emfplus.cxx index 9dc50d7fae7b..ec5e739b68e7 100644 --- a/cppcanvas/source/mtfrenderer/emfplus.cxx +++ b/cppcanvas/source/mtfrenderer/emfplus.cxx @@ -28,6 +28,7 @@ #include <basegfx/vector/b2dsize.hxx> #include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drectangle.hxx> +#include <basegfx/polygon/b2dlinegeometry.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx> @@ -625,7 +626,7 @@ namespace cppcanvas delete[] customEndCap; } - void SetStrokeAttributes (rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) + void SetStrokeWidth(rendering::StrokeAttributes& rStrokeAttributes, ImplRenderer& rR, const OutDevState& rState) { #if OSL_DEBUG_LEVEL > 1 if (width == 0.0) { @@ -633,8 +634,10 @@ namespace cppcanvas } #endif rStrokeAttributes.StrokeWidth = fabs((rState.mapModeTransform * rR.MapSize (width == 0.0 ? 0.05 : width, 0)).getX()); + } - // set dashing + void SetStrokeDashing(rendering::StrokeAttributes& rStrokeAttributes) + { if (dashStyle != EmfPlusLineStyleSolid) { const float dash[] = {3, 3}; @@ -678,12 +681,18 @@ namespace cppcanvas s >> transformation; if (penFlags & 2) + { s >> startCap; + SAL_INFO("cppcanvas.emf", "EMF+\t\tstartCap: 0x" << std::hex << startCap); + } else startCap = 0; if (penFlags & 4) + { s >> endCap; + SAL_INFO("cppcanvas.emf", "EMF+\t\tendCap: 0x" << std::hex << endCap); + } else endCap = 0; @@ -749,24 +758,38 @@ namespace cppcanvas } else compoundArrayLen = 0; - if (penFlags & 2048) { + if (penFlags & 2048) + { s >> customStartCapLen; + SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomStartCapLen: " << customStartCapLen); + if( customStartCapLen<0 ) customStartCapLen=0; customStartCap = new sal_uInt8 [customStartCapLen]; for (i = 0; i < customStartCapLen; i++) + { s >> customStartCap [i]; - } else + SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomStartCap[" << i << "]: 0x" << std::hex << int(customStartCap[i])); + } + } + else customStartCapLen = 0; - if (penFlags & 4096) { + if (penFlags & 4096) + { s >> customEndCapLen; + SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomEndCapLen: " << customEndCapLen); + if( customEndCapLen<0 ) customEndCapLen=0; customEndCap = new sal_uInt8 [customEndCapLen]; for (i = 0; i < customEndCapLen; i++) + { s >> customEndCap [i]; - } else + SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomEndCap[" << i << "]: 0x" << std::hex << int(customEndCap[i])); + } + } + else customEndCapLen = 0; EMFPBrush::Read (s, rR); @@ -1151,7 +1174,7 @@ namespace cppcanvas } } - void ImplRenderer::EMFPPlusDrawPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, + void ImplRenderer::EMFPPlusDrawPolygon (const ::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex) { EMFPPen* pen = (EMFPPen*) aObjects [penIndex & 0xff]; @@ -1165,22 +1188,24 @@ namespace cppcanvas rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (), rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace()); - polygon.transform( rState.mapModeTransform ); - rendering::StrokeAttributes aStrokeAttributes; + basegfx::B2DPolyPolygon aPolyPolygon(polygon); + aPolyPolygon.transform(rState.mapModeTransform); + rendering::StrokeAttributes aCommonAttributes; - pen->SetStrokeAttributes (aStrokeAttributes, *this, rState); + // some attributes are common for the polygon, and the line + // starts & ends - like the stroke width + pen->SetStrokeWidth(aCommonAttributes, *this, rState); - ActionSharedPtr pPolyAction( - internal::PolyPolyActionFactory::createPolyPolyAction( - polygon, rParms.mrCanvas, rState, aStrokeAttributes ) ); + // but eg. dashing has to be additionally set only on the + // polygon + rendering::StrokeAttributes aPolygonAttributes(aCommonAttributes); + pen->SetStrokeDashing(aPolygonAttributes); + // render the polygon + ActionSharedPtr pPolyAction(internal::PolyPolyActionFactory::createPolyPolyAction(aPolyPolygon, rParms.mrCanvas, rState, aPolygonAttributes)); if( pPolyAction ) { - maActions.push_back( - MtfAction( - pPolyAction, - rParms.mrCurrActionIndex ) ); - + maActions.push_back(MtfAction(pPolyAction, rParms.mrCurrActionIndex)); rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; } } |