[Libreoffice-commits] core.git: drawinglayer/inc drawinglayer/source
Jan Holesovsky
kendy at suse.cz
Thu Mar 28 02:43:07 PDT 2013
drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx | 3
drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 31 ++++------
2 files changed, 18 insertions(+), 16 deletions(-)
New commits:
commit 51f50a0dee2867b0f9e3f869e5fbe14923fcef3a
Author: Jan Holesovsky <kendy at suse.cz>
Date: Thu Mar 28 10:41:57 2013 +0100
fdo#61789 Fix crash, pSvtGraphicStroke is allowed to be NULL.
Change-Id: Ia08e2e91354c9b4e543023c193b95e79d56e235b
diff --git a/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/inc/drawinglayer/processor2d/vclmetafileprocessor2d.hxx
index d174764..fa85105 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 9663384..83d52c0 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());
More information about the Libreoffice-commits
mailing list