drawinglayer/source/processor2d/vclprocessor2d.cxx | 36 +++++++++++---------- 1 file changed, 20 insertions(+), 16 deletions(-)
New commits: commit 724250d63dcf4e0de1f9ec24abc001d9e1824e00 Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Sun May 26 10:21:59 2024 +0500 Commit: Miklos Vajna <vmik...@collabora.com> CommitDate: Mon May 27 11:57:59 2024 +0200 tdf#161222: LOK: do not fine-tune text scaling for tile rendering For unclear reason, this shifts text on all tiles except the top left one. I wasn't able to track where the coordinate is changed: it seems that the pixel offset of the virtual device, its MapMode's origin, as well as the start point passed to the DrawTextArray method, are all only changed by a tiny amount, if at all, so it should be no more than a pixel off compared to before commit cc3663bbaed4f65d64154e5f9abb51a5f622f710 (tdf#160702: improve text positioning, 2024-04-20). However, it is already more than half the tile size (more than 128 pixel) offset in 75% scale case for the second tile; and it's completely off the tile for all the rest (third+ in a row), and for greater scales (100%+) even for second tile. Change-Id: I64dc24bea4bab0cac90f11f2500bba0fd9bc7855 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168041 Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com> Tested-by: Jenkins (cherry picked from commit c9571914b8170128a68496ec2dd299e21243d1c1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168055 Reviewed-by: Miklos Vajna <vmik...@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoff...@gmail.com> diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index a1c23c91dbc9..0b6314e95928 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -411,25 +411,29 @@ void VclProcessor2D::RenderTextSimpleOrDecoratedPortionPrimitive2D( const basegfx::B2DPoint aPoint(aLocalTransform * basegfx::B2DPoint(0.0, 0.0)); double aPointX = aPoint.getX(), aPointY = aPoint.getY(); - // aFont has an integer size; we must scale a bit for precision - double nFontScalingFixY = aFontScaling.getY() / aResultFontSize.Height(); - double nFontScalingFixX = aFontScaling.getX() - / (aResultFontSize.Width() ? aResultFontSize.Width() - : aResultFontSize.Height()); - - if (!rtl_math_approxEqual(nFontScalingFixY, 1.0) - || !rtl_math_approxEqual(nFontScalingFixX, 1.0)) + if (!comphelper::LibreOfficeKit::isActive()) { - MapMode aMapMode = mpOutputDevice->GetMapMode(); - aMapMode.SetScaleX(aMapMode.GetScaleX() * nFontScalingFixX); - aMapMode.SetScaleY(aMapMode.GetScaleY() * nFontScalingFixY); + // aFont has an integer size; we must scale a bit for precision + double nFontScalingFixY = aFontScaling.getY() / aResultFontSize.Height(); + double nFontScalingFixX + = aFontScaling.getX() + / (aResultFontSize.Width() ? aResultFontSize.Width() + : aResultFontSize.Height()); + + if (!rtl_math_approxEqual(nFontScalingFixY, 1.0) + || !rtl_math_approxEqual(nFontScalingFixX, 1.0)) + { + MapMode aMapMode = mpOutputDevice->GetMapMode(); + aMapMode.SetScaleX(aMapMode.GetScaleX() * nFontScalingFixX); + aMapMode.SetScaleY(aMapMode.GetScaleY() * nFontScalingFixY); - mpOutputDevice->Push(vcl::PushFlags::MAPMODE); - mpOutputDevice->SetRelativeMapMode(aMapMode); - bChangeMapMode = true; + mpOutputDevice->Push(vcl::PushFlags::MAPMODE); + mpOutputDevice->SetRelativeMapMode(aMapMode); + bChangeMapMode = true; - aPointX /= nFontScalingFixX; - aPointY /= nFontScalingFixY; + aPointX /= nFontScalingFixX; + aPointY /= nFontScalingFixY; + } } aStartPoint = Point(basegfx::fround(aPointX), basegfx::fround(aPointY));