summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@suse.cz>2013-03-28 10:41:57 +0100
committerMichael Meeks <michael.meeks@suse.com>2013-03-28 09:53:51 +0000
commit277ee3f0d1135158237698b88705d0cb1ec57c46 (patch)
tree86662e3408e2f81023adab95ec0c55ec3d09832d
parent1145265b3f4bac37939726b1f4bf430eb5ec2c54 (diff)
fdo#61789 Fix crash, pSvtGraphicStroke is allowed to be NULL.
Change-Id: Ia08e2e91354c9b4e543023c193b95e79d56e235b Signed-off-by: Michael Meeks <michael.meeks@suse.com>
-rw-r--r--drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx3
-rw-r--r--drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx31
2 files changed, 18 insertions, 16 deletions
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
index d17476452f04..fa85105939c8 100644
--- a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
+++ b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
@@ -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;
diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
index 9663384aa608..83d52c01dd18 100644
--- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx
@@ -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());