diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-07-28 16:08:13 +0100 |
---|---|---|
committer | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-07-28 18:37:02 +0200 |
commit | 046a3f5d879d489affdb3ae98329020db209dc6a (patch) | |
tree | 5743448f0c7f85962e8293c30a5942051ccc158a /drawinglayer/source | |
parent | 329e913b0b82875a9f2f427cf1fae9e7f90b021a (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.cxx | 20 |
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(); + } } } |