diff options
author | Khaled Hosny <khaledhosny@eglug.org> | 2016-10-31 04:46:34 +0200 |
---|---|---|
committer | Khaled Hosny <khaledhosny@eglug.org> | 2016-10-31 04:54:04 +0200 |
commit | 4b4abb73fcd7f2802e73102b3e7c30face8d309c (patch) | |
tree | e8134dc1eaaf048b9a974b76157e487b8c9e6ed8 /vcl | |
parent | ebe3fd529195ae1edf5daeab197bbb3cfec4143c (diff) |
Avoid excessive text clipping on Windows
Use a better rounding strategy so that when the bounding box involves
part of a pixel we include the full pixel, so floor for -ve values and
ceil for +ve ones. Without this I see lots of cut text on Windows.
Change-Id: I258f63eb37911574cd3f6f08da22349756c0775c
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 50f6602db6ac..5655785345f7 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -3611,10 +3611,10 @@ std::vector<Rectangle> D2DWriteTextOutRenderer::GetGlyphInkBoxes(uint16_t * pGid bottom = INT32(m.advanceHeight) - m.verticalOriginY - m.bottomSideBearing; // Scale to screen space. - pOut->Left() = std::lround(left * mlfEmHeight / aFontMetrics.designUnitsPerEm); - pOut->Top() = std::lround(top * mlfEmHeight / aFontMetrics.designUnitsPerEm); - pOut->Right() = std::lround(right * mlfEmHeight / aFontMetrics.designUnitsPerEm); - pOut->Bottom() = std::lround(bottom * mlfEmHeight / aFontMetrics.designUnitsPerEm); + pOut->Left() = std::floor(left * mlfEmHeight / aFontMetrics.designUnitsPerEm); + pOut->Top() = std::floor(top * mlfEmHeight / aFontMetrics.designUnitsPerEm); + pOut->Right() = std::ceil(right * mlfEmHeight / aFontMetrics.designUnitsPerEm); + pOut->Bottom() = std::ceil(bottom * mlfEmHeight / aFontMetrics.designUnitsPerEm); ++pOut; } |