diff options
author | Mike Kaganski <mike.kaganski@collabora.com> | 2024-05-26 10:21:59 +0500 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2024-05-26 09:56:54 +0200 |
commit | c9571914b8170128a68496ec2dd299e21243d1c1 (patch) | |
tree | 507bc75f4f54285e289d1b27783f2c4b33f8ca2f /drawinglayer | |
parent | 0735a4306da86c6fa0390b85f1f391ec404b2699 (diff) |
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.kaganski@collabora.com>
Tested-by: Jenkins
Diffstat (limited to 'drawinglayer')
-rw-r--r-- | drawinglayer/source/processor2d/vclprocessor2d.cxx | 36 |
1 files changed, 20 insertions, 16 deletions
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx index c245389fdcb5..e0a090cf9ecd 100644 --- a/drawinglayer/source/processor2d/vclprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclprocessor2d.cxx @@ -409,25 +409,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<tools::Long>(aPointX), |