[Libreoffice-commits] core.git: vcl/source
Khaled Hosny
khaledhosny at eglug.org
Fri Nov 11 16:28:11 UTC 2016
vcl/source/gdi/CommonSalLayout.cxx | 19 +++++++++++--------
1 file changed, 11 insertions(+), 8 deletions(-)
New commits:
commit c49d5dea164b09b05a898495fa2dd48b7ca4f0e4
Author: Khaled Hosny <khaledhosny at eglug.org>
Date: Fri Nov 11 18:24:11 2016 +0200
tdf#103765: Minimize the effect of rounding to int
Instead of scaling the relative coordinates and accumulating rounding
errors, scale the absolute coordinates. Also round to int instead of
truncating.
Change-Id: Ida0b4092685e898b7c5b5c07e923e386ffde8bcd
diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx
index c402bed..047f845 100644
--- a/vcl/source/gdi/CommonSalLayout.cxx
+++ b/vcl/source/gdi/CommonSalLayout.cxx
@@ -553,19 +553,22 @@ bool CommonSalLayout::LayoutText(ImplLayoutArgs& rArgs)
if (aSubRun.maDirection == HB_DIRECTION_TTB)
{
nGlyphIndex |= GF_ROTL;
- nAdvance = -pHbPositions[i].y_advance * nYScale;
- nXOffset = pHbPositions[i].y_offset * nYScale;
- nYOffset = -pHbPositions[i].x_offset * nXScale;
+ nAdvance = -pHbPositions[i].y_advance;
+ nXOffset = pHbPositions[i].y_offset;
+ nYOffset = pHbPositions[i].x_offset;
}
else
{
- nAdvance = pHbPositions[i].x_advance * nXScale;
- nXOffset = pHbPositions[i].x_offset * nXScale;
- nYOffset = pHbPositions[i].y_offset * nYScale;
+ nAdvance = pHbPositions[i].x_advance;
+ nXOffset = pHbPositions[i].x_offset;
+ nYOffset = -pHbPositions[i].y_offset;
}
- Point aNewPos = Point(aCurrPos.X() + nXOffset, -(aCurrPos.Y() + nYOffset));
- const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags, nAdvance, nXOffset);
+ Point aNewPos(lround((aCurrPos.X() + nXOffset) * nXScale),
+ lround((aCurrPos.Y() + nYOffset) * nYScale));
+ const GlyphItem aGI(nCharPos, nGlyphIndex, aNewPos, nGlyphFlags,
+ lround(nAdvance * nXScale),
+ lround(nXOffset * nXScale));
AppendGlyph(aGI);
aCurrPos.X() += nAdvance;
More information about the Libreoffice-commits
mailing list