[Libreoffice-commits] core.git: vcl/win
Tor Lillqvist
tml at collabora.com
Wed Mar 9 17:49:26 UTC 2016
vcl/win/gdi/winlayout.cxx | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
New commits:
commit 2823f7bd4898ab9ebc7ea2937b9db235dc52ae84
Author: Tor Lillqvist <tml at collabora.com>
Date: Wed Mar 9 19:45:41 2016 +0200
Make the new D2D Graphite rendering work also in the OpenGL case
It used to render just black boxes.
The change in DrawTextImpl() semantics from
61085083e4a5060ba7e2135818264d63c6da13c2 was not properly implemented
in the new Graphite code. The return value is not some kind of
"success" indicator, but tells the caller whether to continue the loop
at that level.
We do need to call FillRect() to fill the requested rectangle of the
HDC with white. On the other hand, the call to Clear() is not needed
and in fact makes no text show up.
(I now see that that same code snippet that calls FillRect() is used
in all the DrawTextImpl() implementations, so it should be factored
out to the call site in WinLayout::DrawText().)
Change-Id: If0533ea1edf065b06ae888c6e57c026f447bcf78
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index cccae83..39d6fd7 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -3768,6 +3768,12 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
const Rectangle* pRectToErase,
Point* pPos, int* pGetNextGlypInfo)
{
+ if (pRectToErase)
+ {
+ RECT aRect = { pRectToErase->Left(), pRectToErase->Top(), pRectToErase->Left() + pRectToErase->GetWidth(), pRectToErase->Top() + pRectToErase->GetHeight() };
+ FillRect(hDC, &aRect, static_cast<HBRUSH>(GetStockObject(WHITE_BRUSH)));
+ }
+
if (!Ready())
return false;
@@ -3794,18 +3800,15 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetTextColor(hDC)), &pBlackBrush));
HRESULT hr = S_OK;
+ int nGlyphs = 0;
if (succeeded)
{
- if (pRectToErase)
- mpRT->Clear(D2D1::ColorF(D2D1::ColorF::White));
-
const int MAX_GLYPHS = 2;
sal_GlyphId glyphIntStr[MAX_GLYPHS];
UINT16 glyphIndices[MAX_GLYPHS];
long glyphIntAdv[MAX_GLYPHS];
FLOAT glyphAdvances[MAX_GLYPHS];
DWRITE_GLYPH_OFFSET glyphOffsets[MAX_GLYPHS] = { { 0.0f, 0.0f }, };
- int nGlyphs = 0;
mpRT->BeginDraw();
do
@@ -3844,7 +3847,7 @@ bool D2DWriteTextOutRenderer::operator ()(WinLayout const &rLayout, HDC hDC,
if (hr == D2DERR_RECREATE_TARGET)
CreateRenderTarget();
- return (SUCCEEDED(hr) && succeeded && pRectToErase);
+ return (succeeded && nGlyphs >= 1 && pRectToErase);
}
bool D2DWriteTextOutRenderer::GetDWriteFaceFromHDC(HDC hDC, IDWriteFontFace ** ppFontFace, float * lfSize) const
More information about the Libreoffice-commits
mailing list