summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-03-30 10:25:51 +0100
committerCaolán McNamara <caolanm@redhat.com>2022-03-30 16:34:36 +0200
commit910251c05059d0c31d9556f6c8e8dbffc8998f89 (patch)
treed3b091fbd9abbc722e452195bf76eb81cde37f14 /vcl
parent0b9892fee990b7f6d0457ab6191f87c3991580e6 (diff)
use the device dpi
Change-Id: I8762e84a34a116778bd0bced706d631db4761a01 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132302 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/TypeSerializer.cxx9
-rw-r--r--vcl/source/gdi/gdimtf.cxx7
2 files changed, 8 insertions, 8 deletions
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;