vcl/inc/win/winlayout.hxx | 2 +- vcl/win/gdi/winlayout.cxx | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-)
New commits: commit 4b4abb73fcd7f2802e73102b3e7c30face8d309c Author: Khaled Hosny <khaledho...@eglug.org> Date: Mon Oct 31 04:46:34 2016 +0200 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 diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 50f6602..5655785 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; } commit ebe3fd529195ae1edf5daeab197bbb3cfec4143c Author: Khaled Hosny <khaledho...@eglug.org> Date: Mon Oct 31 04:37:25 2016 +0200 Reduce number of arguments The font is already a member of the class, and the EM height is unused. Change-Id: Ice2eb2bb3e4b491bcb93123e1c3a08170cdaa50b diff --git a/vcl/inc/win/winlayout.hxx b/vcl/inc/win/winlayout.hxx index 04fc135..c025351 100755 --- a/vcl/inc/win/winlayout.hxx +++ b/vcl/inc/win/winlayout.hxx @@ -501,7 +501,7 @@ private: D2DWriteTextOutRenderer & operator = (const D2DWriteTextOutRenderer &) = delete; bool GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const; - bool GetDWriteInkBox(IDWriteFontFace & rFontFace, SalLayout const &rLayout, float const lfEmHeight, Rectangle &) const; + bool GetDWriteInkBox(SalLayout const &rLayout, Rectangle &) const; ID2D1Factory * mpD2DFactory; IDWriteFactory * mpDWriteFactory; diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index 658641e..50f6602 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -3455,7 +3455,7 @@ bool D2DWriteTextOutRenderer::operator ()(SalLayout const &rLayout, HDC hDC, } Rectangle bounds; - bool succeeded = GetDWriteInkBox(*mpFontFace, rLayout, mlfEmHeight, bounds); + bool succeeded = GetDWriteInkBox(rLayout, bounds); succeeded &= BindDC(hDC, bounds); // Update the bounding rect. ID2D1SolidColorBrush* pBrush = nullptr; @@ -3652,12 +3652,12 @@ bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** p return succeeded; } -bool D2DWriteTextOutRenderer::GetDWriteInkBox(IDWriteFontFace & rFontFace, SalLayout const &rLayout, float const /*lfEmHeight*/, Rectangle & rOut) const +bool D2DWriteTextOutRenderer::GetDWriteInkBox(SalLayout const &rLayout, Rectangle & rOut) const { rOut.SetEmpty(); DWRITE_FONT_METRICS aFontMetrics; - rFontFace.GetMetrics(&aFontMetrics); + mpFontFace->GetMetrics(&aFontMetrics); Point aPos; sal_GlyphId nLGlyph; @@ -3685,7 +3685,7 @@ bool D2DWriteTextOutRenderer::GetDWriteInkBox(IDWriteFontFace & rFontFace, SalLa if (bVertical) { DWRITE_FONT_METRICS aFM; - rFontFace.GetMetrics(&aFM); + mpFontFace->GetMetrics(&aFM); nYDiff = (aFM.ascent - aFM.descent) * mlfEmHeight / aFM.designUnitsPerEm; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits