diff options
-rw-r--r-- | include/vcl/mapmod.hxx | 2 | ||||
-rw-r--r-- | vcl/qa/cppunit/graphicfilter/data/svm/pass/ofz45583-1.svm | bin | 0 -> 2238 bytes | |||
-rw-r--r-- | vcl/source/gdi/TypeSerializer.cxx | 13 | ||||
-rw-r--r-- | vcl/source/gdi/gdimtf.cxx | 11 |
4 files changed, 21 insertions, 5 deletions
diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx index 9af61f8b7e69..9d14fe60ae79 100644 --- a/include/vcl/mapmod.hxx +++ b/include/vcl/mapmod.hxx @@ -83,6 +83,8 @@ inline std::basic_ostream<charT, traits> & operator <<( return rStream; } +bool TooLargeScaleForMapMode(const Fraction& rScale); + #endif // INCLUDED_VCL_MAPMOD_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/qa/cppunit/graphicfilter/data/svm/pass/ofz45583-1.svm b/vcl/qa/cppunit/graphicfilter/data/svm/pass/ofz45583-1.svm Binary files differnew file mode 100644 index 000000000000..d730a1bccf4f --- /dev/null +++ b/vcl/qa/cppunit/graphicfilter/data/svm/pass/ofz45583-1.svm diff --git a/vcl/source/gdi/TypeSerializer.cxx b/vcl/source/gdi/TypeSerializer.cxx index 829bc0503e1d..dfaf300c7801 100644 --- a/vcl/source/gdi/TypeSerializer.cxx +++ b/vcl/source/gdi/TypeSerializer.cxx @@ -425,10 +425,8 @@ void TypeSerializer::writeGraphic(const Graphic& rGraphic) } } -static bool UselessScaleForMapMode(const Fraction& rScale) +bool TooLargeScaleForMapMode(const Fraction& rScale) { - if (!rScale.IsValid()) - return true; // ImplLogicToPixel will multiply its values by this numerator * dpi and then double that // result before dividing constexpr sal_Int32 nTypicalDPI = 96; @@ -436,6 +434,15 @@ static bool UselessScaleForMapMode(const Fraction& rScale) return true; if (rScale.GetNumerator() < std::numeric_limits<sal_Int32>::min() / nTypicalDPI / 2) return true; + return false; +} + +static bool UselessScaleForMapMode(const Fraction& rScale) +{ + if (!rScale.IsValid()) + return true; + if (TooLargeScaleForMapMode(rScale)) + return true; if (static_cast<double>(rScale) < 0.0) return true; return false; diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index a747e55f5685..dd682420c1eb 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -478,8 +478,15 @@ void GDIMetaFile::Play(OutputDevice& rOut, const Point& rPos, Fraction aScaleX( aDestSize.Width(), aTmpPrefSize.Width() ); Fraction aScaleY( aDestSize.Height(), aTmpPrefSize.Height() ); - aScaleX *= aDrawMap.GetScaleX(); aDrawMap.SetScaleX( aScaleX ); - aScaleY *= aDrawMap.GetScaleY(); aDrawMap.SetScaleY( aScaleY ); + aScaleX *= aDrawMap.GetScaleX(); + if (TooLargeScaleForMapMode(aScaleX)) + aScaleX.ReduceInaccurate(10); + aScaleY *= aDrawMap.GetScaleY(); + if (TooLargeScaleForMapMode(aScaleY)) + aScaleY.ReduceInaccurate(10); + + aDrawMap.SetScaleX(aScaleX); + aDrawMap.SetScaleY(aScaleY); // #i47260# Convert logical output position to offset within // the metafile's mapmode. Therefore, disable pixel offset on |