Kaydet (Commit) 172acd5b authored tarafından Jan Holesovsky's avatar Jan Holesovsky

EMF+: Small cleanup & more logging in preparation for line starts & ends.

Change-Id: I584f8a1680c6aa7b51b948a00213c285387b77c3
üst 40977516
...@@ -280,7 +280,7 @@ static float GetSwapFloat( SvStream& rSt ) ...@@ -280,7 +280,7 @@ static float GetSwapFloat( SvStream& rSt )
/* EMF+ */ /* EMF+ */
void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas ); void processEMFPlus( MetaCommentAction* pAct, const ActionFactoryParameters& rFactoryParms, OutDevState& rState, const CanvasSharedPtr& rCanvas );
double setFont( sal_uInt8 objectId, const ActionFactoryParameters& rParms, OutDevState& rState ); 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); void EMFPPlusFillPolygon (::basegfx::B2DPolyPolygon& polygon, const ActionFactoryParameters& rParms, OutDevState& rState, const CanvasSharedPtr& rCanvas, bool isColor, sal_uInt32 brushIndexOrColor);
ActionVector maActions; ActionVector maActions;
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include <basegfx/vector/b2dsize.hxx> #include <basegfx/vector/b2dsize.hxx>
#include <basegfx/range/b2drange.hxx> #include <basegfx/range/b2drange.hxx>
#include <basegfx/range/b2drectangle.hxx> #include <basegfx/range/b2drectangle.hxx>
#include <basegfx/polygon/b2dlinegeometry.hxx>
#include <basegfx/polygon/b2dpolygon.hxx> #include <basegfx/polygon/b2dpolygon.hxx>
#include <basegfx/polygon/b2dpolygontools.hxx> #include <basegfx/polygon/b2dpolygontools.hxx>
#include <basegfx/polygon/b2dpolypolygon.hxx> #include <basegfx/polygon/b2dpolypolygon.hxx>
...@@ -625,7 +626,7 @@ namespace cppcanvas ...@@ -625,7 +626,7 @@ namespace cppcanvas
delete[] customEndCap; 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 OSL_DEBUG_LEVEL > 1
if (width == 0.0) { if (width == 0.0) {
...@@ -633,8 +634,10 @@ namespace cppcanvas ...@@ -633,8 +634,10 @@ namespace cppcanvas
} }
#endif #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)).getX());
}
// set dashing void SetStrokeDashing(rendering::StrokeAttributes& rStrokeAttributes)
{
if (dashStyle != EmfPlusLineStyleSolid) if (dashStyle != EmfPlusLineStyleSolid)
{ {
const float dash[] = {3, 3}; const float dash[] = {3, 3};
...@@ -678,12 +681,18 @@ namespace cppcanvas ...@@ -678,12 +681,18 @@ namespace cppcanvas
s >> transformation; s >> transformation;
if (penFlags & 2) if (penFlags & 2)
{
s >> startCap; s >> startCap;
SAL_INFO("cppcanvas.emf", "EMF+\t\tstartCap: 0x" << std::hex << startCap);
}
else else
startCap = 0; startCap = 0;
if (penFlags & 4) if (penFlags & 4)
{
s >> endCap; s >> endCap;
SAL_INFO("cppcanvas.emf", "EMF+\t\tendCap: 0x" << std::hex << endCap);
}
else else
endCap = 0; endCap = 0;
...@@ -749,24 +758,38 @@ namespace cppcanvas ...@@ -749,24 +758,38 @@ namespace cppcanvas
} else } else
compoundArrayLen = 0; compoundArrayLen = 0;
if (penFlags & 2048) { if (penFlags & 2048)
{
s >> customStartCapLen; s >> customStartCapLen;
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomStartCapLen: " << customStartCapLen);
if( customStartCapLen<0 ) if( customStartCapLen<0 )
customStartCapLen=0; customStartCapLen=0;
customStartCap = new sal_uInt8 [customStartCapLen]; customStartCap = new sal_uInt8 [customStartCapLen];
for (i = 0; i < customStartCapLen; i++) for (i = 0; i < customStartCapLen; i++)
{
s >> customStartCap [i]; s >> customStartCap [i];
} else SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomStartCap[" << i << "]: 0x" << std::hex << int(customStartCap[i]));
}
}
else
customStartCapLen = 0; customStartCapLen = 0;
if (penFlags & 4096) { if (penFlags & 4096)
{
s >> customEndCapLen; s >> customEndCapLen;
SAL_INFO("cppcanvas.emf", "EMF+\t\tcustomEndCapLen: " << customEndCapLen);
if( customEndCapLen<0 ) if( customEndCapLen<0 )
customEndCapLen=0; customEndCapLen=0;
customEndCap = new sal_uInt8 [customEndCapLen]; customEndCap = new sal_uInt8 [customEndCapLen];
for (i = 0; i < customEndCapLen; i++) for (i = 0; i < customEndCapLen; i++)
{
s >> customEndCap [i]; s >> customEndCap [i];
} else SAL_INFO("cppcanvas.emf", "EMF+\t\t\tcustomEndCap[" << i << "]: 0x" << std::hex << int(customEndCap[i]));
}
}
else
customEndCapLen = 0; customEndCapLen = 0;
EMFPBrush::Read (s, rR); EMFPBrush::Read (s, rR);
...@@ -1151,7 +1174,7 @@ namespace cppcanvas ...@@ -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) OutDevState& rState, const CanvasSharedPtr& rCanvas, sal_uInt32 penIndex)
{ {
EMFPPen* pen = (EMFPPen*) aObjects [penIndex & 0xff]; EMFPPen* pen = (EMFPPen*) aObjects [penIndex & 0xff];
...@@ -1165,22 +1188,24 @@ namespace cppcanvas ...@@ -1165,22 +1188,24 @@ namespace cppcanvas
rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (), rState.lineColor = ::vcl::unotools::colorToDoubleSequence (pen->GetColor (),
rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace()); rCanvas->getUNOCanvas ()->getDevice()->getDeviceColorSpace());
polygon.transform( rState.mapModeTransform ); basegfx::B2DPolyPolygon aPolyPolygon(polygon);
rendering::StrokeAttributes aStrokeAttributes; 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( // but eg. dashing has to be additionally set only on the
internal::PolyPolyActionFactory::createPolyPolyAction( // polygon
polygon, rParms.mrCanvas, rState, aStrokeAttributes ) ); rendering::StrokeAttributes aPolygonAttributes(aCommonAttributes);
pen->SetStrokeDashing(aPolygonAttributes);
// render the polygon
ActionSharedPtr pPolyAction(internal::PolyPolyActionFactory::createPolyPolyAction(aPolyPolygon, rParms.mrCanvas, rState, aPolygonAttributes));
if( pPolyAction ) if( pPolyAction )
{ {
maActions.push_back( maActions.push_back(MtfAction(pPolyAction, rParms.mrCurrActionIndex));
MtfAction(
pPolyAction,
rParms.mrCurrActionIndex ) );
rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1; rParms.mrCurrActionIndex += pPolyAction->getActionCount()-1;
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment