summaryrefslogtreecommitdiff
path: root/drawinglayer/source
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-07-28 16:08:13 +0100
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-07-28 18:37:02 +0200
commit046a3f5d879d489affdb3ae98329020db209dc6a (patch)
tree5743448f0c7f85962e8293c30a5942051ccc158a /drawinglayer/source
parent329e913b0b82875a9f2f427cf1fae9e7f90b021a (diff)
crashtesting: fix ImplCalcMapResolution assert
seen on converting moz1297206-1.svg to odg Change-Id: I56c424eb76f55a52522d519a0faa6df30b017c82 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/171142 Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'drawinglayer/source')
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx20
1 files changed, 14 insertions, 6 deletions
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index b783bdc69723..a99032e7683e 100644
--- a/drawinglayer/source/processor2d/vclprocessor2d.cxx
+++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx
@@ -434,14 +434,22 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D(
MapMode aMapMode = mpOutputDevice->GetMapMode();
aMapMode.SetScaleX(aMapMode.GetScaleX() * nFontScalingFixX);
aMapMode.SetScaleY(aMapMode.GetScaleY() * nFontScalingFixY);
- Point origin = aMapMode.GetOrigin();
- mpOutputDevice->Push(vcl::PushFlags::MAPMODE);
- mpOutputDevice->SetRelativeMapMode(aMapMode);
- bChangeMapMode = true;
+ const bool bValidScaling
+ = aMapMode.GetScaleX().IsValid() && aMapMode.GetScaleY().IsValid();
+ if (!bValidScaling)
+ SAL_WARN("drawinglayer", "skipping invalid scaling");
+ else
+ {
+ Point origin = aMapMode.GetOrigin();
+
+ mpOutputDevice->Push(vcl::PushFlags::MAPMODE);
+ mpOutputDevice->SetRelativeMapMode(aMapMode);
+ bChangeMapMode = true;
- aPointX = (aPointX + origin.X()) / nFontScalingFixX - origin.X();
- aPointY = (aPointY + origin.Y()) / nFontScalingFixY - origin.Y();
+ aPointX = (aPointX + origin.X()) / nFontScalingFixX - origin.X();
+ aPointY = (aPointY + origin.Y()) / nFontScalingFixY - origin.Y();
+ }
}
}