diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-04 20:18:14 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-11-04 20:18:14 +0100 |
commit | 4159ee840549df11287294f0928e90f35f3e06ff (patch) | |
tree | 4a3947e37d54bdb78b4042e9ced20dbf181b5a2c /src/gui | |
parent | 59dbf1786f22ec4ac88d8f9d38cac5cfb82acaea (diff) | |
parent | c8c39ecc37c156ac2677de09a26548dfc274b564 (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
config.tests/unix/ptrsize.test
configure
src/corelib/global/qnamespace.h
src/network/socket/qabstractsocket.cpp
tests/auto/other/networkselftest/networkselftest.pro
Change-Id: Ic78abb4a34f9068567cea876861d4220f5a07672
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 16 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication_p.h | 1 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling.cpp | 36 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwindowsysteminterface.h | 2 | ||||
-rw-r--r-- | src/gui/painting/painting.pri | 1 | ||||
-rw-r--r-- | src/gui/painting/qdatabuffer_p.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 3 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_p.h | 4 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper_p.h | 3 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 2 | ||||
-rw-r--r-- | src/gui/text/qfontengine.cpp | 3 |
13 files changed, 52 insertions, 28 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 35e880fc5b..12e5dbd66c 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -130,6 +130,8 @@ QWindow *QGuiApplicationPrivate::currentMouseWindow = 0; Qt::ApplicationState QGuiApplicationPrivate::applicationState = Qt::ApplicationInactive; +bool QGuiApplicationPrivate::highDpiScalingUpdated = false; + QPlatformIntegration *QGuiApplicationPrivate::platform_integration = 0; QPlatformTheme *QGuiApplicationPrivate::platform_theme = 0; @@ -1083,6 +1085,13 @@ static void init_platform(const QString &pluginArgument, const QString &platform return; } + // Many platforms have created QScreens at this point. Finish initializing + // QHighDpiScaling to be prepared for early calls to qt_defaultDpi(). + if (QGuiApplication::primaryScreen()) { + QGuiApplicationPrivate::highDpiScalingUpdated = true; + QHighDpiScaling::updateHighDpiScaling(); + } + // Create the platform theme: // 1) Fetch the platform name from the environment if present. @@ -1252,9 +1261,10 @@ void QGuiApplicationPrivate::eventDispatcherReady() platform_integration->initialize(); - // Do this here in order to play nice with platforms that add screens only - // in initialize(). - QHighDpiScaling::updateHighDpiScaling(); + // All platforms should have added screens at this point. Finish + // QHighDpiScaling initialization if it has not been done so already. + if (!QGuiApplicationPrivate::highDpiScalingUpdated) + QHighDpiScaling::updateHighDpiScaling(); } void QGuiApplicationPrivate::init() diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h index 6dc8735f86..7d8deab507 100644 --- a/src/gui/kernel/qguiapplication_p.h +++ b/src/gui/kernel/qguiapplication_p.h @@ -203,6 +203,7 @@ public: static QWindow *currentMouseWindow; static QWindow *currentMousePressWindow; static Qt::ApplicationState applicationState; + static bool highDpiScalingUpdated; #ifndef QT_NO_CLIPBOARD static QClipboard *qt_clipboard; diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index daba9f94a1..a002b8c48d 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -49,7 +49,7 @@ static const char scaleFactorEnvVar[] = "QT_SCALE_FACTOR"; static const char autoScreenEnvVar[] = "QT_AUTO_SCREEN_SCALE_FACTOR"; static const char screenFactorsEnvVar[] = "QT_SCREEN_SCALE_FACTORS"; -static inline qreal initialScaleFactor() +static inline qreal initialGlobalScaleFactor() { qreal result = 1; @@ -134,19 +134,31 @@ QDpi QHighDpiScaling::m_logicalDpi = QDpi(-1,-1); // The scaled logical DPI of t Initializes the QHighDpiScaling global variables. Called before the platform plugin is created. */ -void QHighDpiScaling::initHighDpiScaling() + +static inline bool usePixelDensity() { - if (QCoreApplication::testAttribute(Qt::AA_NoHighDpiScaling)) { - m_factor = 1; - m_active = false; - return; - } - m_factor = initialScaleFactor(); - bool usePlatformPluginPixelDensity = qEnvironmentVariableIsSet(autoScreenEnvVar) - || qgetenv(legacyDevicePixelEnvVar).toLower() == "auto"; + // Determine if we should set a scale factor based on the pixel density + // reported by the platform plugin. There are several enablers and several + // disablers. A single disable may veto all other enablers. + if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) + return false; + bool screenEnvValueOk; + const int screenEnvValue = qEnvironmentVariableIntValue(autoScreenEnvVar, &screenEnvValueOk); + if (screenEnvValueOk && screenEnvValue < 1) + return false; + return QCoreApplication::testAttribute(Qt::AA_EnableHighDpiScaling) + || (screenEnvValueOk && screenEnvValue > 0) + || (qEnvironmentVariableIsSet(legacyDevicePixelEnvVar) && qgetenv(legacyDevicePixelEnvVar).toLower() == "auto"); +} +void QHighDpiScaling::initHighDpiScaling() +{ + // Determine if there is a global scale factor set. + m_factor = initialGlobalScaleFactor(); m_globalScalingActive = !qFuzzyCompare(m_factor, qreal(1)); - m_usePixelDensity = usePlatformPluginPixelDensity; + + m_usePixelDensity = usePixelDensity(); + m_pixelDensityScalingActive = false; //set in updateHighDpiScaling below // we update m_active in updateHighDpiScaling, but while we create the @@ -156,7 +168,7 @@ void QHighDpiScaling::initHighDpiScaling() void QHighDpiScaling::updateHighDpiScaling() { - if (QCoreApplication::testAttribute(Qt::AA_NoHighDpiScaling)) + if (QCoreApplication::testAttribute(Qt::AA_DisableHighDpiScaling)) return; if (m_usePixelDensity && !m_pixelDensityScalingActive) { diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp index e7abff9ccc..8a46e7009b 100644 --- a/src/gui/kernel/qwindowsysteminterface.cpp +++ b/src/gui/kernel/qwindowsysteminterface.cpp @@ -261,11 +261,11 @@ bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *w, QEvent::Type typ quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text, bool autorep, - ushort count) + ushort count, bool tryShortcutOverride) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); return handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, - text, autorep, count); + text, autorep, count, tryShortcutOverride); } bool QWindowSystemInterface::handleExtendedKeyEvent(QWindow *tlw, ulong timestamp, QEvent::Type type, int key, diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h index 387c1e00b9..a27c68649e 100644 --- a/src/gui/kernel/qwindowsysteminterface.h +++ b/src/gui/kernel/qwindowsysteminterface.h @@ -88,7 +88,7 @@ public: quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, const QString& text = QString(), bool autorep = false, - ushort count = 1); + ushort count = 1, bool tryShortcutOverride = true); static bool handleExtendedKeyEvent(QWindow *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 791b5f1a9a..2e2532a25f 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -9,6 +9,7 @@ HEADERS += \ painting/qcolor.h \ painting/qcolor_p.h \ painting/qcosmeticstroker_p.h \ + painting/qdatabuffer_p.h \ painting/qdrawhelper_p.h \ painting/qdrawhelper_x86_p.h \ painting/qdrawingprimitive_sse2_p.h \ diff --git a/src/gui/painting/qdatabuffer_p.h b/src/gui/painting/qdatabuffer_p.h index 0a4a3d5c9e..3fe39efdde 100644 --- a/src/gui/painting/qdatabuffer_p.h +++ b/src/gui/painting/qdatabuffer_p.h @@ -53,6 +53,7 @@ QT_BEGIN_NAMESPACE template <typename Type> class QDataBuffer { + Q_DISABLE_COPY(QDataBuffer); public: QDataBuffer(int res) { diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 6cfc4b9307..5c1cd8adef 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -1257,9 +1257,8 @@ static inline void qConvertARGB64PMToA2RGB30PM_sse2(uint *dest, const QRgba64 *b const __m128i cmask = _mm_set1_epi32(0x000003ff); int i = 0; __m128i vr, vg, vb, va; - if (i < count && (const uintptr_t)buffer & 0x8) { + for (; i < count && (const uintptr_t)buffer & 0xF; ++i) { *dest++ = qConvertRgb64ToRgb30<PixelOrder>(*buffer++); - ++i; } for (; i < count-15; i += 16) { diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 2fb9e7760c..1d70477051 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -588,7 +588,7 @@ static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_255(uint x, uint a, uint y, uint b return x; } -#if QT_POINTER_SIZE == 8 // 64-bit versions +#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions static Q_ALWAYS_INLINE uint INTERPOLATE_PIXEL_256(uint x, uint a, uint y, uint b) { quint64 t = (((quint64(x)) | ((quint64(x)) << 24)) & 0x00ff00ff00ff00ff) * a; @@ -1093,7 +1093,7 @@ const uint qt_bayer_matrix[16][16] = { ((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff) -#if QT_POINTER_SIZE == 8 // 64-bit versions +#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions #define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) #define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask))) #else // 32 bits diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 513fdfa2b6..3a686bd209 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -548,11 +548,11 @@ void SegmentTree::produceIntersectionsLeaf(const TreeNode &node, int segment) for (int k = 0; k < m_intersections.size(); ++k) { QPathSegments::Intersection i_isect, j_isect; - i_isect.vertex = j_isect.vertex = m_segments.addPoint(m_intersections.at(k).pos); - i_isect.t = m_intersections.at(k).alphaA; j_isect.t = m_intersections.at(k).alphaB; + i_isect.vertex = j_isect.vertex = m_segments.addPoint(m_intersections.at(k).pos); + i_isect.next = 0; j_isect.next = 0; diff --git a/src/gui/painting/qpathclipper_p.h b/src/gui/painting/qpathclipper_p.h index 36330052dd..d1caea4a1a 100644 --- a/src/gui/painting/qpathclipper_p.h +++ b/src/gui/painting/qpathclipper_p.h @@ -156,9 +156,8 @@ class QPathSegments { public: struct Intersection { - int vertex; qreal t; - + int vertex; int next; bool operator<(const Intersection &o) const { diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 47483b2869..d746ab9379 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1498,7 +1498,7 @@ void QPdfEnginePrivate::writeInfo() printString(creator); xprintf("\n/Producer "); printString(QString::fromLatin1("Qt " QT_VERSION_STR)); - QDateTime now = QDateTime::currentDateTime().toUTC(); + QDateTime now = QDateTime::currentDateTimeUtc(); QTime t = now.time(); QDate d = now.date(); xprintf("\n/CreationDate (D:%d%02d%02d%02d%02d%02d)\n", diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index bef4dc5547..a0eedee6b9 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -960,7 +960,8 @@ QImage QFontEngine::alphaMapForGlyph(glyph_t glyph) pt.x = -glyph_x; pt.y = -glyph_y; // the baseline QPainterPath path; - QImage im(glyph_width + 4, glyph_height, QImage::Format_ARGB32_Premultiplied); + path.setFillRule(Qt::WindingFill); + QImage im(glyph_width, glyph_height, QImage::Format_ARGB32_Premultiplied); im.fill(Qt::transparent); QPainter p(&im); p.setRenderHint(QPainter::Antialiasing); |