Kaydet (Commit) 277ee3f0 authored tarafından Jan Holesovsky's avatar Jan Holesovsky Kaydeden (comit) Michael Meeks

fdo#61789 Fix crash, pSvtGraphicStroke is allowed to be NULL.

Change-Id: Ia08e2e91354c9b4e543023c193b95e79d56e235b
Signed-off-by: 's avatarMichael Meeks <michael.meeks@suse.com>
üst 1145265b
......@@ -92,6 +92,9 @@ namespace drawinglayer
void impStartSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
void impEndSvtGraphicStroke(SvtGraphicStroke* pSvtGraphicStroke);
/// Convert the fWidth to the same space as its coordinates.
double getTransformedLineWidth( double fWidth ) const;
/// the current clipping PolyPolygon from MaskPrimitive2D
basegfx::B2DPolyPolygon maClipPolyPolygon;
......
......@@ -378,6 +378,18 @@ namespace drawinglayer
}
}
double VclMetafileProcessor2D::getTransformedLineWidth( double fWidth ) const
{
// #i113922# the LineWidth is duplicated in the MetaPolylineAction,
// and also inside the SvtGraphicStroke and needs transforming into
// the same space as its co-ordinates here cf. fdo#61789
// This is a partial fix. When a object transformation is used which
// e.g. contains a scaleX != scaleY, an unproportional scaling will happen.
const basegfx::B2DVector aDiscreteUnit( maCurrentTransformation * basegfx::B2DVector( fWidth, 0.0 ) );
return aDiscreteUnit.getLength();
}
SvtGraphicStroke* VclMetafileProcessor2D::impTryToCreateSvtGraphicStroke(
const basegfx::B2DPolygon& rB2DPolygon,
const basegfx::BColor* pColor,
......@@ -441,20 +453,7 @@ namespace drawinglayer
if(pLineAttribute)
{
// pre-fill fLineWidth
fLineWidth = pLineAttribute->getWidth();
// #i113922# the LineWidth is duplicated in the MetaPolylineAction,
// and also inside the SvtGraphicStroke and needs transforming into
// the same space as its co-ordinates here cf. fdo#61789
// This is a partial fix. When a object transformation is used which
// e.g. contains a scaleX != scaleY, an unproportional scaling will happen.
const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation *
basegfx::B2DVector(pLineAttribute->getWidth(), 0.0 ));
fLineWidth = aDiscreteUnit.getLength();
// pre-fill fMiterLength
fMiterLength = fLineWidth;
fLineWidth = fMiterLength = getTransformedLineWidth( pLineAttribute->getWidth() );
// get Join
switch(pLineAttribute->getLineJoin())
......@@ -1242,8 +1241,8 @@ namespace drawinglayer
mpOutputDevice->SetFillColor();
aHairLinePolyPolygon.transform(maCurrentTransformation);
// use the transformed line width from the stroke info.
LineInfo aLineInfo(LINE_SOLID, basegfx::fround(pSvtGraphicStroke->getStrokeWidth()));
// use the transformed line width
LineInfo aLineInfo(LINE_SOLID, getTransformedLineWidth(rLine.getWidth()));
aLineInfo.SetLineJoin(rLine.getLineJoin());
aLineInfo.SetLineCap(rLine.getLineCap());
......
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