summaryrefslogtreecommitdiff
path: root/drawinglayer
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2024-05-26 10:21:59 +0500
committerMiklos Vajna <vmiklos@collabora.com>2024-05-27 11:57:59 +0200
commit724250d63dcf4e0de1f9ec24abc001d9e1824e00 (patch)
tree940a6f48a79daa3e635b2739a6fe1d1410ab27d0 /drawinglayer
parent2802ba82d2ac0b9d831117dcc47375fd1dd01415 (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 (cherry picked from commit c9571914b8170128a68496ec2dd299e21243d1c1) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168055 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Diffstat (limited to 'drawinglayer')
-rw-r--r--drawinglayer/source/processor2d/vclprocessor2d.cxx36
1 files changed, 20 insertions, 16 deletions
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));