summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Meeks <michael.meeks@suse.com>2013-03-25 21:34:51 +0000
committerMichael Meeks <michael.meeks@suse.com>2013-03-25 21:36:12 +0000
commitfd335d180b1d549e884b9692ba1a4e51a014dcd5 (patch)
tree16c62a3a5e3bc95edcc0220fd608637babf05322
parent432b6ab482d6fcef05514ab17e4bc762ee552139 (diff)
fdo#61789 - improve SvtGraphicStroke / metafile scaling
-rw-r--r--vcl/inc/vcl/graphictools.hxx2
-rw-r--r--vcl/source/gdi/graphictools.cxx15
-rw-r--r--vcl/source/gdi/metaact.cxx5
3 files changed, 18 insertions, 4 deletions
diff --git a/vcl/inc/vcl/graphictools.hxx b/vcl/inc/vcl/graphictools.hxx
index c8713fdc2f23..3600f1a364fc 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 496138926339..da1cbaced63a 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 b63ca2d17d3f..c9c5e086e170 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