diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-12-09 01:00:42 +0100 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2018-12-09 01:00:43 +0100 |
commit | fc116049649a6aef06f07dec3d89cc5d44c41723 (patch) | |
tree | 9c545c77faa4385d50e016970dbf70c0c199f4c9 /src | |
parent | f8c5c1356465f503e1a8357ceff01bb956d51c9e (diff) | |
parent | d36a4fc19709e6047fe846b36731b59909218b6d (diff) |
Merge remote-tracking branch 'origin/5.12' into dev
Change-Id: I10ae61ec6867b38601d85d6fc34e1f6a6ba0cc11
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/tools/qstring.cpp | 21 | ||||
-rw-r--r-- | src/gui/configure.json | 101 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 14 | ||||
-rw-r--r-- | src/gui/painting/qpaintengineex.cpp | 9 | ||||
-rw-r--r-- | src/platformsupport/eglconvenience/eglconvenience.pro | 10 | ||||
-rw-r--r-- | src/platformsupport/glxconvenience/glxconvenience.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro | 2 | ||||
-rw-r--r-- | src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro | 2 | ||||
-rw-r--r-- | src/widgets/styles/qcommonstyle.cpp | 4 | ||||
-rw-r--r-- | src/widgets/util/qscroller.cpp | 1 |
10 files changed, 94 insertions, 72 deletions
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp index 5ea5aeca12..137870f64f 100644 --- a/src/corelib/tools/qstring.cpp +++ b/src/corelib/tools/qstring.cpp @@ -415,6 +415,21 @@ static bool simdTestMask(const char *&ptr, const char *end, quint32 maskval) return true; } + +static Q_ALWAYS_INLINE __m128i mm_load8_zero_extend(const void *ptr) +{ + const __m128i *dataptr = static_cast<const __m128i *>(ptr); +#if defined(__SSE4_1__) + // use a MOVQ followed by PMOVZXBW + // if AVX2 is present, these should combine into a single VPMOVZXBW instruction + __m128i data = _mm_loadl_epi64(dataptr); + return _mm_cvtepu8_epi16(data); +# else + // use MOVQ followed by PUNPCKLBW + __m128i data = _mm_loadl_epi64(dataptr); + return _mm_unpacklo_epi8(data, _mm_setzero_si128()); +# endif +} #endif // Note: ptr on output may be off by one and point to a preceding US-ASCII @@ -585,8 +600,7 @@ void qt_from_latin1(ushort *dst, const char *str, size_t size) Q_DECL_NOTHROW // we're going to read str[offset..offset+7] (8 bytes) if (str + offset + 7 < e) { - const __m128i chunk = _mm_loadl_epi64(reinterpret_cast<const __m128i *>(str + offset)); - const __m128i unpacked = _mm_unpacklo_epi8(chunk, _mm_setzero_si128()); + const __m128i unpacked = mm_load8_zero_extend(str + offset); _mm_storeu_si128(reinterpret_cast<__m128i *>(dst + offset), unpacked); offset += 8; } @@ -1044,8 +1058,7 @@ static int ucstrncmp(const QChar *a, const uchar *c, size_t l) // we'll read uc[offset..offset+7] (16 bytes) and c[offset..offset+7] (8 bytes) if (uc + offset + 7 < e) { // same, but we're using an 8-byte load - __m128i chunk = _mm_loadl_epi64((const __m128i*)(c + offset)); - __m128i secondHalf = _mm_unpacklo_epi8(chunk, nullmask); + __m128i secondHalf = mm_load8_zero_extend(c + offset); __m128i ucdata = _mm_loadu_si128((const __m128i*)(uc + offset)); __m128i result = _mm_cmpeq_epi16(secondHalf, ucdata); diff --git a/src/gui/configure.json b/src/gui/configure.json index 6a2f1fe434..7585e9c8d4 100644 --- a/src/gui/configure.json +++ b/src/gui/configure.json @@ -163,7 +163,10 @@ "sources": [ { "type": "pkgConfig", "args": "freetype2" }, { "type": "freetype", "libs": "-lfreetype", "condition": "!config.wasm" }, - { "type": "freetype", "libs": "-s USE_FREETYPE=1", "condition": "config.wasm" } + { "libs": "-s USE_FREETYPE=1", "condition": "config.wasm" } + ], + "use": [ + { "lib": "zlib", "condition": "features.system-zlib" } ] }, "fontconfig": { @@ -451,6 +454,19 @@ { "type": "pkgConfig", "args": "wayland-server" } ] }, + "xlib": { + "label": "XLib", + "test": { + "include": "X11/Xlib.h", + "main": [ + "Display *d = XOpenDisplay(NULL);", + "XCloseDisplay(d);" + ] + }, + "sources": [ + { "type": "makeSpec", "spec": "X11" } + ] + }, "x11sm": { "label": "X11 session management", "sources": [ @@ -501,16 +517,14 @@ "xcb_xlib": { "label": "XCB Xlib", "test": { - "include": [ "xcb/xcb.h", "X11/Xlib.h", "X11/Xlib-xcb.h" ], - "main": [ - "Display *dpy = XOpenDisplay(\"\");", - "(void) XGetXCBConnection(dpy);" - ] + "include": "X11/Xlib-xcb.h", + "main": "(void) XGetXCBConnection((Display *)0);" }, "sources": [ - { "type": "pkgConfig", "args": "x11-xcb x11 xcb" }, - "-lxcb -lX11 -lX11-xcb" - ] + { "type": "pkgConfig", "args": "x11-xcb" }, + "-lX11-xcb" + ], + "use": "xcb xlib" }, "xcb_xkb": { "label": "XCB XKB >= 1.10", @@ -527,14 +541,15 @@ ] }, "sources": [ - { "type": "pkgConfig", "args": "xcb-xkb >= 1.10 xcb" }, - "-lxcb-xkb -lxcb" - ] + { "type": "pkgConfig", "args": "xcb-xkb >= 1.10" }, + "-lxcb-xkb" + ], + "use": "xcb" }, "xcb_render": { "label": "XCB XRender", "test": { - "include": [ "xcb/xcb.h", "xcb/render.h" ], + "include": "xcb/render.h", "tail": [ "// 'template' is used as a function argument name in xcb_renderutil.h", "#define template template_param", @@ -547,7 +562,7 @@ "main": [ "int primaryScreen = 0;", "xcb_generic_error_t *error = 0;", - "xcb_connection_t *connection = xcb_connect(\"\", &primaryScreen);", + "xcb_connection_t *connection = 0;", "xcb_render_query_pict_formats_cookie_t formatsCookie =", " xcb_render_query_pict_formats(connection);", "xcb_render_query_pict_formats_reply_t *formatsReply =", @@ -558,17 +573,18 @@ ] }, "sources": [ - { "type": "pkgConfig", "args": "xcb-renderutil xcb-render xcb" }, - "-lxcb-render-util -lxcb-render -lxcb" - ] + { "type": "pkgConfig", "args": "xcb-renderutil xcb-render" }, + "-lxcb-render-util -lxcb-render" + ], + "use": "xcb" }, "xcb_glx": { "label": "XCB GLX", "test": { - "include": [ "xcb/xcb.h", "xcb/glx.h" ], + "include": "xcb/glx.h", "main": [ "int primaryScreen = 0;", - "xcb_connection_t *connection = xcb_connect(\"\", &primaryScreen);", + "xcb_connection_t *connection = 0;", "xcb_generic_error_t *error = 0;", "xcb_glx_query_version_cookie_t xglx_query_cookie = xcb_glx_query_version(", " connection, XCB_GLX_MAJOR_VERSION, XCB_GLX_MINOR_VERSION);", @@ -576,17 +592,17 @@ ] }, "sources": [ - { "type": "pkgConfig", "args": "xcb-glx xcb" }, - "-lxcb-glx -lxcb" - ] + { "type": "pkgConfig", "args": "xcb-glx" }, + "-lxcb-glx" + ], + "use": "xcb" }, "xcb_xinput": { "label": "XCB XInput", "test": { - "include": [ "xcb/xcb.h", "xcb/xinput.h" ], + "include": "xcb/xinput.h", "main": [ - "int primaryScreen = 0;", - "xcb_connection_t *connection = xcb_connect(\"\", &primaryScreen);", + "xcb_connection_t *connection = 0;", "xcb_generic_error_t *error = 0;", "xcb_input_xi_query_version_cookie_t xinput_query_cookie = xcb_input_xi_query_version(", " connection, XCB_INPUT_MAJOR_VERSION, XCB_INPUT_MINOR_VERSION);", @@ -594,9 +610,10 @@ ] }, "sources": [ - { "type": "pkgConfig", "args": "xcb-xinput >= 1.12 xcb" }, - "-lxcb-xinput -lxcb" - ] + { "type": "pkgConfig", "args": "xcb-xinput >= 1.12" }, + "-lxcb-xinput" + ], + "use": "xcb" }, "xkbcommon": { "label": "xkbcommon >= 0.5.0", @@ -623,7 +640,8 @@ "test": "x11/xrender", "sources": [ "-lXrender" - ] + ], + "use": "xlib" } }, @@ -697,7 +715,7 @@ "// window and pixmap types will be different than what an X-based platform", "// plugin would expect." ], - "include": [ "EGL/egl.h", "xcb/xcb.h", "X11/Xlib.h", "X11/Xlib-xcb.h" ], + "include": [ "EGL/egl.h", "X11/Xlib.h" ], "main": [ "Display *dpy = EGL_DEFAULT_DISPLAY;", "EGLNativeDisplayType egldpy = XOpenDisplay(\"\");", @@ -707,7 +725,7 @@ "XCloseDisplay(dpy);" ] }, - "use": "egl xcb_xlib" + "use": "egl xlib" }, "egl-brcm": { "label": "Broadcom EGL (Raspberry Pi)", @@ -910,18 +928,6 @@ "pkg-config-variable": "prefix", "value": "/usr", "log": "value" - }, - "xlib": { - "label": "XLib", - "type": "compile", - "test": { - "include": "X11/Xlib.h", - "main": [ - "Display *d = XOpenDisplay(NULL);", - "XCloseDisplay(d);" - ], - "qmake": "CONFIG += x11" - } } }, @@ -1223,6 +1229,11 @@ "condition": "config.integrity && features.eglfs && tests.egl-openwfd", "output": [ "privateFeature" ] }, + "eglfs_x11": { + "label": "EGLFS X11", + "condition": "features.eglfs && features.xcb && features.xcb-xlib && features.egl_x11", + "output": [ "privateFeature" ] + }, "gif": { "label": "GIF", "condition": "features.imageformatplugin", @@ -1371,7 +1382,7 @@ "xlib": { "label": "XLib", "autoDetect": "!config.darwin || features.xcb", - "condition": "tests.xlib", + "condition": "libs.xlib", "output": [ "privateFeature" ] }, "texthtmlparser": { @@ -1703,7 +1714,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla "section": "EGLFS details", "condition": "features.eglfs", "entries": [ - "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_vsp2", "eglfs_mali", "eglfs_brcm", "egl_x11" + "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_vsp2", "eglfs_mali", "eglfs_brcm", "eglfs_x11" ] }, "linuxfb", "vnc", "mirclient", diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index da963adae6..0105f1decd 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -149,10 +149,7 @@ QImageData * QImageData::create(const QSize &size, QImage::Format format) d->bytes_per_line = params.bytesPerLine; d->nbytes = params.totalSize; - if (depth == 64) - d->data = (uchar *)new (std::nothrow) quint64[d->nbytes / sizeof(quint64)]; - else // nbytes is known to already be a multipla of 4: - d->data = (uchar *)new (std::nothrow) quint32[d->nbytes / sizeof(quint32)]; + d->data = (uchar *)malloc(d->nbytes); if (!d->data) return nullptr; @@ -168,13 +165,8 @@ QImageData::~QImageData() if (is_cached) QImagePixmapCleanupHooks::executeImageHooks((((qint64) ser_no) << 32) | ((qint64) detach_no)); delete paintEngine; - if (data && own_data) { - // Casting to avoid being theoretically UB: - if (depth == 64) - delete[] (quint64 *)data; - else - delete[] (quint32 *)data; - } + if (data && own_data) + free(data); data = 0; } diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 81ce5c60c5..880423ca3b 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -1093,9 +1093,14 @@ bool QPaintEngineEx::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTran if (fontEngine->glyphFormat == QFontEngine::Format_ARGB) return true; + static const int maxCachedGlyphSizeSquared = std::pow([]{ + if (int env = qEnvironmentVariableIntValue("QT_MAX_CACHED_GLYPH_SIZE")) + return env; + return QT_MAX_CACHED_GLYPH_SIZE; + }(), 2); + qreal pixelSize = fontEngine->fontDef.pixelSize; - return (pixelSize * pixelSize * qAbs(m.determinant())) < - QT_MAX_CACHED_GLYPH_SIZE * QT_MAX_CACHED_GLYPH_SIZE; + return (pixelSize * pixelSize * qAbs(m.determinant())) < maxCachedGlyphSizeSquared; } QT_END_NAMESPACE diff --git a/src/platformsupport/eglconvenience/eglconvenience.pro b/src/platformsupport/eglconvenience/eglconvenience.pro index 4301d63574..df21f14697 100644 --- a/src/platformsupport/eglconvenience/eglconvenience.pro +++ b/src/platformsupport/eglconvenience/eglconvenience.pro @@ -26,15 +26,15 @@ qtConfig(opengl) { qeglpbuffer.cpp } -# Avoid X11 header collision, use generic EGL native types -DEFINES += QT_EGL_NO_X11 - -qtConfig(xlib) { +qtConfig(egl_x11) { HEADERS += \ qxlibeglintegration_p.h SOURCES += \ qxlibeglintegration.cpp - LIBS_PRIVATE += $$QMAKE_LIBS_X11 + QMAKE_USE_PRIVATE += xlib +} else { + # Avoid X11 header collision, use generic EGL native types + DEFINES += QT_EGL_NO_X11 } CONFIG += egl diff --git a/src/platformsupport/glxconvenience/glxconvenience.pro b/src/platformsupport/glxconvenience/glxconvenience.pro index 58fa9fc479..8367dc5e31 100644 --- a/src/platformsupport/glxconvenience/glxconvenience.pro +++ b/src/platformsupport/glxconvenience/glxconvenience.pro @@ -6,7 +6,7 @@ CONFIG += static internal_module DEFINES += QT_NO_CAST_FROM_ASCII -LIBS_PRIVATE += $$QMAKE_LIBS_X11 +QMAKE_USE_PRIVATE += xlib HEADERS += qglxconvenience_p.h SOURCES += qglxconvenience.cpp diff --git a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro index 919ecd01f6..360536d22f 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/deviceintegration.pro @@ -1,7 +1,7 @@ TEMPLATE = subdirs QT_FOR_CONFIG += gui-private -qtConfig(egl_x11): SUBDIRS += eglfs_x11 +qtConfig(eglfs_x11): SUBDIRS += eglfs_x11 qtConfig(eglfs_gbm): SUBDIRS *= eglfs_kms_support eglfs_kms qtConfig(eglfs_egldevice): SUBDIRS *= eglfs_kms_support eglfs_kms_egldevice qtConfig(eglfs_vsp2): SUBDIRS += eglfs_kms_vsp2 diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro index acbd1cc785..6b55918f03 100644 --- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro +++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_x11/eglfs_x11.pro @@ -8,7 +8,7 @@ DEFINES += QT_EGL_NO_X11 INCLUDEPATH += $$PWD/../../api CONFIG += egl -QMAKE_USE += xcb_xlib +QMAKE_USE += xcb_xlib xcb xlib SOURCES += $$PWD/qeglfsx11main.cpp \ $$PWD/qeglfsx11integration.cpp diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp index ccf4252b79..9aec4f3aa4 100644 --- a/src/widgets/styles/qcommonstyle.cpp +++ b/src/widgets/styles/qcommonstyle.cpp @@ -1657,7 +1657,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, alignment |= Qt::TextHideMnemonic; if (toolbutton->toolButtonStyle == Qt::ToolButtonTextUnderIcon) { - pr.setHeight(pmSize.height() + 6); + pr.setHeight(pmSize.height() + 4); //### 4 is currently hardcoded in QToolButton::sizeHint() tr.adjust(0, pr.height() - 1, 0, -1); pr.translate(shiftX, shiftY); if (!hasArrow) { @@ -1667,7 +1667,7 @@ void QCommonStyle::drawControl(ControlElement element, const QStyleOption *opt, } alignment |= Qt::AlignCenter; } else { - pr.setWidth(pmSize.width() + 8); + pr.setWidth(pmSize.width() + 4); //### 4 is currently hardcoded in QToolButton::sizeHint() tr.adjust(pr.width(), 0, 0, 0); pr.translate(shiftX, shiftY); if (!hasArrow) { diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp index abb203b8cc..1e84237253 100644 --- a/src/widgets/util/qscroller.cpp +++ b/src/widgets/util/qscroller.cpp @@ -488,6 +488,7 @@ QScroller::QScroller(QObject *target) : d_ptr(new QScrollerPrivate(this, target)) { Q_ASSERT(target); // you can't create a scroller without a target in any normal way + setParent(target); Q_D(QScroller); d->init(); } |