include/vcl/mapmod.hxx            |    2 +-
 vcl/source/gdi/TypeSerializer.cxx |    9 ++++-----
 vcl/source/gdi/gdimtf.cxx         |    7 ++++---
 3 files changed, 9 insertions(+), 9 deletions(-)

New commits:
commit 910251c05059d0c31d9556f6c8e8dbffc8998f89
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Wed Mar 30 10:25:51 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Wed Mar 30 16:34:36 2022 +0200

    use the device dpi
    
    Change-Id: I8762e84a34a116778bd0bced706d631db4761a01
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132302
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/include/vcl/mapmod.hxx b/include/vcl/mapmod.hxx
index 9d14fe60ae79..591db8d8c1c0 100644
--- a/include/vcl/mapmod.hxx
+++ b/include/vcl/mapmod.hxx
@@ -83,7 +83,7 @@ inline std::basic_ostream<charT, traits> & operator <<(
     return rStream;
 }
 
-bool TooLargeScaleForMapMode(const Fraction& rScale);
+bool TooLargeScaleForMapMode(const Fraction& rScale, int nDPI);
 
 #endif // INCLUDED_VCL_MAPMOD_HXX
 
diff --git a/vcl/source/gdi/TypeSerializer.cxx 
b/vcl/source/gdi/TypeSerializer.cxx
index dfaf300c7801..cad183128570 100644
--- a/vcl/source/gdi/TypeSerializer.cxx
+++ b/vcl/source/gdi/TypeSerializer.cxx
@@ -425,14 +425,13 @@ void TypeSerializer::writeGraphic(const Graphic& rGraphic)
     }
 }
 
-bool TooLargeScaleForMapMode(const Fraction& rScale)
+bool TooLargeScaleForMapMode(const Fraction& rScale, int nDPI)
 {
     // ImplLogicToPixel will multiply its values by this numerator * dpi and 
then double that
     // result before dividing
-    constexpr sal_Int32 nTypicalDPI = 96;
-    if (rScale.GetNumerator() > std::numeric_limits<sal_Int32>::max() / 
nTypicalDPI / 2)
+    if (rScale.GetNumerator() > std::numeric_limits<sal_Int32>::max() / nDPI / 
2)
         return true;
-    if (rScale.GetNumerator() < std::numeric_limits<sal_Int32>::min() / 
nTypicalDPI / 2)
+    if (rScale.GetNumerator() < std::numeric_limits<sal_Int32>::min() / nDPI / 
2)
         return true;
     return false;
 }
@@ -441,7 +440,7 @@ static bool UselessScaleForMapMode(const Fraction& rScale)
 {
     if (!rScale.IsValid())
         return true;
-    if (TooLargeScaleForMapMode(rScale))
+    if (TooLargeScaleForMapMode(rScale, 96))
         return true;
     if (static_cast<double>(rScale) < 0.0)
         return true;
diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx
index 3fa9ea3d24e3..68c48bf6e01f 100644
--- a/vcl/source/gdi/gdimtf.cxx
+++ b/vcl/source/gdi/gdimtf.cxx
@@ -486,11 +486,12 @@ void GDIMetaFile::Play(OutputDevice& rOut, const Point& 
rPos,
     aScaleY *= aDrawMap.GetScaleY();
     // try reducing inaccurary first and abandon if the scaling
     // still cannot be achieved
-    if (TooLargeScaleForMapMode(aScaleX))
+    if (TooLargeScaleForMapMode(aScaleX, rOut.GetDPIX()))
         aScaleX.ReduceInaccurate(10);
-    if (TooLargeScaleForMapMode(aScaleY))
+    if (TooLargeScaleForMapMode(aScaleY, rOut.GetDPIY()))
         aScaleY.ReduceInaccurate(10);
-    if (TooLargeScaleForMapMode(aScaleX) || TooLargeScaleForMapMode(aScaleY))
+    if (TooLargeScaleForMapMode(aScaleX, rOut.GetDPIX()) ||
+        TooLargeScaleForMapMode(aScaleY, rOut.GetDPIY()))
     {
         SAL_WARN("vcl", "GDIMetaFile Scaling is too high");
         return;

Reply via email to