diff options
author | Sergio Ahumada <sahumada@blackberry.com> | 2014-03-13 15:57:03 +0100 |
---|---|---|
committer | Sergio Ahumada <sahumada@blackberry.com> | 2014-03-13 15:57:11 +0100 |
commit | 27016b89ae49da091527548af0ca9022ec4d7902 (patch) | |
tree | de408d49d52dd6a73e75a612ef51342d6ee44638 /src/plugins/platforms/windows | |
parent | 3683bc97d2ebc0de3272fc09656b90a88f5eb326 (diff) | |
parent | fbaa6d3ca6fc2693c5c8a1cd8e565803adc97730 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Change-Id: Idec54e19963e8d88c711cb179cffc81596323899
Diffstat (limited to 'src/plugins/platforms/windows')
15 files changed, 136 insertions, 194 deletions
diff --git a/src/plugins/platforms/windows/qwindows.qdocconf b/src/plugins/platforms/windows/qwindows.qdocconf deleted file mode 100644 index 1684773b87..0000000000 --- a/src/plugins/platforms/windows/qwindows.qdocconf +++ /dev/null @@ -1,25 +0,0 @@ -project = "Qt Windows Lighthouse Plugin" -description = "Documentation of the Qt Windows Lighthouse Plugin" - -language = Cpp - -headerdirs = . - -sourcedirs = . - -showinternal = true - -headers.fileextensions = "*.h" -sources.fileextensions = "*.cpp *.qdoc" - -qhp.projects = QtLighthouseWindows -qhp.QtLighthouseWindowsDev.file = qtlighthousewindows-dev.qhp -qhp.QtLighthouseWindowsDev.namespace = com.nokia.qt.developer.lighthouse -qhp.QtLighthouseWindowsDev.virtualFolder = doc -qhp.QtLighthouseWindowsDev.indexTitle = Qt Windows Lighthouse Plugin -qhp.QtLighthouseWindowsDev.indexRoot = - -# Doxygen compatibility commands - -macro.see = "\\sa" -macro.function = "\\fn" diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index f12c828d8a..1abf447709 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -203,4 +203,17 @@ HDC QWindowsBackingStore::getDC() const return 0; } +#ifndef QT_NO_OPENGL + +QImage QWindowsBackingStore::toImage() const +{ + if (m_image.isNull()) { + qCWarning(lcQpaBackingStore) <<__FUNCTION__ << "Image is null."; + return QImage(); + } + return m_image.data()->image(); +} + +#endif // !QT_NO_OPENGL + QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h index b655aca835..758f6c941f 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.h +++ b/src/plugins/platforms/windows/qwindowsbackingstore.h @@ -67,6 +67,10 @@ public: HDC getDC() const; +#ifndef QT_NO_OPENGL + QImage toImage() const Q_DECL_OVERRIDE; +#endif + private: QScopedPointer<QWindowsNativeImage> m_image; }; diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index c35af3623a..a74a7efb41 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -979,8 +979,10 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, #if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) case QtWindows::QueryEndSessionApplicationEvent: { QWindowsSessionManager *sessionManager = platformSessionManager(); - if (sessionManager->isActive()) // bogus message from windows + if (sessionManager->isActive()) { // bogus message from windows + *result = sessionManager->wasCanceled() ? 0 : 1; return true; + } sessionManager->setActive(true); sessionManager->blocksInteraction(); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index e025d7e513..d5ca06bb3f 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -124,7 +124,7 @@ QWindowsEGLStaticContext::~QWindowsEGLStaticContext() QWindowsEGLContext::QWindowsEGLContext(const QWindowsEGLStaticContextPtr &staticContext, const QSurfaceFormat &format, QPlatformOpenGLContext *share) - : QEGLPlatformContext(format, share, staticContext->display(), EGL_OPENGL_ES_API) + : QEGLPlatformContext(format, share, staticContext->display()) , m_staticContext(staticContext) { } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 854444b254..8f9ddc2168 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -1038,11 +1038,17 @@ QWindowsFontDatabase::~QWindowsFontDatabase() removeApplicationFonts(); } +QFontEngineMulti *QWindowsFontDatabase::fontEngineMulti(QFontEngine *fontEngine, QChar::Script script) +{ + Q_UNUSED(script) + return new QWindowsMultiFontEngine(fontEngine, QStringList()); +} + QFontEngine * QWindowsFontDatabase::fontEngine(const QFontDef &fontDef, void *handle) { - QFontEngine *fe = QWindowsFontDatabase::createEngine(QChar::Script_Common, fontDef, - 0, QWindowsContext::instance()->defaultDPI(), false, - QStringList(), sharedFontData()); + QFontEngine *fe = QWindowsFontDatabase::createEngine(fontDef, 0, + QWindowsContext::instance()->defaultDPI(), + false, sharedFontData()); qCDebug(lcQpaFonts) << __FUNCTION__ << "FONTDEF" << fontDef << fe << handle; return fe; } @@ -1087,12 +1093,12 @@ QFontEngine *QWindowsFontDatabase::fontEngine(const QByteArray &fontData, qreal QFontDef request; request.family = uniqueFamilyName; request.pixelSize = pixelSize; - request.styleStrategy = QFont::NoFontMerging | QFont::PreferMatch; + request.styleStrategy = QFont::PreferMatch; request.hintingPreference = hintingPreference; - fontEngine = QWindowsFontDatabase::createEngine(QChar::Script_Common, request, 0, - QWindowsContext::instance()->defaultDPI(), false, QStringList(), - sharedFontData()); + fontEngine = QWindowsFontDatabase::createEngine(request, 0, + QWindowsContext::instance()->defaultDPI(), + false, sharedFontData()); if (fontEngine) { if (request.family != fontEngine->fontDef.family) { @@ -1623,9 +1629,8 @@ QStringList QWindowsFontDatabase::fallbacksForFamily(const QString &family, QFon } -QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &request, +QFontEngine *QWindowsFontDatabase::createEngine(const QFontDef &request, HDC fontHdc, int dpi, bool rawMode, - const QStringList &family_list, const QSharedPointer<QWindowsFontEngineData> &data) { LOGFONT lf; @@ -1769,17 +1774,6 @@ QFontEngine *QWindowsFontDatabase::createEngine(int script, const QFontDef &requ directWriteFont->Release(); #endif - if ((script == QChar::Script_Common || script == QChar::Script_Han) - && !(request.styleStrategy & QFont::NoFontMerging)) { - const QStringList extraFonts = QWindowsFontDatabase::extraTryFontsForFamily(request.family); - if (extraFonts.size()) { - QStringList list = family_list; - list.append(extraFonts); - QFontEngine *mfe = new QWindowsMultiFontEngine(fe, list); - mfe->fontDef = fe->fontDef; - fe = mfe; - } - } return fe; } diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.h b/src/plugins/platforms/windows/qwindowsfontdatabase.h index 1e13fc2559..a2324544d2 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.h +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.h @@ -78,6 +78,7 @@ public: ~QWindowsFontDatabase(); virtual void populateFontDatabase(); + virtual QFontEngineMulti *fontEngineMulti(QFontEngine *fontEngine, QChar::Script script); virtual QFontEngine *fontEngine(const QFontDef &fontDef, void *handle); virtual QFontEngine *fontEngine(const QByteArray &fontData, qreal pixelSize, QFont::HintingPreference hintingPreference); virtual QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const; @@ -92,9 +93,8 @@ public: static QFont systemDefaultFont(); - static QFontEngine *createEngine(int script, const QFontDef &request, + static QFontEngine *createEngine(const QFontDef &request, HDC fontHdc, int dpi, bool rawMode, - const QStringList &family_list, const QSharedPointer<QWindowsFontEngineData> &data); static HFONT systemFont(); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 86fcb666b0..c3774064e3 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -65,6 +65,7 @@ #include <QtCore/qmath.h> #include <QtCore/QThreadStorage> #include <QtCore/private/qsystemlibrary_p.h> +#include <QtCore/private/qstringiterator_p.h> #include <QtCore/QDebug> @@ -205,47 +206,37 @@ void QWindowsFontEngine::getCMap() } } -// ### Qt 5.1: replace with QStringIterator -inline unsigned int getChar(const QChar *str, int &i, const int len) -{ - uint uc = str[i].unicode(); - if (QChar::isHighSurrogate(uc) && i < len-1) { - uint low = str[i+1].unicode(); - if (QChar::isLowSurrogate(low)) { - uc = QChar::surrogateToUcs4(uc, low); - ++i; - } - } - return uc; -} - int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLayout *glyphs) const { - int i = 0; int glyph_pos = 0; { #if defined(Q_OS_WINCE) { #else if (symbol) { - for (; i < numChars; ++i, ++glyph_pos) { - unsigned int uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); if(!glyphs->glyphs[glyph_pos] && uc < 0x100) glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000); + ++glyph_pos; } } else if (ttf) { - for (; i < numChars; ++i, ++glyph_pos) { - unsigned int uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc); + ++glyph_pos; } } else { #endif wchar_t first = tm.tmFirstChar; wchar_t last = tm.tmLastChar; - for (; i < numChars; ++i, ++glyph_pos) { - uint uc = getChar(str, i, numChars); + QStringIterator it(str, str + numChars); + while (it.hasNext()) { + const uint uc = it.next(); if ( #ifdef Q_WS_WINCE tm.tmFirstChar > 60000 || @@ -254,6 +245,7 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa glyphs->glyphs[glyph_pos] = uc; else glyphs->glyphs[glyph_pos] = 0; + ++glyph_pos; } } } @@ -272,7 +264,8 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa QWindowsFontEngine::QWindowsFontEngine(const QString &name, HFONT _hfont, bool stockFontIn, LOGFONT lf, - const QSharedPointer<QWindowsFontEngineData> &fontEngineData) : + const QSharedPointer<QWindowsFontEngineData> &fontEngineData) + : QFontEngine(Win), m_fontEngineData(fontEngineData), _name(name), hfont(_hfont), @@ -340,6 +333,30 @@ QWindowsFontEngine::~QWindowsFontEngine() } } +glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const +{ + glyph_t glyph; + +#if !defined(Q_OS_WINCE) + if (symbol) { + glyph = getTrueTypeGlyphIndex(cmap, ucs4); + if (glyph == 0 && ucs4 < 0x100) + glyph = getTrueTypeGlyphIndex(cmap, ucs4 + 0xf000); + } else if (ttf) { + glyph = getTrueTypeGlyphIndex(cmap, ucs4); +#else + if (tm.tmFirstChar > 60000) { + glyph = ucs4; +#endif + } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { + glyph = ucs4; + } else { + glyph = 0; + } + + return glyph; +} + HGDIOBJ QWindowsFontEngine::selectDesignFont() const { LOGFONT f = m_logfont; @@ -351,6 +368,7 @@ HGDIOBJ QWindowsFontEngine::selectDesignFont() const bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; @@ -746,46 +764,6 @@ qreal QWindowsFontEngine::minRightBearing() const #endif // Q_OS_WINCE } - -const char *QWindowsFontEngine::name() const -{ - return 0; -} - -bool QWindowsFontEngine::canRender(const QChar *string, int len) -{ - if (symbol) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - if (getTrueTypeGlyphIndex(cmap, uc) == 0) { - if (uc < 0x100) { - if (getTrueTypeGlyphIndex(cmap, uc + 0xf000) == 0) - return false; - } else { - return false; - } - } - } - } else if (ttf) { - for (int i = 0; i < len; ++i) { - unsigned int uc = getChar(string, i, len); - if (getTrueTypeGlyphIndex(cmap, uc) == 0) - return false; - } - } else { - while(len--) { - if (tm.tmFirstChar > string->unicode() || tm.tmLastChar < string->unicode()) - return false; - } - } - return true; -} - -QFontEngine::Type QWindowsFontEngine::type() const -{ - return QFontEngine::Win; -} - static inline double qt_fixed_to_double(const FIXED &p) { return ((p.value << 16) + p.fract) / 65536.0; } @@ -1032,6 +1010,7 @@ bool QWindowsFontEngine::getSfntTableData(uint tag, uchar *buffer, uint *length) SelectObject(hdc, hfont); DWORD t = qbswap<quint32>(tag); *length = GetFontData(hdc, t, 0, buffer, *length); + Q_ASSERT(*length == GDI_ERROR || int(*length) > 0); return *length != GDI_ERROR; } @@ -1254,15 +1233,11 @@ QFontEngine *QWindowsFontEngine::cloneWithSize(qreal pixelSize) const if (!uniqueFamilyName.isEmpty()) request.family = uniqueFamilyName; request.pixelSize = pixelSize; - // Disable font merging, as otherwise createEngine will return a multi-engine - // instance instead of the specific engine we wish to clone. - request.styleStrategy |= QFont::NoFontMerging; QFontEngine *fontEngine = - QWindowsFontDatabase::createEngine(QChar::Script_Common, request, 0, + QWindowsFontDatabase::createEngine(request, 0, QWindowsContext::instance()->defaultDPI(), - false, - QStringList(), m_fontEngineData); + false, m_fontEngineData); if (fontEngine) { fontEngine->fontDef.family = actualFontName; if (!uniqueFamilyName.isEmpty()) { @@ -1305,19 +1280,29 @@ void QWindowsFontEngine::initFontInfo(const QFontDef &request, */ QWindowsMultiFontEngine::QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks) - : QFontEngineMulti(fallbacks.size()+1), - fallbacks(fallbacks) + : QFontEngineMulti(fallbacks.size() + 1), + fallbackFamilies(fallbacks) { - qCDebug(lcQpaFonts) << __FUNCTION__ << engines.size() << first << first->fontDef.family << fallbacks; engines[0] = first; first->ref.ref(); fontDef = engines[0]->fontDef; cache_cost = first->cache_cost; } -QWindowsMultiFontEngine::~QWindowsMultiFontEngine() +void QWindowsMultiFontEngine::setFallbackFamiliesList(const QStringList &fallbacks) { - qCDebug(lcQpaFonts) << __FUNCTION__; + // Original FontEngine to restore after the fill. + QFontEngine *fe = engines[0]; + fallbackFamilies = fallbacks; + if (!fallbackFamilies.isEmpty()) { + engines.fill(0, fallbackFamilies.size() + 1); + engines[0] = fe; + } else { + // Turns out we lied about having any fallback at all. + fallbackFamilies << fe->fontDef.family; + engines[1] = fe; + fe->ref.ref(); + } } void QWindowsMultiFontEngine::loadEngine(int at) @@ -1344,7 +1329,7 @@ void QWindowsMultiFontEngine::loadEngine(int at) data = fe->fontEngineData(); } - const QString fam = fallbacks.at(at-1); + const QString fam = fallbackFamilies.at(at-1); memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded #ifndef QT_NO_DIRECTWRITE diff --git a/src/plugins/platforms/windows/qwindowsfontengine.h b/src/plugins/platforms/windows/qwindowsfontengine.h index e3fb3281a3..7d93484220 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.h +++ b/src/plugins/platforms/windows/qwindowsfontengine.h @@ -86,6 +86,7 @@ public: virtual int synthesized() const; virtual QFixed emSquareSize() const; + virtual glyph_t glyphIndex(uint ucs4) const; virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; virtual void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const; @@ -109,12 +110,6 @@ public: virtual qreal minLeftBearing() const; virtual qreal minRightBearing() const; - virtual const char *name() const; - - bool canRender(const QChar *string, int len); - - Type type() const; - virtual QImage alphaMapForGlyph(glyph_t t) { return alphaMapForGlyph(t, QTransform()); } virtual QImage alphaMapForGlyph(glyph_t, const QTransform &xform); virtual QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, const QTransform &xform); @@ -175,10 +170,11 @@ class QWindowsMultiFontEngine : public QFontEngineMulti { public: QWindowsMultiFontEngine(QFontEngine *first, const QStringList &fallbacks); - virtual ~QWindowsMultiFontEngine(); + + void setFallbackFamiliesList(const QStringList &fallbacks); void loadEngine(int at); - QStringList fallbacks; + QStringList fallbackFamilies; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 1c5e4508ac..8f55e20536 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -53,6 +53,7 @@ #include <QtCore/QSettings> #include <QtCore/QtEndian> #include <QtCore/QVarLengthArray> +#include <private/qstringiterator_p.h> #include <dwrite.h> #include <d2d1.h> @@ -201,8 +202,8 @@ namespace { QWindowsFontEngineDirectWrite::QWindowsFontEngineDirectWrite(IDWriteFontFace *directWriteFontFace, qreal pixelSize, const QSharedPointer<QWindowsFontEngineData> &d) - - : m_fontEngineData(d) + : QFontEngine(DirectWrite) + , m_fontEngineData(d) , m_directWriteFontFace(directWriteFontFace) , m_directWriteBitmapRenderTarget(0) , m_lineThickness(-1) @@ -282,8 +283,8 @@ bool QWindowsFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, ui ret = true; if (buffer && *length >= tableSize) memcpy(buffer, tableData, tableSize); - else - *length = tableSize; + *length = tableSize; + Q_ASSERT(int(*length) > 0); } m_directWriteFontFace->ReleaseFontTable(tableContext); } else { @@ -301,23 +302,23 @@ QFixed QWindowsFontEngineDirectWrite::emSquareSize() const return QFontEngine::emSquareSize(); } -// ### Qt 5.1: replace with QStringIterator -inline unsigned int getChar(const QChar *str, int &i, const int len) +glyph_t QWindowsFontEngineDirectWrite::glyphIndex(uint ucs4) const { - uint uc = str[i].unicode(); - if (QChar::isHighSurrogate(uc) && i < len-1) { - uint low = str[i+1].unicode(); - if (QChar::isLowSurrogate(low)) { - uc = QChar::surrogateToUcs4(uc, low); - ++i; - } + UINT16 glyphIndex; + + HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(&ucs4, 1, &glyphIndex); + if (FAILED(hr)) { + qErrnoWarning("%s: glyphIndex failed", __FUNCTION__); + glyphIndex = 0; } - return uc; + + return glyphIndex; } bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QFontEngine::ShaperFlags flags) const { + Q_ASSERT(glyphs->numGlyphs >= *nglyphs); if (*nglyphs < len) { *nglyphs = len; return false; @@ -325,8 +326,9 @@ bool QWindowsFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGly QVarLengthArray<UINT32> codePoints(len); int actualLength = 0; - for (int i = 0; i < len; ++i) - codePoints[actualLength++] = getChar(str, i, len); + QStringIterator it(str, str + len); + while (it.hasNext()) + codePoints[actualLength++] = it.next(); QVarLengthArray<UINT16> glyphIndices(actualLength); HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(codePoints.data(), actualLength, @@ -628,39 +630,6 @@ QImage QWindowsFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, : mask.convertToFormat(QImage::Format_RGB32); } -const char *QWindowsFontEngineDirectWrite::name() const -{ - return 0; -} - -bool QWindowsFontEngineDirectWrite::canRender(const QChar *string, int len) -{ - QVarLengthArray<UINT32> codePoints(len); - int actualLength = 0; - for (int i=0; i<len; ++i, actualLength++) - codePoints[actualLength] = getChar(string, i, len); - - QVarLengthArray<UINT16> glyphIndices(actualLength); - HRESULT hr = m_directWriteFontFace->GetGlyphIndices(codePoints.data(), actualLength, - glyphIndices.data()); - if (FAILED(hr)) { - qErrnoWarning("%s: GetGlyphIndices failed", __FUNCTION__); - return false; - } - - for (int i = 0; i < actualLength; ++i) { - if (glyphIndices.at(i) == 0) - return false; - } - - return true; -} - -QFontEngine::Type QWindowsFontEngineDirectWrite::type() const -{ - return QFontEngine::DirectWrite; -} - QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const { QFontEngine *fontEngine = new QWindowsFontEngineDirectWrite(m_directWriteFontFace, diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h index 399bb5f5ad..2da014ddc3 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.h @@ -74,6 +74,7 @@ public: bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; QFixed emSquareSize() const; + virtual glyph_t glyphIndex(uint ucs4) const; bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, ShaperFlags flags) const; void recalcAdvances(QGlyphLayout *glyphs, ShaperFlags) const; @@ -89,8 +90,6 @@ public: QFixed xHeight() const; qreal maxCharWidth() const; - const char *name() const; - bool supportsSubPixelPositions() const; QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); @@ -98,9 +97,6 @@ public: QFontEngine *cloneWithSize(qreal pixelSize) const; - bool canRender(const QChar *string, int len); - Type type() const; - const QSharedPointer<QWindowsFontEngineData> &fontEngineData() const { return m_fontEngineData; } static QString fontNameSubstitute(const QString &familyName); diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 9bfe4e6e26..c45c34ae4d 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -1050,7 +1050,7 @@ bool QWindowsGLContext::makeCurrent(QPlatformSurface *surface) qCDebug(lcQpaGl) << __FUNCTION__ << this << m_windowContexts.size() << "contexts"; #endif // DEBUG_GL - Q_ASSERT(surface->surface()->surfaceType() == QSurface::OpenGLSurface); + Q_ASSERT(surface->surface()->supportsOpenGL()); // Do we already have a DC entry for that window? QWindowsWindow *window = static_cast<QWindowsWindow *>(surface); diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index 3735865845..e0e8753e14 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -234,7 +234,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case ThreadedOpenGL: #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - return QOpenGLFunctions::isES() ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; + return QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL + ? QWindowsEGLContext::hasThreadedOpenGLCapability() : true; # else return true; # endif // QT_OPENGL_ES_2 @@ -245,6 +246,8 @@ bool QWindowsIntegration::hasCapability(QPlatformIntegration::Capability cap) co return true; case ForeignWindows: return true; + case RasterGLSurface: + return true; default: return QPlatformIntegration::hasCapability(cap); } @@ -296,7 +299,7 @@ QPlatformOpenGLContext { qCDebug(lcQpaGl) << __FUNCTION__ << context->format(); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()){ + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { if (d->m_staticEGLContext.isNull()) { QWindowsEGLStaticContext *staticContext = QWindowsEGLStaticContext::create(); if (!staticContext) @@ -307,7 +310,7 @@ QPlatformOpenGLContext } #endif #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { if (d->m_staticOpenGLContext.isNull()) d->m_staticOpenGLContext = QSharedPointer<QOpenGLStaticContext>(QOpenGLStaticContext::create()); @@ -379,7 +382,7 @@ QVariant QWindowsIntegration::styleHint(QPlatformIntegration::StyleHint hint) co switch (hint) { case QPlatformIntegration::CursorFlashTime: if (const unsigned timeMS = GetCaretBlinkTime()) - return QVariant(int(timeMS)); + return QVariant(int(timeMS) * 2); break; #ifdef SPI_GETKEYBOARDSPEED case KeyboardAutoRepeatRate: diff --git a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp index fb1b63084f..7e15be1d19 100644 --- a/src/plugins/platforms/windows/qwindowsnativeinterface.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeinterface.cpp @@ -69,13 +69,18 @@ void *QWindowsNativeInterface::nativeResourceForWindow(const QByteArray &resourc QWindowsWindow *bw = static_cast<QWindowsWindow *>(window->handle()); if (resource == "handle") return bw->handle(); - if (window->surfaceType() == QWindow::RasterSurface) { + switch (window->surfaceType()) { + case QWindow::RasterSurface: + case QWindow::RasterGLSurface: if (resource == "getDC") return bw->getDC(); if (resource == "releaseDC") { bw->releaseDC(); return 0; } + break; + case QWindow::OpenGLSurface: + break; } qWarning("%s: Invalid key '%s' requested.", __FUNCTION__, resource.constData()); return 0; @@ -120,7 +125,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour return 0; } #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) { QWindowsEGLContext *windowsEglContext = static_cast<QWindowsEGLContext *>(context->handle()); if (resource == QByteArrayLiteral("eglDisplay")) return windowsEglContext->eglDisplay(); @@ -131,7 +136,7 @@ void *QWindowsNativeInterface::nativeResourceForContext(const QByteArray &resour } #endif // QT_OPENGL_ES_2 || QT_OPENGL_DYNAMIC #if !defined(QT_OPENGL_ES_2) - if (!QOpenGLFunctions::isES()) { + if (QOpenGLContext::openGLModuleType() == QOpenGLContext::DesktopGL) { QWindowsGLContext *windowsContext = static_cast<QWindowsGLContext *>(context->handle()); if (resource == QByteArrayLiteral("renderingContext")) return windowsContext->renderingContext(); diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 223ac9ac2d..274366d4fe 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -886,7 +886,7 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) if (aWindow->surfaceType() == QWindow::OpenGLSurface) { setFlag(OpenGLSurface); #if defined(QT_OPENGL_ES_2) || defined(QT_OPENGL_DYNAMIC) - if (QOpenGLFunctions::isES()) + if (QOpenGLContext::openGLModuleType() != QOpenGLContext::DesktopGL) setFlag(OpenGL_ES2); #endif } |