diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-18 08:37:31 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-18 08:37:31 +0100 |
commit | beb65dcd79f8c354dab7bb4a8d08157bd9d69329 (patch) | |
tree | 4632a0ff0df8462f8913f347042cf8378de03268 /src/gui | |
parent | 3fc1002489d5861d4f7cc2e1e8800881d6593c9d (diff) | |
parent | e3288f246b44ba2b6d90b90eb99ab61f496d8d57 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/gui/painting/painting.pri
src/plugins/platforms/xcb/qxcbconnection.cpp
tests/auto/corelib/thread/qthreadstorage/qthreadstorage.pro
tests/auto/corelib/tools/qlocale/test/test.pro
tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
tools/configure/environment.cpp
Change-Id: I9c40f458b89b2c206de2d2c24e90b5f679c93495
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qimage_conversions.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qplatformdialoghelper.h | 17 | ||||
-rw-r--r-- | src/gui/kernel/qplatformmenu.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformsystemtrayicon.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qplatformtheme.h | 2 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwindow_p.h | 2 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexture.cpp | 4 | ||||
-rw-r--r-- | src/gui/opengl/qopengltexture_p.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 28 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qplatformbackingstore.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 33 | ||||
-rw-r--r-- | src/gui/text/qfont.cpp | 6 | ||||
-rw-r--r-- | src/gui/text/qfontdatabase.cpp | 55 |
15 files changed, 127 insertions, 47 deletions
diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index cbdcf49da7..cc79e73534 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -2967,15 +2967,6 @@ static void qInitImageConversions() #endif } -class QImageConversionsInitializer { -public: - QImageConversionsInitializer() - { - qInitImageConversions(); - } -}; - -// Ensure initialization if this object file is linked. -static QImageConversionsInitializer qImageConversionsInitializer; +Q_CONSTRUCTOR_FUNCTION(qInitImageConversions); QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h index 936dbdfa89..5b2f4ece77 100644 --- a/src/gui/kernel/qplatformdialoghelper.h +++ b/src/gui/kernel/qplatformdialoghelper.h @@ -104,6 +104,7 @@ public: }; Q_DECLARE_FLAGS(StandardButtons, StandardButton) + Q_FLAG(StandardButtons) enum ButtonRole { // keep this in sync with QDialogButtonBox::ButtonRole and QMessageBox::ButtonRole @@ -128,6 +129,7 @@ public: Reverse = 0x40000000, EOL = InvalidRole }; + Q_ENUM(ButtonRole) enum ButtonLayout { // keep this in sync with QDialogButtonBox::ButtonLayout and QMessageBox::ButtonLayout @@ -167,6 +169,7 @@ QT_BEGIN_NAMESPACE class Q_GUI_EXPORT QColorDialogOptions { + Q_GADGET public: enum ColorDialogOption { ShowAlphaChannel = 0x00000001, @@ -175,6 +178,7 @@ public: }; Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption) + Q_FLAG(ColorDialogOptions) QColorDialogOptions(); QColorDialogOptions(const QColorDialogOptions &rhs); @@ -226,6 +230,7 @@ private: class Q_GUI_EXPORT QFontDialogOptions { + Q_GADGET public: enum FontDialogOption { NoButtons = 0x00000001, @@ -237,6 +242,7 @@ public: }; Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption) + Q_FLAG(FontDialogOptions) QFontDialogOptions(); QFontDialogOptions(const QFontDialogOptions &rhs); @@ -279,11 +285,19 @@ private: class Q_GUI_EXPORT QFileDialogOptions { + Q_GADGET public: enum ViewMode { Detail, List }; + Q_ENUM(ViewMode) + enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }; + Q_ENUM(FileMode) + enum AcceptMode { AcceptOpen, AcceptSave }; + Q_ENUM(AcceptMode) + enum DialogLabel { LookIn, FileName, FileType, Accept, Reject, DialogLabelCount }; + Q_ENUM(DialogLabel) enum FileDialogOption { @@ -297,6 +311,7 @@ public: DontUseCustomDirectoryIcons = 0x00000080 }; Q_DECLARE_FLAGS(FileDialogOptions, FileDialogOption) + Q_FLAG(FileDialogOptions) QFileDialogOptions(); QFileDialogOptions(const QFileDialogOptions &rhs); @@ -396,9 +411,11 @@ private: class Q_GUI_EXPORT QMessageDialogOptions { + Q_GADGET public: // Keep in sync with QMessageBox::Icon enum Icon { NoIcon, Information, Warning, Critical, Question }; + Q_ENUM(Icon) QMessageDialogOptions(); QMessageDialogOptions(const QMessageDialogOptions &rhs); diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index 1022d0ed4a..bc0b3a4870 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -63,6 +63,7 @@ public: // They could be added as public QAction roles if necessary. CutRole, CopyRole, PasteRole, SelectAllRole, RoleCount }; + Q_ENUM(MenuRole) virtual void setTag(quintptr tag) = 0; virtual quintptr tag()const = 0; @@ -91,6 +92,7 @@ class Q_GUI_EXPORT QPlatformMenu : public QObject Q_OBJECT public: enum MenuType { DefaultMenu = 0, EditMenu }; + Q_ENUM(MenuType) virtual void insertMenuItem(QPlatformMenuItem *menuItem, QPlatformMenuItem *before) = 0; virtual void removeMenuItem(QPlatformMenuItem *menuItem) = 0; diff --git a/src/gui/kernel/qplatformsystemtrayicon.h b/src/gui/kernel/qplatformsystemtrayicon.h index 437f5e02b1..6ef2d1538f 100644 --- a/src/gui/kernel/qplatformsystemtrayicon.h +++ b/src/gui/kernel/qplatformsystemtrayicon.h @@ -57,8 +57,10 @@ public: Trigger, MiddleClick }; + Q_ENUM(ActivationReason) enum MessageIcon { NoIcon, Information, Warning, Critical }; + Q_ENUM(MessageIcon) QPlatformSystemTrayIcon(); ~QPlatformSystemTrayIcon(); diff --git a/src/gui/kernel/qplatformtheme.h b/src/gui/kernel/qplatformtheme.h index 9355e83491..2bd35491fb 100644 --- a/src/gui/kernel/qplatformtheme.h +++ b/src/gui/kernel/qplatformtheme.h @@ -164,6 +164,8 @@ public: SmallFont, MiniFont, FixedFont, + GroupBoxTitleFont, + TabButtonFont, NFonts }; diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index fb322ae74f..52e7686439 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -116,8 +116,8 @@ QScreen::~QScreen() bool movingFromVirtualSibling = primaryScreen && primaryScreen->handle()->virtualSiblings().contains(handle()); // Move any leftover windows to the primary screen - foreach (QWindow *window, QGuiApplication::topLevelWindows()) { - if (window->screen() != this) + foreach (QWindow *window, QGuiApplication::allWindows()) { + if (!window->isTopLevel() || window->screen() != this) continue; const bool wasVisible = window->isVisible(); diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h index 23a6d800c0..6880edaada 100644 --- a/src/gui/kernel/qwindow_p.h +++ b/src/gui/kernel/qwindow_p.h @@ -50,6 +50,7 @@ #include <qpa/qplatformwindow.h> #include <QtCore/private/qobject_p.h> +#include <QtCore/qelapsedtimer.h> #include <QtGui/QIcon> QT_BEGIN_NAMESPACE @@ -187,6 +188,7 @@ public: #endif bool compositing; + QElapsedTimer lastComposeTime; }; diff --git a/src/gui/opengl/qopengltexture.cpp b/src/gui/opengl/qopengltexture.cpp index 301b2ad13d..02dee5a90a 100644 --- a/src/gui/opengl/qopengltexture.cpp +++ b/src/gui/opengl/qopengltexture.cpp @@ -97,9 +97,11 @@ QOpenGLTexturePrivate::QOpenGLTexturePrivate(QOpenGLTexture::Target textureTarge break; case QOpenGLTexture::TargetCubeMap: bindingTarget = QOpenGLTexture::BindingTargetCubeMap; + faces = 6; break; case QOpenGLTexture::TargetCubeMapArray: bindingTarget = QOpenGLTexture::BindingTargetCubeMapArray; + faces = 6; break; case QOpenGLTexture::Target2DMultisample: bindingTarget = QOpenGLTexture::BindingTarget2DMultisample; @@ -175,7 +177,7 @@ bool QOpenGLTexturePrivate::create() void QOpenGLTexturePrivate::destroy() { - if (!context) { + if (!textureId) { // not created or already destroyed return; } diff --git a/src/gui/opengl/qopengltexture_p.h b/src/gui/opengl/qopengltexture_p.h index ac9d44db42..40ceb1936c 100644 --- a/src/gui/opengl/qopengltexture_p.h +++ b/src/gui/opengl/qopengltexture_p.h @@ -156,7 +156,6 @@ public: bool autoGenerateMipMaps; bool storageAllocated; - QPair<int, int> glVersion; QOpenGLTextureHelper *texFuncs; QOpenGLTexture::Features features; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 4e40d250d3..e7b81ebdd3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -32,11 +32,6 @@ ****************************************************************************/ #include <qglobal.h> -#ifdef Q_OS_IOS -// We don't build the NEON drawhelpers as they are implemented partly -// in GAS syntax assembly, which is not supported by the iOS toolchain. -#undef __ARM_NEON__ -#endif #include <qstylehints.h> #include <qguiapplication.h> @@ -6314,8 +6309,13 @@ void qt_memfill32(quint32 *dest, quint32 color, int count) template<QtPixelOrder> const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM_sse4(uint *buffer, const uint *src, int count, const QPixelLayout *, const QRgb *); #endif +extern void qInitBlendFunctions(); + static void qInitDrawhelperFunctions() { + // Set up basic blend function tables. + qInitBlendFunctions(); + #ifdef __SSE2__ qDrawHelper[QImage::Format_RGB32].bitmapBlit = qt_bitmapblit32_sse2; qDrawHelper[QImage::Format_ARGB32].bitmapBlit = qt_bitmapblit32_sse2; @@ -6411,7 +6411,7 @@ static void qInitDrawhelperFunctions() #endif // SSE2 -#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) +#if defined(__ARM_NEON__) qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; @@ -6432,7 +6432,7 @@ static void qInitDrawhelperFunctions() qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; -#if !defined(Q_PROCESSOR_ARM_64) +#if defined(ENABLE_PIXMAN_DRAWHELPERS) // The RGB16 helpers are using Arm32 assemblythat has not been ported to AArch64 qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon; @@ -6509,19 +6509,7 @@ static void qInitDrawhelperFunctions() #endif // QT_COMPILER_SUPPORTS_MIPS_DSP || QT_COMPILER_SUPPORTS_MIPS_DSPR2 } -extern void qInitBlendFunctions(); -class DrawHelperInitializer { -public: - DrawHelperInitializer() - { - // Set up basic blend function tables. - qInitBlendFunctions(); - // Set up architecture optimized methods for the current machine. - qInitDrawhelperFunctions(); - } -}; - // Ensure initialization if this object file is linked. -static DrawHelperInitializer drawHelperInitializer; +Q_CONSTRUCTOR_FUNCTION(qInitDrawhelperFunctions); QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 7f8000c856..8409481ad5 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3653,8 +3653,9 @@ QImage::Format QRasterBuffer::prepare(QImage *image) drawHelper = qDrawHelper + format; if (image->depth() == 1 && image->colorTable().size() == 2) { monoDestinationWithClut = true; - destColor0 = qPremultiply(image->colorTable()[0]); - destColor1 = qPremultiply(image->colorTable()[1]); + const QVector<QRgb> colorTable = image->colorTable(); + destColor0 = qPremultiply(colorTable[0]); + destColor1 = qPremultiply(colorTable[1]); } return format; diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 4e26d8f741..cda2446a5e 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -301,6 +301,8 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion ®i return; } + QWindowPrivate::get(window)->lastComposeTime.start(); + QOpenGLFunctions *funcs = context->functions(); funcs->glViewport(0, 0, window->width() * window->devicePixelRatio(), window->height() * window->devicePixelRatio()); funcs->glClearColor(0, 0, 0, translucentBackground ? 0 : 1); diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index e6b777a30e..5e648eabf5 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -41,7 +41,7 @@ #include "qimage.h" #include "qbitmap.h" -#include <qdebug.h> +#include <private/qdebug_p.h> QT_BEGIN_NAMESPACE @@ -422,11 +422,32 @@ QDataStream &operator>>(QDataStream &s, QRegion &r) #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug s, const QRegion &r) { - QVector<QRect> rects = r.rects(); - s.nospace() << "QRegion(size=" << rects.size() << "), " - << "bounds = " << r.boundingRect() << '\n'; - for (int i=0; i<rects.size(); ++i) - s << "- " << i << rects.at(i) << '\n'; + QDebugStateSaver saver(s); + s.nospace(); + s << "QRegion("; + if (r.isNull()) { + s << "null"; + } else if (r.isEmpty()) { + s << "empty"; + } else { + const QVector<QRect> rects = r.rects(); + const int count = rects.size(); + if (count > 1) + s << "size=" << count << ", bounds=("; + QtDebugUtils::formatQRect(s, r.boundingRect()); + if (count > 1) { + s << ") - ["; + for (int i = 0; i < count; ++i) { + if (i) + s << ", "; + s << '('; + QtDebugUtils::formatQRect(s, rects.at(i)); + s << ')'; + } + s << ']'; + } + } + s << ')'; return s; } #endif diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index a0a64cae01..ed4a932a32 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -2110,6 +2110,9 @@ QString QFont::lastResortFamily() const return QString::fromLatin1("helvetica"); } +extern QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, + QFont::StyleHint styleHint, QChar::Script script); + /*! \fn QString QFont::defaultFamily() const @@ -2120,8 +2123,7 @@ QString QFont::lastResortFamily() const */ QString QFont::defaultFamily() const { - QPlatformFontDatabase *fontDB = QGuiApplicationPrivate::platformIntegration()->fontDatabase(); - const QStringList fallbacks = fontDB->fallbacksForFamily(QString(), QFont::StyleNormal + const QStringList fallbacks = qt_fallbacksForFamily(QString(), QFont::StyleNormal , QFont::StyleHint(d->request.styleHint), QChar::Script_Common); if (!fallbacks.isEmpty()) return fallbacks.first(); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 8916705c0e..2f8af2315d 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -47,6 +47,7 @@ #include <qpa/qplatformfontdatabase.h> #include <qpa/qplatformtheme.h> +#include <QtCore/qcache.h> #include <QtCore/qmath.h> #include <stdlib.h> @@ -413,11 +414,45 @@ void QtFontFamily::ensurePopulated() Q_ASSERT_X(populated, Q_FUNC_INFO, qPrintable(name)); } + +struct FallbacksCacheKey { + QString family; + QFont::Style style; + QFont::StyleHint styleHint; + QChar::Script script; +}; + +inline bool operator==(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) Q_DECL_NOTHROW +{ + return lhs.script == rhs.script && + lhs.styleHint == rhs.styleHint && + lhs.style == rhs.style && + lhs.family == rhs.family; +} + +inline bool operator!=(const FallbacksCacheKey &lhs, const FallbacksCacheKey &rhs) Q_DECL_NOTHROW +{ + return !operator==(lhs, rhs); +} + +inline uint qHash(const FallbacksCacheKey &key, uint seed = 0) Q_DECL_NOTHROW +{ + QtPrivate::QHashCombine hash; + seed = hash(seed, key.family); + seed = hash(seed, int(key.style)); + seed = hash(seed, int(key.styleHint)); + seed = hash(seed, int(key.script)); + return seed; +} + + class QFontDatabasePrivate { public: QFontDatabasePrivate() - : count(0), families(0), reregisterAppFonts(false) + : count(0), families(0), + fallbacksCache(64), + reregisterAppFonts(false) { } ~QFontDatabasePrivate() { @@ -443,6 +478,7 @@ public: int count; QtFontFamily **families; + QCache<FallbacksCacheKey, QStringList> fallbacksCache; struct ApplicationFont { @@ -461,6 +497,8 @@ public: void QFontDatabasePrivate::invalidate() { QFontCache::instance()->clear(); + + fallbacksCache.clear(); free(); QGuiApplicationPrivate::platformIntegration()->fontDatabase()->invalidate(); emit static_cast<QGuiApplication *>(QCoreApplication::instance())->fontDatabaseChanged(); @@ -680,8 +718,10 @@ Q_GLOBAL_STATIC_WITH_ARGS(QMutex, fontDatabaseMutex, (QMutex::Recursive)) void qt_cleanupFontDatabase() { QFontDatabasePrivate *db = privateDb(); - if (db) + if (db) { + db->fallbacksCache.clear(); db->free(); + } } // used in qfontengine_x11.cpp @@ -800,9 +840,15 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) { + QFontDatabasePrivate *db = privateDb(); + + const FallbacksCacheKey cacheKey = { family, style, styleHint, script }; + + if (const QStringList *fallbacks = db->fallbacksCache.object(cacheKey)) + return *fallbacks; + // make sure that the db has all fallback families QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script); - QFontDatabasePrivate *db = privateDb(); QStringList::iterator i; for (i = retList.begin(); i != retList.end(); ++i) { @@ -818,6 +864,9 @@ QStringList qt_fallbacksForFamily(const QString &family, QFont::Style style, QFo --i; } } + + db->fallbacksCache.insert(cacheKey, new QStringList(retList)); + return retList; } |