drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx | 16 ++++++++----- drawinglayer/source/processor2d/vclprocessor2d.cxx | 2 - vcl/inc/vcl/graphictools.hxx | 2 + vcl/source/gdi/graphictools.cxx | 15 ++++++++++++ vcl/source/gdi/metaact.cxx | 5 ---- 5 files changed, 30 insertions(+), 10 deletions(-)
New commits: commit fd335d180b1d549e884b9692ba1a4e51a014dcd5 Author: Michael Meeks <michael.me...@suse.com> Date: Mon Mar 25 21:34:51 2013 +0000 fdo#61789 - improve SvtGraphicStroke / metafile scaling diff --git a/vcl/inc/vcl/graphictools.hxx b/vcl/inc/vcl/graphictools.hxx index c8713fd..3600f1a 100644 --- a/vcl/inc/vcl/graphictools.hxx +++ b/vcl/inc/vcl/graphictools.hxx @@ -142,6 +142,8 @@ public: // mutators /// Set path to stroke void setPath ( const Polygon& ); + /// Affine scaling in both X and Y dimensions + void scale ( double fScaleX, double fScaleY ); private: // friends diff --git a/vcl/source/gdi/graphictools.cxx b/vcl/source/gdi/graphictools.cxx index 4961389..da1cbac 100644 --- a/vcl/source/gdi/graphictools.cxx +++ b/vcl/source/gdi/graphictools.cxx @@ -115,6 +115,21 @@ void SvtGraphicStroke::setPath( const Polygon& rPoly ) maPath = rPoly; } +void SvtGraphicStroke::scale( double fXScale, double fYScale ) +{ + // Clearly scaling stroke-width for fat lines is rather a problem + maPath.Scale( fXScale, fYScale ); + + double fScale = sqrt (fabs (fXScale * fYScale) ); // clearly not ideal. + fprintf( stderr, " HIT A SCALING ! by %g %g %g\n", + (double) fXScale, (double) fYScale, (double) fScale ); + mfStrokeWidth *= fScale; + mfMiterLimit *= fScale; + + maStartArrow.Scale( fXScale, fYScale ); + maEndArrow.Scale( fXScale, fYScale ); +} + SvStream& operator<<( SvStream& rOStm, const SvtGraphicStroke& rClass ) { VersionCompat aCompat( rOStm, STREAM_WRITE, 1 ); diff --git a/vcl/source/gdi/metaact.cxx b/vcl/source/gdi/metaact.cxx index b63ca2d..c9c5e08 100644 --- a/vcl/source/gdi/metaact.cxx +++ b/vcl/source/gdi/metaact.cxx @@ -4066,10 +4066,7 @@ void MetaCommentAction::Scale( double fXScale, double fYScale ) { SvtGraphicStroke aStroke; aMemStm >> aStroke; - Polygon aPath; - aStroke.getPath( aPath ); - aPath.Scale( fXScale, fYScale ); - aStroke.setPath( aPath ); + aStroke.scale( fXScale, fYScale ); aDest << aStroke; } else commit 432b6ab482d6fcef05514ab17e4bc762ee552139 Author: Michael Meeks <michael.me...@suse.com> Date: Mon Mar 25 21:33:00 2013 +0000 fdo#61789 - move metafile line width scaling somewhere more sensible. diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index f9d583d..9663384 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -444,6 +444,15 @@ namespace drawinglayer // 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; @@ -1233,11 +1242,8 @@ namespace drawinglayer mpOutputDevice->SetFillColor(); aHairLinePolyPolygon.transform(maCurrentTransformation); - // #i113922# LineWidth needs to be transformed, too - const basegfx::B2DVector aDiscreteUnit(maCurrentTransformation * basegfx::B2DVector(rLine.getWidth(), 0.0)); - const double fDiscreteLineWidth(aDiscreteUnit.getLength()); - - LineInfo aLineInfo(LINE_SOLID, basegfx::fround(fDiscreteLineWidth)); + // use the transformed line width from the stroke info. + LineInfo aLineInfo(LINE_SOLID, basegfx::fround(pSvtGraphicStroke->getStrokeWidth())); aLineInfo.SetLineJoin(rLine.getLineJoin()); aLineInfo.SetLineCap(rLine.getLineCap()); diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index 8423069..92d843c 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -1350,7 +1350,7 @@ namespace drawinglayer { // #i101491# If the polygon complexity uses more than a given amount, do // use OuputDevice::DrawPolyLine directly; this will avoid buffering all - // decompositions in primtives (memory) and fallback to old line painting + // decompositions in primitives (memory) and fallback to old line painting // for very complex polygons, too for(sal_uInt32 a(0); a < nCount; a++) { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits