diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2014-11-24 06:53:02 +0400 |
---|---|---|
committer | Konstantin Ritt <ritt.ks@gmail.com> | 2015-02-02 21:36:32 +0000 |
commit | d6e117e1d8b1b39311a5042fde762c475e884326 (patch) | |
tree | 69c3291b6988ae84be670e373432161c7e89e47a /src/plugins/platforms/windows/qwindowsfontdatabase.cpp | |
parent | baaf8f0156c9b02f6091460e53f2793c3502d3a5 (diff) |
Don't remember if passed HFONT was a stock object
According to GetStockObject() function docs at MSDN:
> It is not necessary (but it is not harmful) to delete
> stock objects by calling DeleteObject.
Change-Id: I755dc84c8b86ba2806e97ae41b3025aa3e633ae7
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Diffstat (limited to 'src/plugins/platforms/windows/qwindowsfontdatabase.cpp')
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontdatabase.cpp | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index c5fd910fb0..724d0e7aaf 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1675,7 +1675,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, LOGFONT lf; memset(&lf, 0, sizeof(LOGFONT)); - bool stockFont = false; bool preferClearTypeAA = false; HFONT hfont = 0; @@ -1696,7 +1695,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, if (!hfont) qErrnoWarning("%s: CreateFontIndirect failed", __FUNCTION__); - stockFont = (hfont == 0); bool ttf = false; int avWidth = 0; BOOL res; @@ -1720,15 +1718,11 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, } #ifndef Q_OS_WINCE - if (hfont == 0) { + if (hfont == 0) hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); - stockFont = true; - } #else - if (hfont == 0) { + if (hfont == 0) hfont = (HFONT)GetStockObject(SYSTEM_FONT); - stockFont = true; - } #endif } @@ -1762,7 +1756,7 @@ QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, QFontEngine *fe = 0; if (!useDirectWrite) { - QWindowsFontEngine *few = new QWindowsFontEngine(request.family, hfont, stockFont, lf, data); + QWindowsFontEngine *few = new QWindowsFontEngine(request.family, hfont, lf, data); if (preferClearTypeAA) few->glyphFormat = QFontEngine::Format_A32; few->initFontInfo(request, dpi); |