QWindowsFontEngine: Fix warnings about GetGlyphOutline() failures.

tst_qglthreads::painterOnPixmapInThread reports

QWinFontEngine: unable to query transformed glyph metrics...

(Desktop OpenGL only).

Task-number: QTBUG-28264
Change-Id: Ib456905a13a95037ec13dfc4cb828f830076ee89
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
This commit is contained in:
Friedemann Kleint 2013-04-30 09:48:43 +02:00 committed by The Qt Project
parent 14d222cc9d
commit 65ae781215

View File

@ -1095,7 +1095,7 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
xform.eDx = margin;
xform.eDy = margin;
HDC hdc = CreateCompatibleDC(QWindowsContext::instance()->displayContext());
const HDC hdc = m_fontEngineData->hdc;
SetGraphicsMode(hdc, GM_ADVANCED);
SetWorldTransform(hdc, &xform);
@ -1107,8 +1107,16 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
memset(&mat, 0, sizeof(mat));
mat.eM11.value = mat.eM22.value = 1;
if (GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat) == GDI_ERROR) {
qWarning("QWinFontEngine: unable to query transformed glyph metrics...");
const DWORD result = GetGlyphOutline(hdc, glyph, ggo_options, &tgm, 0, 0, &mat);
XFORM identity = {1, 0, 0, 1, 0, 0};
SetWorldTransform(hdc, &identity);
SetGraphicsMode(hdc, GM_COMPATIBLE);
SelectObject(hdc, old_font);
if (result == GDI_ERROR) {
const int errorCode = GetLastError();
qErrnoWarning(errorCode, "QWinFontEngine: unable to query transformed glyph metrics (GetGlyphOutline() failed, error %d)...", errorCode);
return 0;
}
@ -1117,10 +1125,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph,
xform.eDx -= tgm.gmptGlyphOrigin.x;
xform.eDy += tgm.gmptGlyphOrigin.y;
SetGraphicsMode(hdc, GM_COMPATIBLE);
SelectObject(hdc, old_font);
DeleteDC(hdc);
}
#else // else wince
unsigned int options = 0;