summaryrefslogtreecommitdiff
path: root/vcl/win
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2017-03-05 21:31:09 +0000
committerCaolán McNamara <caolanm@redhat.com>2017-03-05 21:32:25 +0000
commitb398dacbb471913e573e9b0b4cd31d94a9109223 (patch)
tree286cb4faba1eee6872bfe91062b4c359229185a6 /vcl/win
parent5c783dc75f9f31b5393f0a921323583312a731ec (diff)
Revert "pPos and pGetNextGlypInfo always have the same value"
This reverts commit 7453cb58df4ce434a1252567f961cfe497064aca. and... Revert "pEraseRect is always null" I suspect the problem is the change to D2DWriteTextOutRenderer::operator in 7453cb58df4ce434a1252567f961cfe497064aca aborts during windows tinderboxes CppunitTest_dbaccess_empty_stdlib_save etc This reverts commit 073d920ef5914b5dfe491dbaf7fb18ba56293b85. Change-Id: I372e104bd09e49bcf08306169db9777f2f26fff5
Diffstat (limited to 'vcl/win')
-rw-r--r--vcl/win/gdi/winlayout.cxx39
1 files changed, 22 insertions, 17 deletions
diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx
index cf555de5fe00..c884c9ef6580 100644
--- a/vcl/win/gdi/winlayout.cxx
+++ b/vcl/win/gdi/winlayout.cxx
@@ -264,8 +264,12 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite)
bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
SalGraphics & /*rGraphics*/,
- HDC hDC)
+ HDC hDC,
+ const Rectangle* pRectToErase,
+ Point* pPos, int* pGetNextGlypInfo)
{
+ bool bGlyphs = false;
+ const GlyphItem* pGlyph;
HFONT hFont = static_cast<HFONT>(GetCurrentObject( hDC, OBJ_FONT ));
HFONT hAltFont = nullptr;
bool bUseAltFont = false;
@@ -280,19 +284,16 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
hAltFont = CreateFontIndirectW(&aLogFont);
}
}
-
- int nStart = 0;
- Point aPos(0, 0);
- const GlyphItem* pGlyph;
- while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
+ while (rLayout.GetNextGlyphs(1, &pGlyph, *pPos, *pGetNextGlypInfo))
{
+ bGlyphs = true;
WORD glyphWStr[] = { pGlyph->maGlyphId };
if (hAltFont && pGlyph->IsVertical() == bUseAltFont)
{
bUseAltFont = !bUseAltFont;
SelectFont(hDC, bUseAltFont ? hAltFont : hFont);
}
- ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, LPCWSTR(&glyphWStr), 1, nullptr);
+ ExtTextOutW(hDC, pPos->X(), pPos->Y(), ETO_GLYPH_INDEX, nullptr, LPCWSTR(&glyphWStr), 1, nullptr);
}
if (hAltFont)
{
@@ -301,7 +302,7 @@ bool ExTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
DeleteObject(hAltFont);
}
- return true;
+ return (pRectToErase && bGlyphs);
}
D2DWriteTextOutRenderer::D2DWriteTextOutRenderer()
@@ -342,7 +343,9 @@ D2DWriteTextOutRenderer::~D2DWriteTextOutRenderer()
bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
SalGraphics &rGraphics,
- HDC hDC)
+ HDC hDC,
+ const Rectangle* pRectToErase,
+ Point* pPos, int* pGetNextGlypInfo)
{
if (!Ready())
return false;
@@ -350,7 +353,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
if (!BindFont(hDC))
{
// If for any reason we can't bind fallback to legacy APIs.
- return ExTextOutRenderer()(rLayout, rGraphics, hDC);
+ return ExTextOutRenderer()(rLayout, rGraphics, hDC, pRectToErase, pPos, pGetNextGlypInfo);
}
Rectangle bounds;
@@ -362,19 +365,19 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
succeeded &= SUCCEEDED(mpRT->CreateSolidColorBrush(D2D1::ColorF(GetRValue(bgrTextColor) / 255.0f, GetGValue(bgrTextColor) / 255.0f, GetBValue(bgrTextColor) / 255.0f), &pBrush));
HRESULT hr = S_OK;
+ bool bGlyphs = false;
if (succeeded)
{
mpRT->BeginDraw();
- int nStart = 0;
- Point aPos(0, 0);
const GlyphItem* pGlyph;
- while (rLayout.GetNextGlyphs(1, &pGlyph, aPos, nStart))
+ while (rLayout.GetNextGlyphs(1, &pGlyph, *pPos, *pGetNextGlypInfo))
{
+ bGlyphs = true;
UINT16 glyphIndices[] = { pGlyph->maGlyphId };
FLOAT glyphAdvances[] = { pGlyph->mnNewWidth };
DWRITE_GLYPH_OFFSET glyphOffsets[] = { { 0.0f, 0.0f }, };
- D2D1_POINT_2F baseline = { aPos.X() - bounds.Left(), aPos.Y() - bounds.Top() };
+ D2D1_POINT_2F baseline = { pPos->X() - bounds.Left(), pPos->Y() - bounds.Top() };
DWRITE_GLYPH_RUN glyphs = {
mpFontFace,
mlfEmHeight,
@@ -400,7 +403,7 @@ bool D2DWriteTextOutRenderer::operator ()(CommonSalLayout const &rLayout,
if (hr == D2DERR_RECREATE_TARGET)
CreateRenderTarget();
- return succeeded;
+ return (succeeded && bGlyphs && pRectToErase);
}
bool D2DWriteTextOutRenderer::BindFont(HDC hDC)
@@ -603,9 +606,11 @@ bool WinSalGraphics::DrawCachedGlyphs(const CommonSalLayout& rLayout)
void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout, HDC hDC, bool bUseDWrite)
{
+ Point aPos(0, 0);
+ int nGlyphCount(0);
TextOutRenderer &render = TextOutRenderer::get(bUseDWrite);
- bool result = render(rLayout, *this, hDC);
- assert(result);
+ bool result = render(rLayout, *this, hDC, nullptr, &aPos, &nGlyphCount);
+ assert(!result);
}
void WinSalGraphics::DrawTextLayout(const CommonSalLayout& rLayout)