EMF+: Fill line cap object if EmfPlusCustomLineCapDataFillPath is set.

Change-Id: I7b53a8f18e1fb24b1ae0322bdf0980e431a0725f
This commit is contained in:
Matúš Kukan 2013-12-06 14:40:50 +01:00
parent a53dafbc96
commit 131f3230d9
2 changed files with 21 additions and 4 deletions

View file

@ -284,7 +284,7 @@ static float GetSwapFloat( SvStream& rSt )
/// Render LineCap, like the start or end arrow of a polygon.
/// @return how much we should shorten the original polygon.
double EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon& rPolygon, double fPolyLength,
const ::basegfx::B2DPolyPolygon& rLineCap, bool bStart,
const ::basegfx::B2DPolyPolygon& rLineCap, bool isFilled, bool bStart,
const com::sun::star::rendering::StrokeAttributes& rAttributes,
const ActionFactoryParameters& rParms, OutDevState& rState);

View file

@ -624,6 +624,7 @@ namespace cppcanvas
sal_uInt32 strokeStartCap, strokeEndCap, strokeJoin;
float miterLimit;
basegfx::B2DPolyPolygon polygon;
bool mbIsFilled;
public:
EMFPCustomLineCap() : EMFPObject()
@ -650,7 +651,7 @@ namespace cppcanvas
aAttributes.MiterLimit = miterLimit;
}
void ReadPath(SvStream& s, ImplRenderer& rR, bool bClosed)
void ReadPath(SvStream& s, ImplRenderer& rR, bool bFill)
{
sal_Int32 pathLength;
s >> pathLength;
@ -667,7 +668,7 @@ namespace cppcanvas
path.Read(s, pathFlags, rR);
polygon = path.GetPolygon(rR, false);
polygon.setClosed(bClosed);
mbIsFilled = bFill;
// transformation to convert the path to what LibreOffice
// expects
@ -1318,7 +1319,7 @@ namespace cppcanvas
}
double ImplRenderer::EMFPPlusDrawLineCap(const ::basegfx::B2DPolygon& rPolygon, double fPolyLength,
const ::basegfx::B2DPolyPolygon& rLineCap, bool bStart, const rendering::StrokeAttributes& rAttributes,
const ::basegfx::B2DPolyPolygon& rLineCap, bool bIsFilled, bool bStart, const rendering::StrokeAttributes& rAttributes,
const ActionFactoryParameters& rParms, OutDevState& rState)
{
if (!rLineCap.count())
@ -1347,6 +1348,20 @@ namespace cppcanvas
rParms.mrCurrActionIndex += pAction->getActionCount()-1;
}
if (bIsFilled)
{
bool bWasFillColorSet = rState.isFillColorSet;
rState.isFillColorSet = true;
rState.fillColor = rState.lineColor;
ActionSharedPtr pAction2(internal::PolyPolyActionFactory::createPolyPolyAction(aArrow, rParms.mrCanvas, rState));
if (pAction2)
{
maActions.push_back(MtfAction(pAction2, rParms.mrCurrActionIndex));
rParms.mrCurrActionIndex += pAction2->getActionCount()-1;
}
rState.isFillColorSet = bWasFillColorSet;
}
return rAttributes.StrokeWidth;
}
@ -1401,6 +1416,7 @@ namespace cppcanvas
pen->customStartCap->SetAttributes(aAttributes);
fStart = EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customStartCap->polygon,
pen->customStartCap->mbIsFilled,
true, aAttributes, rParms, rState);
}
@ -1411,6 +1427,7 @@ namespace cppcanvas
pen->customEndCap->SetAttributes(aAttributes);
fEnd = EMFPPlusDrawLineCap(aPolygon, fPolyLength, pen->customEndCap->polygon,
pen->customEndCap->mbIsFilled,
false, aAttributes, rParms, rState);
}