summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorTor Lillqvist <tml@collabora.com>2016-03-09 19:45:41 +0200
committerTor Lillqvist <tml@collabora.com>2016-03-09 19:48:25 +0200
commit2823f7bd4898ab9ebc7ea2937b9db235dc52ae84 (patch)
tree583e9707e1caf11c8fd86f19cac0ec2b4a989c01 /vcl
parent417262ab8324585f7a977ede80c9736ef6463b77 (diff)
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
Diffstat (limited to 'vcl')
-rw-r--r--vcl/win/gdi/winlayout.cxx13
1 files changed, 8 insertions, 5 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index cccae83e2924..39d6fd729f1f 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