diff options
author | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-02 23:33:06 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@theqtcompany.com> | 2015-12-02 23:33:06 +0100 |
commit | 72f5867f144cec8fc7848cbcc772683fe845652d (patch) | |
tree | 7513af27b59332bf111f406d304977adc8c8612e /src/gui | |
parent | 13777097118c496391d4b9656b95097ac25e4a40 (diff) | |
parent | bf0af8b5a24de7e595929a64948a3548936aaaee (diff) |
Merge remote-tracking branch 'origin/5.6' into dev
Conflicts:
src/corelib/kernel/qcoreapplication.cpp
src/corelib/kernel/qeventdispatcher_blackberry.cpp
src/network/bearer/qnetworkconfiguration.cpp
src/plugins/bearer/blackberry/qbbengine.cpp
src/plugins/platforms/android/androidjnimain.cpp
src/plugins/platforms/android/qandroidplatformtheme.cpp
src/plugins/platforms/qnx/qqnxbpseventfilter.cpp
src/plugins/platforms/qnx/qqnxfiledialoghelper_bb10.cpp
src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp
src/plugins/platforms/qnx/qqnxintegration.cpp
src/plugins/platforms/qnx/qqnxnavigatorbps.cpp
src/plugins/platforms/qnx/qqnxvirtualkeyboardbps.cpp
src/plugins/platforms/qnx/qqnxwindow.cpp
src/widgets/kernel/qwidgetwindow.cpp
src/widgets/styles/qwindowsvistastyle.cpp
src/widgets/styles/qwindowsxpstyle.cpp
src/widgets/widgets/qtoolbararealayout.cpp
tests/auto/corelib/global/qflags/qflags.pro
tests/auto/corelib/itemmodels/qitemmodel/modelstotest.cpp
tests/auto/corelib/tools/qversionnumber/qversionnumber.pro
tests/auto/widgets/dialogs/qfilesystemmodel/tst_qfilesystemmodel.cpp
Change-Id: I37be88c6c185bb85404823353e027a0a6acdbce4
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/image/qicon.cpp | 8 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 11 | ||||
-rw-r--r-- | src/gui/kernel/qguivariant.cpp | 9 | ||||
-rw-r--r-- | src/gui/kernel/qhighdpiscaling.cpp | 139 | ||||
-rw-r--r-- | src/gui/kernel/qplatformgraphicsbufferhelper.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qplatformintegration.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qplatformscreen.cpp | 6 | ||||
-rw-r--r-- | src/gui/kernel/qscreen.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 6 | ||||
-rw-r--r-- | src/gui/opengl/qopengl.cpp | 4 | ||||
-rw-r--r-- | src/gui/opengl/qopengltextureblitter.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/painting.pri | 4 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper.cpp | 34 | ||||
-rw-r--r-- | src/gui/painting/qdrawhelper_neon.cpp | 90 | ||||
-rw-r--r-- | src/gui/painting/qplatformbackingstore.cpp | 11 | ||||
-rw-r--r-- | src/gui/text/qtextengine.cpp | 10 | ||||
-rw-r--r-- | src/gui/text/qtextodfwriter.cpp | 9 | ||||
-rw-r--r-- | src/gui/util/qdesktopservices.cpp | 2 |
19 files changed, 279 insertions, 83 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp index cc00f5c172..6090f42ba7 100644 --- a/src/gui/image/qicon.cpp +++ b/src/gui/image/qicon.cpp @@ -1228,6 +1228,12 @@ bool QIcon::hasThemeIcon(const QString &name) */ void QIcon::setIsMask(bool isMask) { + if (!d) { + d = new QIconPrivate; + d->engine = new QPixmapIconEngine; + } else { + detach(); + } d->is_mask = isMask; } @@ -1242,6 +1248,8 @@ void QIcon::setIsMask(bool isMask) */ bool QIcon::isMask() const { + if (!d) + return false; return d->is_mask; } diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 492268402d..9c42cd44a6 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -907,7 +907,7 @@ void QPixmap::fill(const QPaintDevice *device, const QPoint &p) { Q_UNUSED(device) Q_UNUSED(p) - qWarning("%s is deprecated, ignored", Q_FUNC_INFO); + qWarning("this function is deprecated, ignored"); } @@ -1703,8 +1703,8 @@ QPixmap QPixmap::fromImageReader(QImageReader *imageReader, Qt::ImageConversionF QPixmap QPixmap::grabWindow(WId window, int x, int y, int w, int h) { - qWarning("%s is deprecated, use QScreen::grabWindow() instead." - " Defaulting to primary screen.", Q_FUNC_INFO); + qWarning("this function is deprecated, use QScreen::grabWindow() instead." + " Defaulting to primary screen."); return QGuiApplication::primaryScreen()->grabWindow(window, x, y, w, h); } diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index f88f6dc01a..49a05c48dd 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -165,7 +165,7 @@ int QGuiApplicationPrivate::mouse_double_click_distance = -1; QWindow *QGuiApplicationPrivate::currentMousePressWindow = 0; -static Qt::LayoutDirection layout_direction = Qt::LeftToRight; +static Qt::LayoutDirection layout_direction = Qt::LayoutDirectionAuto; static bool force_reverse = false; QGuiApplicationPrivate *QGuiApplicationPrivate::self = 0; @@ -1305,7 +1305,6 @@ void QGuiApplicationPrivate::init() pluginList << argv[i]; } else if (arg == "-reverse") { force_reverse = true; - QGuiApplication::setLayoutDirection(Qt::RightToLeft); #ifdef Q_OS_MAC } else if (arg.startsWith("-psn_")) { // eat "-psn_xxxx" on Mac, which is passed when starting an app from Finder. @@ -1429,6 +1428,9 @@ void QGuiApplicationPrivate::init() #else Q_UNUSED(loadTestability); #endif // QT_NO_LIBRARY + + if (layout_direction == Qt::LayoutDirectionAuto || force_reverse) + QGuiApplication::setLayoutDirection(qt_detectRTLLanguage() ? Qt::RightToLeft : Qt::LeftToRight); } extern void qt_cleanupFontDatabase(); @@ -3300,7 +3302,10 @@ void QGuiApplication::setLayoutDirection(Qt::LayoutDirection direction) Qt::LayoutDirection QGuiApplication::layoutDirection() { - return layout_direction; + // layout_direction is only ever Qt::LayoutDirectionAuto if setLayoutDirection + // was never called, or called with Qt::LayoutDirectionAuto (which is a no-op). + // In that case we return the default LeftToRight. + return layout_direction == Qt::LayoutDirectionAuto ? Qt::LeftToRight : layout_direction; } /*! diff --git a/src/gui/kernel/qguivariant.cpp b/src/gui/kernel/qguivariant.cpp index ce4a0ec09e..a0769ca671 100644 --- a/src/gui/kernel/qguivariant.cpp +++ b/src/gui/kernel/qguivariant.cpp @@ -175,7 +175,8 @@ static bool convert(const QVariant::Private *d, int t, switch (t) { case QVariant::ByteArray: if (d->type == QVariant::Color) { - *static_cast<QByteArray *>(result) = v_cast<QColor>(d)->name().toLatin1(); + const QColor *c = v_cast<QColor>(d); + *static_cast<QByteArray *>(result) = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb).toLatin1(); return true; } break; @@ -190,9 +191,11 @@ static bool convert(const QVariant::Private *d, int t, case QVariant::Font: *str = v_cast<QFont>(d)->toString(); return true; - case QVariant::Color: - *str = v_cast<QColor>(d)->name(); + case QVariant::Color: { + const QColor *c = v_cast<QColor>(d); + *str = c->name(c->alpha() != 255 ? QColor::HexArgb : QColor::HexRgb); return true; + } default: break; } diff --git a/src/gui/kernel/qhighdpiscaling.cpp b/src/gui/kernel/qhighdpiscaling.cpp index a002b8c48d..a3201aa23f 100644 --- a/src/gui/kernel/qhighdpiscaling.cpp +++ b/src/gui/kernel/qhighdpiscaling.cpp @@ -94,32 +94,121 @@ static inline qreal initialGlobalScaleFactor() plugin interfacing parts of QtGui, for example the QWindow, QScreen and QWindowSystemInterface implementation. - The coordinate system scaling is enabled by setting one or more scale - factors. These will then be factored into the value returned by the - devicePixelRatio() accessors (any native scale factor will also be - included in this value). Several setters are available: - - - A process-global scale factor - - QT_SCALE_FACTOR (environment variable) - - QHighDpiScaling::setGlobalFactor() - - - A per-screen scale factor - - QT_AUTO_SCALE_FACTOR (environment variable) - Setting this to a true-ish value will make QHighDpiScaling - call QPlatformScreen::pixelDensity() - - QHighDpiScaling::setScreenFactor(screen, factor); - - QT_SCREEN_SCALE_FACTORS (environment variable) - Set this to a semicolon-separated list of scale factors - (matching the order of QGuiApplications::screens()), - or to a list of name=value pairs (where name matches - QScreen::name()). - - All scale factors are of type qreal. - - The main scaling functions for use in QtGui are: + There are now up to three active coordinate systems in Qt: + + --------------------------------------------------- + | Application Device Independent Pixels | devicePixelRatio + | Qt Widgets | = + | Qt Gui | + |---------------------------------------------------| Qt Scale Factor + | Qt Gui QPlatform* Native Pixels | * + | Qt platform plugin | + |---------------------------------------------------| OS Scale Factor + | Display Device Pixels | + | (Graphics Buffers) | + ----------------------------------------------------- + + This is an simplification and shows the main coordinate system. All layers + may work with device pixels in specific cases: OpenGL, creating the backing + store, and QPixmap management. The "Native Pixels" coordinate system is + internal to Qt and should not be exposed to Qt users: Seen from the outside + there are only two coordinate systems: device independent pixels and device + pixels. + + The devicePixelRatio seen by applications is the product of the Qt scale + factor and the OS scale factor. The value of the scale factors may be 1, + in which case two or more of the coordinate systems are equivalent. Platforms + that (may) have an OS scale factor include OS X, iOS and Wayland. + + Note that the functions in this file do not work with the OS scale factor + directly and are limited to converting between device independent and native + pixels. The OS scale factor is accunted for by QWindow::devicePixelRatio() + and similar functions. + + Configuration Examples: + + 'Classic': Device Independent Pixels = Native Pixels = Device Pixels + --------------------------------------------------- devicePixelRatio: 1 + | Application / Qt Gui 100 x 100 | + | | Qt Scale Factor: 1 + | Qt Platform / OS 100 x 100 | + | | OS Scale Factor: 1 + | Display 100 x 100 | + ----------------------------------------------------- + + 'Retina Device': Device Independent Pixels = Native Pixels + --------------------------------------------------- devicePixelRatio: 2 + | Application / Qt Gui 100 x 100 | + | | Qt Scale Factor: 1 + | Qt Platform / OS 100 x 100 | + |---------------------------------------------------| OS Scale Factor: 2 + | Display 200 x 200 | + ----------------------------------------------------- + + '2x Qt Scaling': Native Pixels = Device Pixels + --------------------------------------------------- devicePixelRatio: 2 + | Application / Qt Gui 100 x 100 | + |---------------------------------------------------| Qt Scale Factor: 2 + | Qt Platform / OS 200 x 200 | + | | OS Scale Factor: 1 + | Display 200 x 200 | + ----------------------------------------------------- + + The Qt Scale Factor is the product of two sub-scale factors, which + are independently either set or determined by the platform plugin. + Several APIs are offered for this, targeting both developers and + end users. All scale factors are of type qreal. + + 1) A global scale factor + The QT_SCALE_FACTOR environment variable can be used to set + a global scale factor for all windows in the processs. This + is useful for testing and debugging (you can simulate any + devicePixelRatio without needing access to sepcial hardware), + and perhaps also for targeting a specific application to + a specific display type (embedded use cases). + + 2) A per-screen scale factors + Some platform plugins support providing a per-screen scale + factor based on display density information. These platforms + include X11, Windows, and Android. + + There are two APIs for enabling or disabling this behavior: + - The QT_AUTO_SCALE_FACTOR environment variable. + - The AA_EnableHighDpiScaling and AA_DisableHighDpiScaling + application attributes + + Enabling either will make QHighDpiScaling call QPlatformScreen::pixelDensity() + and use the value provided as the scale factor for the screen in + question. Disabling is done on a 'veto' basis where either the + environment or the application source can disable. The intended use + cases are 'My system is not providing correct display density + information' and 'My application needs to work in display pixels', + respectively. + + The QT_SCREEN_SCALE_FACTORS environment variable can be used to set the screen + scale factors manually.Set this to a semicolon-separated + list of scale factors (matching the order of QGuiApplications::screens()), + or to a list of name=value pairs (where name matches QScreen::name()). + + Coordinate conversion functions must be used when writing code that passes + geometry across the Qt Gui / Platform plugin boundary. The main conversion + functions are: T toNativePixels(T, QWindow *) T fromNativePixels(T, QWindow*) - Where T is QPoint, QSize, QRect etc. + + The following classes in QtGui use native pixels, for the convenience of the + plataform plugins: + QPlatformWindow + QPlatformScreen + QWindowSystemInterface (API only - Events are in device independent pixels) + + As a special consideration platform plugin code should be careful about + calling QtGui geometry accessor functions: + QRect r = window->geometry(); + Here the returned geometry is in device independent pixels. Add a conversion call: + QRect r = QHighDpi::toNativePixels(window->geometry()); + (Avoiding calling QWindow and instead using the QPlatformWindow geometry + might be a better course of action in this case.) */ qreal QHighDpiScaling::m_factor = 1.0; @@ -227,7 +316,7 @@ void QHighDpiScaling::setGlobalFactor(qreal factor) if (qFuzzyCompare(factor, m_factor)) return; if (!QGuiApplication::allWindows().isEmpty()) - qWarning() << Q_FUNC_INFO << "QHighDpiScaling::setFactor: Should only be called when no windows exist."; + qWarning("QHighDpiScaling::setFactor: Should only be called when no windows exist."); m_globalScalingActive = !qFuzzyCompare(factor, qreal(1)); m_factor = m_globalScalingActive ? factor : qreal(1); diff --git a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp index 2749b05691..1d59c38598 100644 --- a/src/gui/kernel/qplatformgraphicsbufferhelper.cpp +++ b/src/gui/kernel/qplatformgraphicsbufferhelper.cpp @@ -69,18 +69,18 @@ bool QPlatformGraphicsBufferHelper::lockAndBindToTexture(QPlatformGraphicsBuffer { if (graphicsBuffer->lock(QPlatformGraphicsBuffer::TextureAccess)) { if (!graphicsBuffer->bindToTexture(rect)) { - qWarning() << Q_FUNC_INFO << "Failed to bind graphicsbuffer to texture"; + qWarning("Failed to bind %sgraphicsbuffer to texture", ""); return false; } if (swizzle) *swizzle = false; } else if (graphicsBuffer->lock(QPlatformGraphicsBuffer::SWReadAccess)) { if (!bindSWToTexture(graphicsBuffer, swizzle, rect)) { - qWarning() << Q_FUNC_INFO << "Failed to bind SW graphcisbuffer to texture"; + qWarning("Failed to bind %sgraphicsbuffer to texture", "SW "); return false; } } else { - qWarning() << Q_FUNC_INFO << "Failed to lock"; + qWarning("Failed to lock"); return false; } return true; diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h index 00c50a9861..af89a73455 100644 --- a/src/gui/kernel/qplatformintegration.h +++ b/src/gui/kernel/qplatformintegration.h @@ -91,7 +91,8 @@ public: SyncState, RasterGLSurface, AllGLFunctionsQueryable, - ApplicationIcon + ApplicationIcon, + SwitchableWidgetComposition }; virtual ~QPlatformIntegration() { } diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp index 8666d0a04c..8e9767d69e 100644 --- a/src/gui/kernel/qplatformscreen.cpp +++ b/src/gui/kernel/qplatformscreen.cpp @@ -362,7 +362,7 @@ static int log2(uint i) int QPlatformScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b) { if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) { - qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation"; + qWarning("Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation", "angle"); return 0; } @@ -384,7 +384,7 @@ int QPlatformScreen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation QTransform QPlatformScreen::transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target) { if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) { - qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation"; + qWarning("Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation", "transform"); return QTransform(); } @@ -415,7 +415,7 @@ QTransform QPlatformScreen::transformBetween(Qt::ScreenOrientation a, Qt::Screen QRect QPlatformScreen::mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect) { if (a == Qt::PrimaryOrientation || b == Qt::PrimaryOrientation) { - qWarning() << "Use QScreen version of" << __FUNCTION__ << "when passing Qt::PrimaryOrientation"; + qWarning("Use QScreen version of %sBetween() when passing Qt::PrimaryOrientation", "map"); return rect; } diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index b6b50372ae..fb322ae74f 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -680,7 +680,7 @@ QPixmap QScreen::grabWindow(WId window, int x, int y, int width, int height) { const QPlatformScreen *platformScreen = handle(); if (!platformScreen) { - qWarning("%s invoked with handle==0", Q_FUNC_INFO); + qWarning("invoked with handle==0"); return QPixmap(); } return platformScreen->grabWindow(window, x, y, width, height); diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 95f0f1cc90..45e0acec63 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -369,7 +369,7 @@ void QWindowPrivate::setTopLevelScreen(QScreen *newScreen, bool recreate) { Q_Q(QWindow); if (parentWindow) { - qWarning() << this << Q_FUNC_INFO << '(' << newScreen << "): Attempt to set a screen on a child window."; + qWarning() << this << '(' << newScreen << "): Attempt to set a screen on a child window."; return; } if (newScreen != topLevelScreen) { @@ -625,7 +625,7 @@ void QWindow::setParent(QWindow *parent) QScreen *newScreen = parent ? parent->screen() : screen(); if (d->windowRecreationRequired(newScreen)) { - qWarning() << this << Q_FUNC_INFO << '(' << parent << "): Cannot change screens (" << screen() << newScreen << ')'; + qWarning() << this << '(' << parent << "): Cannot change screens (" << screen() << newScreen << ')'; return; } @@ -1186,7 +1186,7 @@ void QWindow::setTransientParent(QWindow *parent) { Q_D(QWindow); if (parent && !parent->isTopLevel()) { - qWarning() << Q_FUNC_INFO << parent << "must be a top level window."; + qWarning() << parent << "must be a top level window."; return; } diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp index 68cd8a82b4..a77d6743ad 100644 --- a/src/gui/opengl/qopengl.cpp +++ b/src/gui/opengl/qopengl.cpp @@ -184,7 +184,7 @@ struct VersionTerm { bool VersionTerm::matches(const QVersionNumber &other) const { if (isNull() || other.isNull()) { - qWarning() << Q_FUNC_INFO << "called with invalid parameters"; + qWarning("called with invalid parameters"); return false; } switch (op) { @@ -262,7 +262,7 @@ struct OsTypeTerm bool matches(const QString &osName, const QVersionNumber &kernelVersion, const QString &osRelease) const { if (isNull() || osName.isEmpty() || kernelVersion.isNull()) { - qWarning() << Q_FUNC_INFO << "called with invalid parameters"; + qWarning("called with invalid parameters"); return false; } if (type != osName) diff --git a/src/gui/opengl/qopengltextureblitter.cpp b/src/gui/opengl/qopengltextureblitter.cpp index 1c6a7937e5..9e611a160d 100644 --- a/src/gui/opengl/qopengltextureblitter.cpp +++ b/src/gui/opengl/qopengltextureblitter.cpp @@ -285,7 +285,7 @@ bool QOpenGLTextureBlitterPrivate::buildProgram(ProgramIndex idx, const char *vs p->glProgram->addShaderFromSourceCode(QOpenGLShader::Fragment, fs); p->glProgram->link(); if (!p->glProgram->isLinked()) { - qWarning() << Q_FUNC_INFO << "Could not link shader program:\n" << p->glProgram->log(); + qWarning() << "Could not link shader program:\n" << p->glProgram->log(); return false; } diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index fd9ae0aaca..5b25c2fd95 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -101,11 +101,11 @@ SSE4_1_SOURCES += painting/qdrawhelper_sse4.cpp \ painting/qimagescale_sse4.cpp AVX2_SOURCES += painting/qdrawhelper_avx2.cpp -!ios:!contains(QT_ARCH, "arm64") { +!ios { CONFIG += no_clang_integrated_as NEON_SOURCES += painting/qdrawhelper_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h - NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S + !contains(QT_ARCH, "arm64"): NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S } MIPS_DSP_SOURCES += painting/qdrawhelper_mips_dsp.cpp diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 988bee9b27..5854008ea3 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -3885,7 +3885,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData) QSpanData *data = reinterpret_cast<QSpanData *>(userData); Operator op = getOperator(data, spans, count); if (!op.funcSolid64) { - qDebug() << Q_FUNC_INFO << "unsupported 64bit blend attempted"; + qDebug("unsupported 64bit blend attempted"); return blend_color_generic(count, spans, userData); } @@ -4180,7 +4180,7 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi Operator op = getOperator(data, spans, count); if (!op.func64) { - qWarning() << Q_FUNC_INFO << "Unsupported blend"; + qWarning("Unsupported blend"); return blend_untransformed_generic(count, spans, userData); } QRgba64 buffer[buffer_size]; @@ -6309,7 +6309,7 @@ void qt_memfill16(quint16 *dest, quint16 color, int count) qt_memfill_template<quint16>(dest, color, count); } #endif -#if !defined(__SSE2__) && (!defined(__ARM_NEON__) || defined(Q_PROCESSOR_ARM_64)) +#if !defined(__SSE2__) && !defined(__ARM_NEON__) # ifdef QT_COMPILER_SUPPORTS_MIPS_DSP extern "C" void qt_memfill32_asm_mips_dsp(quint32 *, quint32, int); # endif @@ -6425,14 +6425,11 @@ void qInitDrawhelperAsm() #endif // SSE2 -#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) && !defined(Q_PROCESSOR_ARM_64) +#if defined(__ARM_NEON__) && !defined(Q_OS_IOS) 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; qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon; - 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; - qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN qBlendFunctions[QImage::Format_RGBX8888][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBX8888] = qt_blend_rgb32_on_rgb32_neon; @@ -6440,6 +6437,21 @@ void qInitDrawhelperAsm() qBlendFunctions[QImage::Format_RGBA8888_Premultiplied][QImage::Format_RGBA8888_Premultiplied] = qt_blend_argb32_on_argb32_neon; #endif + qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; + qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; + qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; + + extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data, + int y, int x, int length); + + qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; + +#if !defined(Q_PROCESSOR_ARM_64) + // 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; + qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon; + qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon; qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon; @@ -6448,19 +6460,13 @@ void qInitDrawhelperAsm() qDrawHelper[QImage::Format_RGB16].alphamapBlit = qt_alphamapblit_quint16_neon; - qt_functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon; - qt_functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon; - qt_functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon; destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon; destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon; qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon; qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon; +#endif - extern const uint * QT_FASTCALL qt_fetch_radial_gradient_neon(uint *buffer, const Operator *op, const QSpanData *data, - int y, int x, int length); - - qt_fetch_radial_gradient = qt_fetch_radial_gradient_neon; #endif #if defined(Q_PROCESSOR_MIPS_32) && defined(QT_COMPILER_SUPPORTS_MIPS_DSP) diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp index bf4758afd2..413fddcfdc 100644 --- a/src/gui/painting/qdrawhelper_neon.cpp +++ b/src/gui/painting/qdrawhelper_neon.cpp @@ -44,6 +44,7 @@ QT_BEGIN_NAMESPACE void qt_memfill32(quint32 *dest, quint32 value, int count) { const int epilogueSize = count % 16; +#if !defined(Q_PROCESSOR_ARM_64) if (count >= 16) { quint32 *const neonEnd = dest + count - epilogueSize; register uint32x4_t valueVector1 asm ("q0") = vdupq_n_u32(value); @@ -58,6 +59,22 @@ void qt_memfill32(quint32 *dest, quint32 value, int count) ); } } +#else + if (count >= 16) { + quint32 *const neonEnd = dest + count - epilogueSize; + register uint32x4_t valueVector1 asm ("v0") = vdupq_n_u32(value); + register uint32x4_t valueVector2 asm ("v1") = valueVector1; + while (dest != neonEnd) { + asm volatile ( + "st2 { v0.4s, v1.4s }, [%[DST]], #32 \n\t" + "st2 { v0.4s, v1.4s }, [%[DST]], #32 \n\t" + : [DST]"+r" (dest) + : [VALUE1]"w"(valueVector1), [VALUE2]"w"(valueVector2) + : "memory" + ); + } + } +#endif switch (epilogueSize) { @@ -118,6 +135,7 @@ static inline uint16x8_t qvsource_over_u16(uint16x8_t src16, uint16x8_t dst16, u return vaddq_u16(src16, qvbyte_mul_u16(dst16, alpha16, half)); } +#if !defined(Q_PROCESSOR_ARM_64) extern "C" void pixman_composite_over_8888_0565_asm_neon (int32_t w, int32_t h, @@ -164,7 +182,6 @@ pixman_composite_src_0565_0565_asm_neon (int32_t w, int32_t dst_stride, uint16_t *src, int32_t src_stride); - // qblendfunctions.cpp void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl, const uchar *srcPixels, int sbpl, @@ -204,6 +221,7 @@ void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl, int w, int h, int const_alpha); + template <int N> static inline void scanLineBlit16(quint16 *dst, quint16 *src, int dstride) { @@ -329,11 +347,16 @@ void qt_blend_argb32_on_rgb16_neon(uchar *destPixels, int dbpl, pixman_composite_over_8888_0565_asm_neon(w, h, dst, dbpl / 2, src, sbpl / 4); } +#endif void qt_blend_argb32_on_argb32_scanline_neon(uint *dest, const uint *src, int length, uint const_alpha) { if (const_alpha == 255) { +#if !defined(Q_PROCESSOR_ARM_64) pixman_composite_scanline_over_asm_neon(length, dest, src); +#else + qt_blend_argb32_on_argb32_neon((uchar *)dest, 4 * length, (uchar *)src, 4 * length, length, 1, 256); +#endif } else { qt_blend_argb32_on_argb32_neon((uchar *)dest, 4 * length, (uchar *)src, 4 * length, length, 1, (const_alpha * 256) / 255); } @@ -349,7 +372,51 @@ void qt_blend_argb32_on_argb32_neon(uchar *destPixels, int dbpl, uint16x8_t half = vdupq_n_u16(0x80); uint16x8_t full = vdupq_n_u16(0xff); if (const_alpha == 256) { +#if !defined(Q_PROCESSOR_ARM_64) pixman_composite_over_8888_8888_asm_neon(w, h, (uint32_t *)destPixels, dbpl / 4, (uint32_t *)srcPixels, sbpl / 4); +#else + for (int y=0; y<h; ++y) { + int x = 0; + for (; x < w-3; x += 4) { + if (src[x] | src[x+1] | src[x+2] | src[x+3]) { + uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]); + uint32x4_t dst32 = vld1q_u32((uint32_t *)&dst[x]); + + const uint8x16_t src8 = vreinterpretq_u8_u32(src32); + const uint8x16_t dst8 = vreinterpretq_u8_u32(dst32); + + const uint8x8_t src8_low = vget_low_u8(src8); + const uint8x8_t dst8_low = vget_low_u8(dst8); + + const uint8x8_t src8_high = vget_high_u8(src8); + const uint8x8_t dst8_high = vget_high_u8(dst8); + + const uint16x8_t src16_low = vmovl_u8(src8_low); + const uint16x8_t dst16_low = vmovl_u8(dst8_low); + + const uint16x8_t src16_high = vmovl_u8(src8_high); + const uint16x8_t dst16_high = vmovl_u8(dst8_high); + + const uint16x8_t result16_low = qvsource_over_u16(src16_low, dst16_low, half, full); + const uint16x8_t result16_high = qvsource_over_u16(src16_high, dst16_high, half, full); + + const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result16_low)); + const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result16_high)); + + vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high)); + } + } + for (; x<w; ++x) { + uint s = src[x]; + if (s >= 0xff000000) + dst[x] = s; + else if (s != 0) + dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } +#endif } else if (const_alpha != 0) { const_alpha = (const_alpha * 255) >> 8; uint16x8_t const_alpha16 = vdupq_n_u16(const_alpha); @@ -463,6 +530,7 @@ void qt_blend_rgb32_on_rgb32_neon(uchar *destPixels, int dbpl, } } +#if !defined(Q_PROCESSOR_ARM_64) void qt_alphamapblit_quint16_neon(QRasterBuffer *rasterBuffer, int x, int y, const QRgba64 &color, const uchar *bitmap, @@ -703,6 +771,7 @@ void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer, int x, int data[i + j] = dstBuffer[j]; } } +#endif void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha) { @@ -754,16 +823,13 @@ void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uin uint *const neonEnd = end - 3; while (dst < neonEnd) { - asm volatile ( - "vld2.8 { d0, d1 }, [%[SRC]] !\n\t" - "vld2.8 { d2, d3 }, [%[DST]]\n\t" - "vqadd.u8 q0, q0, q1\n\t" - "vst2.8 { d0, d1 }, [%[DST]] !\n\t" - : [DST]"+r" (dst), [SRC]"+r" (src) - : - : "memory", "d0", "d1", "d2", "d3", "q0", "q1" - ); - } + uint8x16_t vs = vld1q_u8((const uint8_t*)src); + const uint8x16_t vd = vld1q_u8((uint8_t*)dst); + vs = vqaddq_u8(vs, vd); + vst1q_u8((uint8_t*)dst, vs); + src += 4; + dst += 4; + }; while (dst != end) { *dst = comp_func_Plus_one_pixel(*dst, *src); @@ -802,6 +868,7 @@ void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uin } } +#if !defined(Q_PROCESSOR_ARM_64) static const int tileSize = 32; extern "C" void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count); @@ -945,6 +1012,7 @@ void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, } } } +#endif class QSimdNeon { diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp index 5f873bfe7e..4e26d8f741 100644 --- a/src/gui/painting/qplatformbackingstore.cpp +++ b/src/gui/painting/qplatformbackingstore.cpp @@ -75,8 +75,15 @@ public: ~QPlatformBackingStorePrivate() { #ifndef QT_NO_OPENGL - if (blitter) - blitter->destroy(); + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + if (ctx) { + if (textureId) + ctx->functions()->glDeleteTextures(1, &textureId); + if (blitter) + blitter->destroy(); + } else if (textureId || blitter) { + qWarning("No context current during QPlatformBackingStore destruction, OpenGL resources not released"); + } delete blitter; #endif } diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 746a51318e..2f755d0c25 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -1277,14 +1277,14 @@ int QTextEngine::shapeTextWithHarfbuzzNG(const QScriptItem &si, const ushort *st for (uint i = 0; i < num_glyphs; ++i) g.advances[i] *= stretch; } - - if (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics) { - for (uint i = 0; i < num_glyphs; ++i) - g.advances[i] = g.advances[i].round(); - } } #endif + if (!actualFontEngine->supportsSubPixelPositions() || (actualFontEngine->fontDef.styleStrategy & QFont::ForceIntegerMetrics)) { + for (uint i = 0; i < num_glyphs; ++i) + g.advances[i] = g.advances[i].round(); + } + glyphs_shaped += num_glyphs; } diff --git a/src/gui/text/qtextodfwriter.cpp b/src/gui/text/qtextodfwriter.cpp index 429e910f18..1fd20cfbef 100644 --- a/src/gui/text/qtextodfwriter.cpp +++ b/src/gui/text/qtextodfwriter.cpp @@ -279,6 +279,12 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc writer.writeAttribute(textNS, QString::fromLatin1("style-name"), QString::fromLatin1("p%1") .arg(block.blockFormatIndex())); for (QTextBlock::Iterator frag = block.begin(); !frag.atEnd(); ++frag) { + bool isHyperlink = frag.fragment().charFormat().hasProperty(QTextFormat::AnchorHref); + if (isHyperlink) { + QString value = frag.fragment().charFormat().property(QTextFormat::AnchorHref).toString(); + writer.writeStartElement(textNS, QString::fromLatin1("a")); + writer.writeAttribute(xlinkNS, QString::fromLatin1("href"), value); + } writer.writeCharacters(QString()); // Trick to make sure that the span gets no linefeed in front of it. writer.writeStartElement(textNS, QString::fromLatin1("span")); @@ -335,6 +341,9 @@ void QTextOdfWriter::writeBlock(QXmlStreamWriter &writer, const QTextBlock &bloc writer.writeCharacters(fragmentText.mid(exportedIndex)); writer.writeEndElement(); // span + writer.writeCharacters(QString()); // Trick to make sure that the span gets no linefeed behind it. + if (isHyperlink) + writer.writeEndElement(); // a } writer.writeCharacters(QString()); // Trick to make sure that the span gets no linefeed behind it. writer.writeEndElement(); // p diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 354dfeb78c..70daf55b61 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -197,7 +197,7 @@ bool QDesktopServices::openUrl(const QUrl &url) QPlatformServices *platformServices = platformIntegration->services(); if (!platformServices) { - qWarning("%s: The platform plugin does not support services.", Q_FUNC_INFO); + qWarning("The platform plugin does not support services."); return false; } return url.scheme() == QLatin1String("file") ? |