diff options
author | Friedemann Kleint <Friedemann.Kleint@digia.com> | 2013-04-30 09:48:43 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-05-13 13:29:48 +0200 |
commit | 65ae7812156f5738cb9fe760af40613bba95804c (patch) | |
tree | 1f8ec081cfc188606ab6622649706c60dfab97dc /src/plugins/platforms/windows/qwindowsfontengine.cpp | |
parent | 14d222cc9d1555497779c514f51e813a7bdc927c (diff) |
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>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontengine.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontengine.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index a410708ceb..792e79df19 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -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; |