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
diff --git a/drawinglayer/source/processor2d/vclprocessor2d.cxx b/drawinglayer/source/processor2d/vclprocessor2d.cxx
index c245389..e0a090cf 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());
mpOutputDevice->Push(vcl::PushFlags::MAPMODE);
mpOutputDevice->SetRelativeMapMode(aMapMode);
bChangeMapMode = true;
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);
aPointX /= nFontScalingFixX;
aPointY /= nFontScalingFixY;
mpOutputDevice->Push(vcl::PushFlags::MAPMODE);
mpOutputDevice->SetRelativeMapMode(aMapMode);
bChangeMapMode = true;
aPointX /= nFontScalingFixX;
aPointY /= nFontScalingFixY;
}
}
aStartPoint = Point(basegfx::fround<tools::Long>(aPointX),