summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2016-09-15 19:47:57 +0200
committerLiang Qi <liang.qi@qt.io>2016-09-15 19:47:57 +0200
commit40a1f69e8663fb79560c26cfad5ead45b1b3ee5f (patch)
treea8ceb093a098a38b29c0fe27e41af480ae10b876 /src/gui
parent446afc10451d5097d7bd20b1b8d20325c4d54fa5 (diff)
parent6b2071c697d4c48f0cd289b28b443ebffc3432e6 (diff)
Merge remote-tracking branch 'origin/5.8' into dev
Conflicts: configure.json mkspecs/macx-tvos-clang/qmake.conf mkspecs/macx-watchos-clang/qmake.conf Change-Id: Iaf32339ace59dff9ed344972472744c55d75025c
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json1095
-rw-r--r--src/gui/configure.pri67
-rw-r--r--src/gui/image/qicon.cpp47
-rw-r--r--src/gui/image/qiconloader.cpp2
-rw-r--r--src/gui/kernel/qtguiglobal.h1
-rw-r--r--src/gui/kernel/qtguiglobal_p.h1
-rw-r--r--src/gui/kernel/qwindow.cpp3
-rw-r--r--src/gui/kernel/qwindow_p.h10
-rw-r--r--src/gui/opengl/qopengl.h7
-rw-r--r--src/gui/opengl/qopenglframebufferobject.cpp2
-rw-r--r--src/gui/painting/painting.pri1
-rw-r--r--src/gui/painting/qcolor.cpp323
-rw-r--r--src/gui/painting/qcolor_p.cpp369
-rw-r--r--src/gui/painting/qdrawhelper.cpp184
-rw-r--r--src/gui/painting/qdrawhelper_p.h16
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp9
-rw-r--r--src/gui/painting/qdrawingprimitive_sse2_p.h24
-rw-r--r--src/gui/text/qfontdatabase.cpp11
-rw-r--r--src/gui/text/qplatformfontdatabase.cpp6
-rw-r--r--src/gui/text/qtextimagehandler.cpp4
20 files changed, 1651 insertions, 531 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
new file mode 100644
index 0000000000..376359ba37
--- /dev/null
+++ b/src/gui/configure.json
@@ -0,0 +1,1095 @@
+{
+ "module": "gui",
+ "depends": [
+ "core"
+ ],
+ "testDir": "../../config.tests",
+
+ "commandline": {
+ "options": {
+ "angle": "boolean",
+ "directfb": "boolean",
+ "directwrite": "boolean",
+ "egl": "boolean",
+ "eglfs": "boolean",
+ "evdev": "boolean",
+ "fontconfig": "boolean",
+ "freetype": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "gbm": "boolean",
+ "gif": "boolean",
+ "harfbuzz": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "ico": "boolean",
+ "imf": { "type": "boolean", "name": "qqnx_imf" },
+ "kms": "boolean",
+ "lgmon": "boolean",
+ "libinput": "boolean",
+ "libjpeg": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "libpng": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "linuxfb": "boolean",
+ "mirclient": "boolean",
+ "mtdev": "boolean",
+ "opengl": { "type": "optionalString", "values": [ "no", "yes", "desktop", "es2", "dynamic" ] },
+ "opengl-es-2": { "type": "void", "name": "opengl", "value": "es2" },
+ "opengles3": "boolean",
+ "qpa": { "type": "string", "name": "qpa_default_platform" },
+ "qpa-platform-guard": "boolean",
+ "sm": { "type": "boolean", "name": "sessionmanager" },
+ "tslib": "boolean",
+ "xcb": { "type": "enum", "values": [ "no", "yes", "qt", "system" ] },
+ "xcb-xlib": "boolean",
+ "xinput2": "boolean",
+ "xkb": "boolean",
+ "xkb-config-root": "string",
+ "xkbcommon": { "type": "enum", "values": [ "no", "qt", "system" ] },
+ "xkbcommon-evdev": "boolean",
+ "xkbcommon-x11": { "type": "enum", "name": "xkbcommon", "values": [ "no", "qt", "system" ] },
+ "xrender": "boolean"
+ }
+ },
+
+ "libraries": {
+ "bcm_host": {
+ "export": "",
+ "sources": [
+ "-lbcm_host"
+ ]
+ },
+ "directfb": {
+ "label": "DirectFB",
+ "test": "qpa/directfb",
+ "sources": [
+ { "type": "pkgConfig", "args": "directfb" }
+ ]
+ },
+ "directwrite": {
+ "label": "DirectWrite",
+ "export": "",
+ "test": "win/directwrite",
+ "sources": [
+ "-ldwrite"
+ ]
+ },
+ "drm": {
+ "label": "KMS",
+ "test": "qpa/kms",
+ "sources": [
+ { "type": "pkgConfig", "args": "libdrm" },
+ "-ldrm"
+ ]
+ },
+ "egl": {
+ "label": "EGL",
+ "test": "qpa/egl",
+ "sources": [
+ { "type": "pkgConfig", "args": "egl" },
+ { "type": "makeSpec", "spec": "EGL" }
+ ]
+ },
+ "freetype": {
+ "label": "FreeType",
+ "export": "",
+ "test": "unix/freetype",
+ "sources": [
+ "-lfreetype"
+ ]
+ },
+ "fontconfig": {
+ "label": "Fontconfig",
+ "test": "unix/fontconfig",
+ "sources": [
+ { "type": "pkgConfig", "args": "fontconfig freetype2" },
+ "-lfontconfig -lfreetype"
+ ]
+ },
+ "gbm": {
+ "label": "GBM",
+ "test": "qpa/gbm",
+ "sources": [
+ { "type": "pkgConfig", "args": "gbm" }
+ ]
+ },
+ "harfbuzz": {
+ "label": "HarfBuzz",
+ "test": "unix/harfbuzz",
+ "sources": [
+ "-lharfbuzz"
+ ]
+ },
+ "imf": {
+ "label": "IMF",
+ "export": "",
+ "test": "unix/qqnx_imf",
+ "sources": [
+ "-linput_client"
+ ]
+ },
+ "lgmon": {
+ "label": "lgmon",
+ "test": "unix/lgmon",
+ "sources": [
+ "-llgmon"
+ ]
+ },
+ "libinput": {
+ "label": "libinput",
+ "test": "unix/libinput",
+ "sources": [
+ { "type": "pkgConfig", "args": "libinput" }
+ ]
+ },
+ "libjpeg": {
+ "label": "libjpeg",
+ "test": "unix/libjpeg",
+ "sources": [
+ { "libs": "-llibjpeg", "condition": "config.msvc" },
+ { "libs": "-ljpeg", "condition": "!config.msvc" }
+ ]
+ },
+ "libpng": {
+ "label": "libpng",
+ "test": "unix/libpng",
+ "sources": [
+ { "type": "pkgConfig", "args": "libpng" },
+ { "libs": "-llibpng", "condition": "config.msvc" },
+ { "libs": "-lpng", "condition": "!config.msvc" }
+ ]
+ },
+ "mirclient": {
+ "label": "Mir client libraries",
+ "export": "",
+ "test": "qpa/mirclient",
+ "sources": [
+ { "type": "pkgConfig", "args": "egl mirclient ubuntu-platform-api" }
+ ]
+ },
+ "mtdev": {
+ "label": "mtdev",
+ "export": "",
+ "test": "unix/mtdev",
+ "sources": [
+ { "type": "pkgConfig", "args": "mtdev" }
+ ]
+ },
+ "opengl": {
+ "label": "Desktop OpenGL",
+ "test": "unix/opengldesktop",
+ "sources": [
+ { "type": "pkgConfig", "args": "gl" },
+ { "type": "makeSpec", "spec": "OPENGL" }
+ ]
+ },
+ "opengl_es2": {
+ "label": "OpenGL ES 2.0",
+ "test": "unix/opengles2",
+ "sources": [
+ { "type": "pkgConfig", "args": "glesv2" },
+ { "type": "makeSpec", "spec": "OPENGL_ES2" }
+ ]
+ },
+ "tslib": {
+ "label": "tslib",
+ "test": "unix/tslib",
+ "sources": [
+ "-lts"
+ ]
+ },
+ "wayland_server": {
+ "label": "Wayland Server",
+ "export": "",
+ "test": "qpa/wayland-server",
+ "sources": [
+ { "type": "pkgConfig", "args": "wayland-server" }
+ ]
+ },
+ "x11sm": {
+ "label": "X11 session management",
+ "sources": [
+ { "type": "pkgConfig", "args": "sm ice" }
+ ]
+ },
+ "xcb": {
+ "label": "XCB >= 1.5 (core)",
+ "test": "qpa/xcb",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb >= 1.5" },
+ "-lxcb"
+ ]
+ },
+ "xcb_syslibs": {
+ "label": "XCB (secondary)",
+ "test": "qpa/xcb-syslibs",
+ "sources": [
+ { "type": "pkgConfig",
+ "args": "xcb xcb-shm xcb-sync xcb-xfixes xcb-randr xcb-image xcb-keysyms xcb-icccm xcb-shape" },
+ "-lxcb -lxcb-shm -lxcb-sync -lxcb-xfixes -lxcb-randr -lxcb-image -lxcb-keysyms -lxcb-icccm -lxcb-shape"
+ ]
+ },
+ "xcb_xlib": {
+ "label": "XCB Xlib",
+ "test": "qpa/xcb-xlib",
+ "sources": [
+ { "type": "pkgConfig", "args": "X11-xcb x11 xcb" },
+ "-lxcb -lX11 -lX11-xcb"
+ ]
+ },
+ "xcb_xkb": {
+ "label": "XCB XKB >= 1.10",
+ "test": "qpa/xcb-xkb",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-xkb >= 1.10 xcb" },
+ "-lxcb-xkb -lxcb"
+ ]
+ },
+ "xcb_render": {
+ "label": "XCB XRender",
+ "test": "qpa/xcb-render",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-renderutil xcb-render xcb" },
+ "-lxcb-render-util -lxcb-render -lxcb"
+ ]
+ },
+ "xcb_glx": {
+ "label": "XCB GLX",
+ "test": "qpa/xcb-glx",
+ "sources": [
+ { "type": "pkgConfig", "args": "xcb-glx xcb" },
+ "-lxcb-glx -lxcb"
+ ]
+ },
+ "xinput2": {
+ "label": "Xinput2",
+ "test": "x11/xinput2",
+ "sources": [
+ { "type": "pkgConfig", "args": "xi" },
+ "-lXi"
+ ]
+ },
+ "xkbcommon": {
+ "label": "xkbcommon",
+ "export": "xkbcommon_evdev",
+ "test": "unix/xkbcommon",
+ "sources": [
+ { "type": "pkgConfig", "args": "xkbcommon" }
+ ]
+ },
+ "xkbcommon_x11": {
+ "label": "xkbcommon-x11 >= 0.4.1",
+ "export": "xkbcommon",
+ "sources": [
+ { "type": "pkgConfig", "args": "xkbcommon xkbcommon-x11 >= 0.4.1" }
+ ]
+ },
+ "xrender": {
+ "label": "XRender",
+ "test": "x11/xrender",
+ "sources": [
+ "-lXrender"
+ ]
+ }
+ },
+
+ "testTypeAliases": {
+ "files": [ "directX" ],
+ "getPkgConfigVariable": [ "xkbConfigRoot" ]
+ },
+
+ "tests": {
+ "direct2d": {
+ "label": "Direct 2D",
+ "type": "compile",
+ "test": "qpa/direct2d",
+ "use": "direct2d"
+ },
+ "directwrite2": {
+ "label": "DirectWrite 2",
+ "type": "compile",
+ "test": "win/directwrite2",
+ "use": "directwrite"
+ },
+ "directx": {
+ "label": "DirectX SDK",
+ "type": "directX",
+ "files": [
+ "d3dcompiler.h",
+ "d3d11.lib",
+ "fxc.exe"
+ ]
+ },
+ "egl-x11": {
+ "label": "EGL on X11",
+ "type": "compile",
+ "test": "qpa/egl-x11",
+ "use": "egl xcb_xlib"
+ },
+ "egl-brcm": {
+ "label": "Broadcom EGL (Rasberry Pi)",
+ "type": "compile",
+ "test": "qpa/eglfs-brcm",
+ "use": "egl bcm_host"
+ },
+ "egl-egldevice": {
+ "label": "EGLDevice",
+ "type": "compile",
+ "test": "qpa/eglfs-egldevice",
+ "use": "egl"
+ },
+ "egl-mali": {
+ "label": "Mali EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-mali",
+ "use": "egl"
+ },
+ "egl-mali-2": {
+ "label": "Mali 2 EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-mali-2",
+ "use": "egl"
+ },
+ "egl-viv": {
+ "label": "i.Mx6 EGL",
+ "type": "compile",
+ "test": "qpa/eglfs-viv",
+ "use": "egl"
+ },
+ "evdev": {
+ "label": "evdev",
+ "type": "compile",
+ "test": "unix/evdev"
+ },
+ "linuxfb": {
+ "label": "LinuxFB",
+ "type": "compile",
+ "test": "qpa/linuxfb"
+ },
+ "opengles3": {
+ "label": "OpenGL ES 3.0",
+ "type": "compile",
+ "test": "unix/opengles3",
+ "use": "opengl_es2"
+ },
+ "opengles31": {
+ "label": "OpenGL ES 3.1",
+ "type": "compile",
+ "test": "unix/opengles31",
+ "use": "opengl_es2"
+ },
+ "qpa_default_platform": {
+ "label": "default QPA platform",
+ "type": "qpaDefaultPlatform",
+ "log": "value"
+ },
+ "x11prefix": {
+ "label": "X11 prefix",
+ "type": "getPkgConfigVariable",
+ "pkg-config-args": "x11",
+ "pkg-config-variable": "prefix",
+ "value": "/usr",
+ "log": "value"
+ },
+ "xkbconfigroot": {
+ "label": "XKB config root",
+ "type": "xkbConfigRoot",
+ "pkg-config-args": "xkeyboard-config",
+ "pkg-config-variable": "xkb_base",
+ "log": "value"
+ },
+ "xlib": {
+ "label": "XLib",
+ "type": "compile",
+ "test": "x11/xlib"
+ }
+ },
+
+ "features": {
+ "accessibility-atspi-bridge": {
+ "label": "ATSPI Bridge",
+ "condition": "features.accessibility && features.xcb && features.dbus",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "angle": {
+ "label": "ANGLE",
+ "autoDetect": "features.opengles2 || features.opengl-dynamic",
+ "condition": "config.win32 && tests.directx",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_2_ANGLE" }
+ ]
+ },
+ "directfb": {
+ "label": "DirectFB",
+ "autoDetect": false,
+ "condition": "libs.directfb",
+ "output": [ "privateFeature" ]
+ },
+ "directwrite": {
+ "label": "DirectWrite",
+ "emitIf": "config.win32",
+ "condition": "libs.directwrite",
+ "output": [ "privateFeature" ]
+ },
+ "directwrite2": {
+ "label": "DirectWrite 2",
+ "emitIf": "config.win32",
+ "condition": "features.directwrite && tests.directwrite2",
+ "output": [ "privateFeature" ]
+ },
+ "direct2d": {
+ "label": "Direct 2D",
+ "autoDetect": false,
+ "condition": "tests.direct2d",
+ "output": [ "privateFeature" ]
+ },
+ "evdev": {
+ "label": "evdev",
+ "condition": "tests.evdev",
+ "output": [ "privateFeature" ]
+ },
+ "freetype": {
+ "label": "FreeType",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "system-freetype": {
+ "label": " Using system FreeType",
+ "enable": "input.freetype == 'system'",
+ "disable": "input.freetype == 'qt'",
+ "autoDetect": "!config.win32",
+ "condition": "features.freetype && libs.freetype",
+ "output": [ "privateFeature" ]
+ },
+ "fontconfig": {
+ "label": "Fontconfig",
+ "condition": "!config.win32 && !config.darwin && features.system-freetype && libs.fontconfig",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "gbm": {
+ "label": "GBM",
+ "condition": "libs.gbm",
+ "output": [ "publicQtConfig" ]
+ },
+ "harfbuzz": {
+ "label": "HarfBuzz",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "system-harfbuzz": {
+ "label": " Using system HarfBuzz",
+ "enable": "input.harfbuzz == 'system'",
+ "disable": "input.harfbuzz == 'qt'",
+ "autoDetect": "!config.darwin && !config.win32",
+ "condition": "features.harfbuzz && libs.harfbuzz",
+ "output": [ "privateFeature" ]
+ },
+ "qqnx_imf": {
+ "label": "IMF",
+ "emitIf": "config.qnx",
+ "condition": "libs.imf",
+ "output": [ "privateConfig" ]
+ },
+ "integrityfb": {
+ "label": "INTEGRITY framebuffer",
+ "condition": "config.integrity",
+ "output": [ "privateFeature" ]
+ },
+ "kms": {
+ "label": "KMS",
+ "condition": "libs.drm",
+ "output": [ "publicQtConfig" ]
+ },
+ "libinput": {
+ "label": "libinput",
+ "condition": "features.libudev && libs.libinput",
+ "output": [ "privateFeature" ]
+ },
+ "lgmon": {
+ "label": "lgmon",
+ "emitIf": "config.qnx",
+ "condition": "libs.lgmon",
+ "output": [ "privateConfig" ]
+ },
+ "linuxfb": {
+ "label": "LinuxFB",
+ "condition": "tests.linuxfb",
+ "output": [ "privateFeature" ]
+ },
+ "mirclient": {
+ "label": "Mir client",
+ "condition": "libs.mirclient",
+ "output": [ "privateFeature" ]
+ },
+ "mtdev": {
+ "label": "mtdev",
+ "condition": "libs.mtdev",
+ "output": [ "privateFeature" ]
+ },
+ "opengles2": {
+ "label": "OpenGL ES 2.0",
+ "enable": "input.opengl == 'es2'",
+ "disable": "input.opengl == 'desktop' || input.opengl == 'dynamic' || input.opengl == 'no'",
+ "condition": "config.win32 || (!config.watchos && !features.opengl-desktop && libs.opengl_es2)",
+ "output": [
+ "publicFeature",
+ "publicQtConfig",
+ { "type": "define", "name": "QT_OPENGL_ES" },
+ { "type": "define", "name": "QT_OPENGL_ES_2" }
+ ]
+ },
+ "opengles3": {
+ "label": "OpenGL ES 3.0",
+ "condition": "features.opengles2 && !features.angle && tests.opengles3",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_3" }
+ ]
+ },
+ "opengles31": {
+ "label": "OpenGL ES 3.1",
+ "condition": "features.opengles3 && tests.opengles31",
+ "output": [
+ "publicFeature",
+ { "type": "define", "name": "QT_OPENGL_ES_3_1" }
+ ]
+ },
+ "opengl-desktop": {
+ "label": "Desktop OpenGL",
+ "enable": "input.opengl == 'desktop'",
+ "disable": "input.opengl == 'es2' || input.opengl == 'dynamic' || input.opengl == 'no'",
+ "condition": "(config.win32 && !config.winrt && !features.opengles2 && (config.msvc || libs.opengl))
+ || (!config.watchos && !config.win32 && libs.opengl)"
+ },
+ "opengl-dynamic": {
+ "label": "Dynamic OpenGL",
+ "enable": "input.opengl == 'dynamic'",
+ "autoDetect": false,
+ "condition": "config.win32 && !config.winrt",
+ "output": [
+ { "type": "publicFeature", "name": "dynamicgl" },
+ { "type": "define", "name": "QT_OPENGL_DYNAMIC" }
+ ]
+ },
+ "opengl": {
+ "label": "OpenGL",
+ "condition": "features.opengl-desktop || features.opengl-dynamic || features.opengles2",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "egl": {
+ "label": "EGL",
+ "condition": "features.opengl && (features.angle || libs.egl)",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "egl_x11": {
+ "label": "EGL on X11",
+ "condition": "features.egl && tests.egl-x11",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs": {
+ "label": "EGLFS",
+ "autoDetect": "!config.android && !config.win32",
+ "condition": "features.egl",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_brcm": {
+ "label": "EGLFS Rasberry Pi",
+ "condition": "features.eglfs && tests.egl-brcm",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_egldevice": {
+ "label": "EGLFS EGLDevice",
+ "condition": "features.eglfs && tests.egl-egldevice && features.kms",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_gbm": {
+ "label": "EGLFS GBM",
+ "condition": "features.eglfs && features.gbm && features.kms",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_mali": {
+ "label": "EGLFS Mali",
+ "condition": "features.eglfs && (tests.egl-mali || tests.egl-mali-2)",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_viv": {
+ "label": "EGLFS i.Mx6",
+ "condition": "features.eglfs && tests.egl-viv",
+ "output": [ "privateFeature" ]
+ },
+ "eglfs_viv_wl": {
+ "label": "EGLFS i.Mx6 Wayland",
+ "condition": "features.eglfs_viv && libs.wayland_server",
+ "output": [ "privateFeature" ]
+ },
+ "gif": {
+ "label": "GIF",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_GIF" }
+ ]
+ },
+ "ico": {
+ "label": "ICO",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "jpeg": {
+ "label": "JPEG",
+ "disable": "input.libjpeg == 'no'",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_JPEG" }
+ ]
+ },
+ "system-jpeg": {
+ "label": " Using system libjpeg",
+ "disable": "input.libjpeg == 'qt'",
+ "enable": "input.libjpeg == 'system'",
+ "condition": "features.jpeg && libs.libjpeg",
+ "output": [ "privateFeature" ]
+ },
+ "png": {
+ "label": "PNG",
+ "disable": "input.libpng == 'no'",
+ "output": [
+ "privateFeature",
+ { "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_PNG" }
+ ]
+ },
+ "system-png": {
+ "label": " Using system libpng",
+ "disable": "input.libpng == 'qt'",
+ "enable": "input.libpng == 'system'",
+ "condition": "features.png && libs.libpng",
+ "output": [ "privateFeature" ]
+ },
+ "qpa_default_platform": {
+ "label": "QPA default platform",
+ "condition": "features.gui",
+ "output": [
+ { "type": "define", "name": "QT_QPA_DEFAULT_PLATFORM_NAME", "value": "tests.qpa_default_platform.name" },
+ { "type": "varAssign", "public": true, "name": "QT_DEFAULT_QPA_PLUGIN", "value": "tests.qpa_default_platform.plugin",
+ "condition": "!features.shared" }
+ ]
+ },
+ "sessionmanager": {
+ "label": "Session Management",
+ "purpose": "Provides an interface to the windowing system's session management.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tslib": {
+ "label": "tslib",
+ "condition": "libs.tslib",
+ "output": [ "privateFeature" ]
+ },
+ "xcb": {
+ "label": "XCB",
+ "autoDetect": "!config.darwin",
+ "condition": "libs.xcb",
+ "output": [ "privateFeature" ]
+ },
+ "system-xcb": {
+ "label": "Using system provided XCB libraries",
+ "enable": "input.xcb == 'system' || input.xcb == 'yes'",
+ "disable": "input.xcb == 'qt' || input.xcb == 'no'",
+ "autoDetect": "!config.darwin",
+ "condition": "libs.xcb && libs.xcb_syslibs",
+ "output": [ "privateFeature" ]
+ },
+ "x11-prefix": {
+ "label": "X11 prefix",
+ "emitIf": "features.xcb",
+ "output": [ { "type": "varAssign", "name": "QMAKE_X11_PREFIX", "value": "tests.x11prefix.value" } ]
+ },
+ "xcb-glx": {
+ "label": "XCB GLX",
+ "emitIf": "features.xcb",
+ "condition": "libs.xcb_glx",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-render": {
+ "label": "XCB render",
+ "emitIf": "features.system-xcb",
+ "condition": "libs.xcb_render",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-xlib": {
+ "label": "XCB Xlib",
+ "emitIf": "features.xcb",
+ "condition": "libs.xcb_xlib",
+ "output": [ "privateFeature" ]
+ },
+ "xcb-sm": {
+ "label": "xcb-sm",
+ "emitIf": "features.xcb",
+ "condition": "features.sessionmanager && libs.x11sm",
+ "output": [ "privateFeature" ]
+ },
+ "xinput2": {
+ "label": "Xinput2",
+ "condition": "libs.xinput2",
+ "output": [ "privateFeature" ]
+ },
+ "xkbcommon-evdev": {
+ "label": "xkbcommon-evdev",
+ "condition": "libs.xkbcommon",
+ "output": [ "privateFeature" ]
+ },
+ "xkbcommon-system": {
+ "label": "Using system-provided xkbcommon",
+ "emitIf": "features.xcb",
+ "enable": "input.xkbcommon == 'system'",
+ "disable": "input.xkbcommon == 'qt' || input.xkbcommon == 'no'",
+ "condition": "libs.xkbcommon_x11",
+ "output": [ "privateFeature" ]
+ },
+ "xkb": {
+ "label": "XCB XKB",
+ "condition": "features.system-xcb && libs.xcb_xkb",
+ "output": [ "privateFeature" ]
+ },
+ "xkb-config-root": {
+ "label": "XKB config root",
+ "emitIf": "features.xcb",
+ "condition": "features.xcb && !features.xkbcommon-system && tests.xkbconfigroot",
+ "output": [ { "type": "varAssign", "name": "QMAKE_XKB_CONFIG_ROOT", "value": "tests.xkbconfigroot.value"} ]
+ },
+ "xlib": {
+ "label": "XLib",
+ "condition": "tests.xlib",
+ "output": [ "privateFeature" ]
+ },
+ "xrender": {
+ "label": "Xrender",
+ "condition": "libs.xrender",
+ "output": [ "privateFeature", "feature" ]
+ },
+ "texthtmlparser": {
+ "label": "HtmlParser",
+ "purpose": "Provides a parser for HTML.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "textodfwriter": {
+ "label": "OdfWriter",
+ "purpose": "Provides an ODF writer.",
+ "section": "Kernel",
+ "condition": "features.xmlstreamwriter",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "cssparser": {
+ "label": "CssParser",
+ "purpose": "Provides a parser for Cascading Style Sheets.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "draganddrop": {
+ "label": "Drag and Drop",
+ "purpose": "Supports the drag and drop mechansim.",
+ "section": "Kernel",
+ "condition": "features.imageformat_xpm",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "shortcut": {
+ "label": "QShortcut",
+ "purpose": "Provides keyboard accelerators and shortcuts.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "action": {
+ "label": "QAction",
+ "purpose": "Provides widget actions.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "cursor": {
+ "label": "QCursor",
+ "purpose": "Provides mouse cursors.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "clipboard": {
+ "label": "QClipboard",
+ "purpose": "Provides cut and paste operations.",
+ "section": "Kernel",
+ "condition": "!config.integrity && !config.qnx",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "wheelevent": {
+ "label": "QWheelEvent",
+ "purpose": "Supports wheel events.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "tabletevent": {
+ "label": "QTabletEvent",
+ "purpose": "Supports tablet events.",
+ "section": "Kernel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "im": {
+ "label": "QInputContext",
+ "purpose": "Provides complex input methods.",
+ "section": "Kernel",
+ "condition": "features.library",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "validator": {
+ "label": "QValidator",
+ "purpose": "Supports validation of input text.",
+ "section": "Widgets",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "standarditemmodel": {
+ "label": "QStandardItemModel",
+ "purpose": "Provides a generic model for storing custom data.",
+ "section": "ItemViews",
+ "condition": "features.itemmodel",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformatplugin": {
+ "label": "QImageIOPlugin",
+ "purpose": "Provides a base for writing a image format plugins.",
+ "section": "Images",
+ "condition": "features.library",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "movie": {
+ "label": "QMovie",
+ "purpose": "Supports animated images.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_bmp": {
+ "label": "BMP Image Format",
+ "purpose": "Supports Microsoft's Bitmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_ppm": {
+ "label": "PPM Image Format",
+ "purpose": "Supports the Portable Pixmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_xbm": {
+ "label": "XBM Image Format",
+ "purpose": "Supports the X11 Bitmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_xpm": {
+ "label": "XPM Image Format",
+ "purpose": "Supports the X11 Pixmap image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_png": {
+ "label": "PNG Image Format",
+ "purpose": "Supports the Portable Network Graphics image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "imageformat_jpeg": {
+ "label": "JPEG Image Format",
+ "purpose": "Supports the Joint Photographic Experts Group image file format.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "image_heuristic_mask": {
+ "label": "QImage::createHeuristicMask()",
+ "purpose": "Supports creating a 1-bpp heuristic mask for images.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "image_text": {
+ "label": "Image Text",
+ "purpose": "Supports image file text strings.",
+ "section": "Images",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "picture": {
+ "label": "QPicture",
+ "purpose": "Supports recording and replaying QPainter commands.",
+ "section": "Painting",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "colornames": {
+ "label": "Color Names",
+ "purpose": "Supports color names such as \"red\", used by QColor and by some HTML documents.",
+ "section": "Painting",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "pdf": {
+ "label": "QPdf",
+ "purpose": "Provides a PDF backend for QPainter.",
+ "section": "Painting",
+ "condition": "features.temporaryfile",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "freetype": {
+ "label": "Freetype Font Engine",
+ "purpose": "Supports the FreeType 2 font engine (and its supported font formats).",
+ "section": "Fonts",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "desktopservices": {
+ "label": "QDesktopServices",
+ "purpose": "Provides methods for accessing common desktop services.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "systemtrayicon": {
+ "label": "QSystemTrayIcon",
+ "purpose": "Provides an icon for an application in the system tray.",
+ "section": "Utilities",
+ "output": [ "publicFeature", "feature" ]
+ },
+ "accessibility": {
+ "label": "Accessibility",
+ "purpose": "Provides accessibility support.",
+ "section": "Utilities",
+ "condition": "features.properties",
+ "output": [ "publicFeature", "feature" ]
+ }
+ },
+
+ "earlyReport": [
+ {
+ "type": "error",
+ "condition": "input.xcb != '' && input.xcb != 'no' && input.xkbcommon == 'no'",
+ "message": "XCB plugin requires libxkbcommon. See -qt-xkbcommon-x11 and -system-xkbcommon-x11."
+ }
+ ],
+
+ "report": [
+ {
+ "type": "warning",
+ "condition": "features.xcb && !features.xkbcommon-system && !features.xkb-config-root",
+ "message": "Could not find XKB config root, use -xkb-config-root to set a path to
+XKB configuration data. This is required for keyboard input support."
+ },
+ {
+ "type": "note",
+ "condition": "features.accessibility && features.xcb && !features.accessibility-atspi-bridge",
+ "message": "Disabling Linux Accessibility Bridge: D-Bus is missing."
+ },
+ {
+ "type": "warning",
+ "condition": "input.qpa-platform-guard != ''",
+ "message": "The [-no]-qpa-platform-guard argument is deprecated and has no effect."
+ },
+ {
+ "type": "warning",
+ "condition": "features.gui && config.linux && !config.android && !features.xcb && !features.eglfs && !features.directfb && !features.linuxfb && !features.mirclient",
+ "message": "No QPA platform plugin enabled! This will
+produce a Qt that cannot run GUI applications.
+The dependencies needed for xcb to build are listed in
+src/plugins/platforms/xcb/README"
+ },
+ {
+ "type": "warning",
+ "condition": "config.win32 && (features.opengles2 || features.opengl-dynamic) && !features.angle",
+ "message": "Using OpenGL ES 2.0 on Windows without ANGLE.
+The build will most likely fail.
+Specify -opengl desktop to use regular OpenGL."
+ },
+ {
+ "type": "warning",
+ "condition": "config.darwin && features.system-harfbuzz",
+ "message": "On OS X, AAT is supported only with -qt-harfbuzz."
+ },
+ {
+ "type": "error",
+ "condition": "features.gui && !config.watchos && input.opengl != 'no' && !features.opengl-desktop && !features.opengles2 && !features.opengl-dynamic",
+ "message": "The OpenGL functionality tests failed!
+You might need to modify the include and library search paths by editing QMAKE_INCDIR_OPENGL[_ES2],
+QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your platform."
+ }
+ ],
+
+ "summary": [
+ {
+ "section": "Qt Gui",
+ "entries": [
+ "freetype",
+ "system-freetype",
+ "harfbuzz",
+ "system-harfbuzz",
+ "fontconfig",
+ {
+ "section": "Image formats",
+ "entries": [
+ "gif", "ico", "jpeg", "system-jpeg", "png", "system-png"
+ ]
+ },
+ {
+ "section": "OpenGL",
+ "entries": [
+ {
+ "type": "feature",
+ "args": "angle",
+ "condition": "config.win32"
+ },
+ "egl",
+ "opengl-desktop",
+ {
+ "type": "feature",
+ "args": "opengl-dynamic",
+ "condition": "config.win32"
+ },
+ "opengles2",
+ "opengles3",
+ "opengles31"
+ ]
+ },
+ "sessionmanager"
+ ]
+ },
+ {
+ "section": "Features used by QPA backends",
+ "entries": [
+ "evdev",
+ "libinput",
+ "mtdev",
+ "tslib",
+ "xkbcommon-evdev"
+ ]
+ },
+ {
+ "section": "QPA backends",
+ "entries": [
+ "directfb", "eglfs",
+ {
+ "section": "EGLFS details",
+ "condition": "features.eglfs",
+ "entries": [
+ "eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
+ ]
+ },
+ "linuxfb", "mirclient",
+ {
+ "message": "INTEGRITY framebuffer",
+ "condition": "config.integrity",
+ "args": "integrityfb"
+ },
+ {
+ "section": "QNX",
+ "condition": "config.qnx",
+ "entries": [
+ "lgmon", "qqnx_imf"
+ ]
+ },
+ {
+ "section": "X11",
+ "condition": "features.xcb",
+ "entries": [
+ "system-xcb", "egl_x11", "xinput2", "xkb", "xlib", "xrender", "xcb-render", "xcb-glx", "xcb-xlib", "xkbcommon-system"
+ ]
+ },
+ {
+ "section": "Windows",
+ "condition": "config.win32",
+ "entries": [
+ "direct2d", "directwrite", "directwrite2"
+ ]
+ }
+ ]
+ }
+ ]
+}
diff --git a/src/gui/configure.pri b/src/gui/configure.pri
new file mode 100644
index 0000000000..d79c5a6bba
--- /dev/null
+++ b/src/gui/configure.pri
@@ -0,0 +1,67 @@
+# custom tests
+
+# Check for Direct X SDK (include, lib, and direct shader compiler 'fxc').
+# Up to Direct X SDK June 2010 and for MinGW, this is pointed to by the
+# DXSDK_DIR variable. Starting with Windows Kit 8, it is included in
+# the Windows SDK. Checking for the header is not sufficient, since it
+# is also present in MinGW.
+defineTest(qtConfTest_directX) {
+ dxdir = $$getenv("DXSDK_DIR")
+ !isEmpty(dxdir) {
+ EXTRA_INCLUDEPATH += $$dxdir/include
+ equals(QT_ARCH, x86_64): \
+ EXTRA_LIBDIR += $$dxdir/lib/x64
+ else: \
+ EXTRA_LIBDIR += $$dxdir/lib/x86
+ EXTRA_PATH += $$dxdir/Utilities/bin/x86
+ }
+
+ $$qtConfEvaluate("features.sse2") {
+ ky = $$size($${1}.files._KEYS_)
+ $${1}.files._KEYS_ += $$ky
+ # Not present on MinGW-32
+ $${1}.files.$${ky} = "intrin.h"
+ }
+
+ qtConfTest_files($${1}): return(true)
+ return(false)
+}
+
+defineTest(qtConfTest_xkbConfigRoot) {
+ qtConfTest_getPkgConfigVariable($${1}): return(true)
+
+ for (dir, $$list("/usr/share/X11/xkb", "/usr/local/share/X11/xkb")) {
+ exists($$dir) {
+ $${1}.value = $$dir
+ export($${1}.value)
+ $${1}.cache += value
+ export($${1}.cache)
+ return(true)
+ }
+ }
+ return(false)
+}
+
+defineTest(qtConfTest_qpaDefaultPlatform) {
+ name =
+ !isEmpty(config.input.qpa_default_platform): name = $$config.input.qpa_default_platform
+ else: !isEmpty(QT_QPA_DEFAULT_PLATFORM): name = $$QT_QPA_DEFAULT_PLATFORM
+ else: winrt: name = winrt
+ else: win32: name = windows
+ else: android: name = android
+ else: macos: name = cocoa
+ else: ios: name = ios
+ else: qnx: name = qnx
+ else: integrity: name = integrityfb
+ else: name = xcb
+
+ $${1}.value = $$name
+ $${1}.plugin = q$$name
+ $${1}.name = "\"$$name\""
+ export($${1}.value)
+ export($${1}.plugin)
+ export($${1}.name)
+ $${1}.cache += value plugin name
+ export($${1}.cache)
+ return(true)
+}
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 62ec8e93b2..db118edf04 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -47,6 +47,8 @@
#include "private/qiconloader_p.h"
#include "qpainter.h"
#include "qfileinfo.h"
+#include <qmimedatabase.h>
+#include <qmimetype.h>
#include "qpixmapcache.h"
#include "qvariant.h"
#include "qcache.h"
@@ -839,8 +841,11 @@ QPixmap QIcon::pixmap(QWindow *window, const QSize &size, Mode mode, State state
qreal devicePixelRatio = qt_effective_device_pixel_ratio(window);
// Handle the simple normal-dpi case:
- if (!(devicePixelRatio > 1.0))
- return d->engine->pixmap(size, mode, state);
+ if (!(devicePixelRatio > 1.0)) {
+ QPixmap pixmap = d->engine->pixmap(size, mode, state);
+ pixmap.setDevicePixelRatio(1.0);
+ return pixmap;
+ }
// Try get a pixmap that is big enough to be displayed at device pixel resolution.
QPixmap pixmap = d->engine->pixmap(size * devicePixelRatio, mode, state);
@@ -976,6 +981,18 @@ void QIcon::addPixmap(const QPixmap &pixmap, Mode mode, State state)
d->engine->addPixmap(pixmap, mode, state);
}
+static QIconEngine *iconEngineFromSuffix(const QString &fileName, const QString &suffix)
+{
+ if (!suffix.isEmpty()) {
+ const int index = loader()->indexOf(suffix);
+ if (index != -1) {
+ if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
+ return factory->create(fileName);
+ }
+ }
+ }
+ return nullptr;
+}
/*! Adds an image from the file with the given \a fileName to the
icon, as a specialization for \a size, \a mode and \a state. The
@@ -1013,25 +1030,15 @@ void QIcon::addFile(const QString &fileName, const QSize &size, Mode mode, State
return;
detach();
if (!d) {
+
QFileInfo info(fileName);
- QString suffix = info.suffix();
- if (!suffix.isEmpty()) {
- // first try version 2 engines..
- const int index = loader()->indexOf(suffix);
- if (index != -1) {
- if (QIconEnginePlugin *factory = qobject_cast<QIconEnginePlugin*>(loader()->instance(index))) {
- if (QIconEngine *engine = factory->create(fileName)) {
- d = new QIconPrivate;
- d->engine = engine;
- }
- }
- }
- }
- // ...then fall back to the default engine
- if (!d) {
- d = new QIconPrivate;
- d->engine = new QPixmapIconEngine;
- }
+ QIconEngine *engine = iconEngineFromSuffix(fileName, info.suffix());
+#ifndef QT_NO_MIMETYPE
+ if (!engine)
+ engine = iconEngineFromSuffix(fileName, QMimeDatabase().mimeTypeForFile(info).preferredSuffix());
+#endif // !QT_NO_MIMETYPE
+ d = new QIconPrivate;
+ d->engine = engine ? engine : new QPixmapIconEngine;
}
d->engine->addFile(fileName, size, mode, state);
diff --git a/src/gui/image/qiconloader.cpp b/src/gui/image/qiconloader.cpp
index e61a6bb48e..eda9d6f24e 100644
--- a/src/gui/image/qiconloader.cpp
+++ b/src/gui/image/qiconloader.cpp
@@ -199,7 +199,7 @@ private:
QIconCacheGtkReader::QIconCacheGtkReader(const QString &dirName)
: m_isValid(false)
{
- QFileInfo info(dirName + QLatin1Literal("/icon-theme.cache"));
+ QFileInfo info(dirName + QLatin1String("/icon-theme.cache"));
if (!info.exists() || info.lastModified() < QFileInfo(dirName).lastModified())
return;
m_file.setFileName(info.absoluteFilePath());
diff --git a/src/gui/kernel/qtguiglobal.h b/src/gui/kernel/qtguiglobal.h
index f0e64fbc53..8a7409e3d9 100644
--- a/src/gui/kernel/qtguiglobal.h
+++ b/src/gui/kernel/qtguiglobal.h
@@ -41,6 +41,7 @@
#define QTGUIGLOBAL_H
#include <QtCore/qglobal.h>
+#include <QtGui/qtgui-config.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/kernel/qtguiglobal_p.h b/src/gui/kernel/qtguiglobal_p.h
index fd04b8ff95..d2c0b3c5d1 100644
--- a/src/gui/kernel/qtguiglobal_p.h
+++ b/src/gui/kernel/qtguiglobal_p.h
@@ -53,5 +53,6 @@
#include <QtGui/qtguiglobal.h>
#include <QtCore/private/qglobal_p.h>
+#include <QtGui/private/qtgui-config_p.h>
#endif // QTGUIGLOBAL_P_H
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 5f71bdaded..18e8bcf99c 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -2195,6 +2195,9 @@ void QWindowPrivate::deliverUpdateRequest()
*/
void QWindow::requestUpdate()
{
+ Q_ASSERT_X(QThread::currentThread() == QCoreApplication::instance()->thread(),
+ "QWindow", "Updates can only be scheduled from the GUI (main) thread");
+
Q_D(QWindow);
if (d->updateRequestPending || !d->platformWindow)
return;
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 6d6d5a22ee..b8a9f5d3de 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -126,8 +126,14 @@ public:
QPoint globalPosition() const {
Q_Q(const QWindow);
QPoint offset = q->position();
- for (const QWindow *p = q->parent(); p; p = p->parent())
- offset += p->position();
+ for (const QWindow *p = q->parent(); p; p = p->parent()) {
+ if (p->type() != Qt::ForeignWindow) {
+ offset += p->position();
+ } else { // QTBUG-43252, mapToGlobal() for foreign children.
+ offset += p->mapToGlobal(QPoint(0, 0));
+ break;
+ }
+ }
return offset;
}
diff --git a/src/gui/opengl/qopengl.h b/src/gui/opengl/qopengl.h
index e2408d0047..c7a3e79666 100644
--- a/src/gui/opengl/qopengl.h
+++ b/src/gui/opengl/qopengl.h
@@ -95,14 +95,15 @@ typedef void* GLeglImageOES;
// applications cannot target ES 3. Therefore QOpenGLFunctions and
// friends do everything dynamically and never rely on these macros.
+# ifndef GL_GLEXT_PROTOTYPES
+# define GL_GLEXT_PROTOTYPES
+# endif
+
# if defined(QT_OPENGL_ES_3_1)
# include <GLES3/gl31.h>
# elif defined(QT_OPENGL_ES_3)
# include <GLES3/gl3.h>
# else
-# ifndef GL_GLEXT_PROTOTYPES
-# define GL_GLEXT_PROTOTYPES
-# endif
# include <GLES2/gl2.h>
#endif
diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp
index 1ccd78d2ed..e0f469cbcb 100644
--- a/src/gui/opengl/qopenglframebufferobject.cpp
+++ b/src/gui/opengl/qopenglframebufferobject.cpp
@@ -1283,11 +1283,11 @@ static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool includ
? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra"))
: context->hasExtension(QByteArrayLiteral("GL_EXT_bgra"));
+#ifndef Q_OS_IOS
const char *renderer = reinterpret_cast<const char *>(funcs->glGetString(GL_RENDERER));
const char *ver = reinterpret_cast<const char *>(funcs->glGetString(GL_VERSION));
// Blacklist GPU chipsets that have problems with their BGRA support.
-#ifndef Q_OS_IOS
const bool blackListed = (qstrcmp(renderer, "PowerVR Rogue G6200") == 0
&& ::strstr(ver, "1.3") != 0) ||
(qstrcmp(renderer, "Mali-T760") == 0
diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
index 00f2375923..c47060a2ad 100644
--- a/src/gui/painting/painting.pri
+++ b/src/gui/painting/painting.pri
@@ -63,7 +63,6 @@ SOURCES += \
painting/qblittable.cpp \
painting/qbrush.cpp \
painting/qcolor.cpp \
- painting/qcolor_p.cpp \
painting/qcompositionfunctions.cpp \
painting/qcosmeticstroker.cpp \
painting/qcssutil.cpp \
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 56180af693..650ba0187e 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -43,6 +43,9 @@
#include "qdatastream.h"
#include "qvariant.h"
#include "qdebug.h"
+#include "private/qtools_p.h"
+
+#include <algorithm>
#include <stdio.h>
#include <limits.h>
@@ -50,6 +53,326 @@
QT_BEGIN_NAMESPACE
/*!
+ \internal
+ If s[0..1] is a valid hex number, returns its integer value,
+ otherwise returns -1.
+ */
+static inline int hex2int(const char *s)
+{
+ const int hi = QtMiscUtils::fromHex(s[0]);
+ if (hi < 0)
+ return -1;
+ const int lo = QtMiscUtils::fromHex(s[1]);
+ if (lo < 0)
+ return -1;
+ return (hi << 4) | lo;
+}
+
+/*!
+ \internal
+ If s is a valid hex digit, returns its integer value,
+ multiplied by 0x11, otherwise returns -1.
+ */
+static inline int hex2int(char s)
+{
+ const int h = QtMiscUtils::fromHex(s);
+ return h < 0 ? h : (h << 4) | h;
+}
+
+bool qt_get_hex_rgb(const char *name, QRgb *rgb)
+{
+ if (name[0] != '#')
+ return false;
+ name++;
+ int len = qstrlen(name);
+ int a, r, g, b;
+ a = 255;
+ if (len == 12) {
+ r = hex2int(name);
+ g = hex2int(name + 4);
+ b = hex2int(name + 8);
+ } else if (len == 9) {
+ r = hex2int(name);
+ g = hex2int(name + 3);
+ b = hex2int(name + 6);
+ } else if (len == 8) {
+ a = hex2int(name);
+ r = hex2int(name + 2);
+ g = hex2int(name + 4);
+ b = hex2int(name + 6);
+ } else if (len == 6) {
+ r = hex2int(name);
+ g = hex2int(name + 2);
+ b = hex2int(name + 4);
+ } else if (len == 3) {
+ r = hex2int(name[0]);
+ g = hex2int(name[1]);
+ b = hex2int(name[2]);
+ } else {
+ r = g = b = -1;
+ }
+ if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
+ *rgb = 0;
+ return false;
+ }
+ *rgb = qRgba(r, g ,b, a);
+ return true;
+}
+
+bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
+{
+ if (len > 13)
+ return false;
+ char tmp[16];
+ for (int i = 0; i < len; ++i)
+ tmp[i] = str[i].toLatin1();
+ tmp[len] = 0;
+ return qt_get_hex_rgb(tmp, rgb);
+}
+
+#ifndef QT_NO_COLORNAMES
+
+/*
+ CSS color names = SVG 1.0 color names + transparent (rgba(0,0,0,0))
+*/
+
+#ifdef rgb
+# undef rgb
+#endif
+#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
+
+static const struct RGBData {
+ const char name[21];
+ uint value;
+} rgbTbl[] = {
+ { "aliceblue", rgb(240, 248, 255) },
+ { "antiquewhite", rgb(250, 235, 215) },
+ { "aqua", rgb( 0, 255, 255) },
+ { "aquamarine", rgb(127, 255, 212) },
+ { "azure", rgb(240, 255, 255) },
+ { "beige", rgb(245, 245, 220) },
+ { "bisque", rgb(255, 228, 196) },
+ { "black", rgb( 0, 0, 0) },
+ { "blanchedalmond", rgb(255, 235, 205) },
+ { "blue", rgb( 0, 0, 255) },
+ { "blueviolet", rgb(138, 43, 226) },
+ { "brown", rgb(165, 42, 42) },
+ { "burlywood", rgb(222, 184, 135) },
+ { "cadetblue", rgb( 95, 158, 160) },
+ { "chartreuse", rgb(127, 255, 0) },
+ { "chocolate", rgb(210, 105, 30) },
+ { "coral", rgb(255, 127, 80) },
+ { "cornflowerblue", rgb(100, 149, 237) },
+ { "cornsilk", rgb(255, 248, 220) },
+ { "crimson", rgb(220, 20, 60) },
+ { "cyan", rgb( 0, 255, 255) },
+ { "darkblue", rgb( 0, 0, 139) },
+ { "darkcyan", rgb( 0, 139, 139) },
+ { "darkgoldenrod", rgb(184, 134, 11) },
+ { "darkgray", rgb(169, 169, 169) },
+ { "darkgreen", rgb( 0, 100, 0) },
+ { "darkgrey", rgb(169, 169, 169) },
+ { "darkkhaki", rgb(189, 183, 107) },
+ { "darkmagenta", rgb(139, 0, 139) },
+ { "darkolivegreen", rgb( 85, 107, 47) },
+ { "darkorange", rgb(255, 140, 0) },
+ { "darkorchid", rgb(153, 50, 204) },
+ { "darkred", rgb(139, 0, 0) },
+ { "darksalmon", rgb(233, 150, 122) },
+ { "darkseagreen", rgb(143, 188, 143) },
+ { "darkslateblue", rgb( 72, 61, 139) },
+ { "darkslategray", rgb( 47, 79, 79) },
+ { "darkslategrey", rgb( 47, 79, 79) },
+ { "darkturquoise", rgb( 0, 206, 209) },
+ { "darkviolet", rgb(148, 0, 211) },
+ { "deeppink", rgb(255, 20, 147) },
+ { "deepskyblue", rgb( 0, 191, 255) },
+ { "dimgray", rgb(105, 105, 105) },
+ { "dimgrey", rgb(105, 105, 105) },
+ { "dodgerblue", rgb( 30, 144, 255) },
+ { "firebrick", rgb(178, 34, 34) },
+ { "floralwhite", rgb(255, 250, 240) },
+ { "forestgreen", rgb( 34, 139, 34) },
+ { "fuchsia", rgb(255, 0, 255) },
+ { "gainsboro", rgb(220, 220, 220) },
+ { "ghostwhite", rgb(248, 248, 255) },
+ { "gold", rgb(255, 215, 0) },
+ { "goldenrod", rgb(218, 165, 32) },
+ { "gray", rgb(128, 128, 128) },
+ { "green", rgb( 0, 128, 0) },
+ { "greenyellow", rgb(173, 255, 47) },
+ { "grey", rgb(128, 128, 128) },
+ { "honeydew", rgb(240, 255, 240) },
+ { "hotpink", rgb(255, 105, 180) },
+ { "indianred", rgb(205, 92, 92) },
+ { "indigo", rgb( 75, 0, 130) },
+ { "ivory", rgb(255, 255, 240) },
+ { "khaki", rgb(240, 230, 140) },
+ { "lavender", rgb(230, 230, 250) },
+ { "lavenderblush", rgb(255, 240, 245) },
+ { "lawngreen", rgb(124, 252, 0) },
+ { "lemonchiffon", rgb(255, 250, 205) },
+ { "lightblue", rgb(173, 216, 230) },
+ { "lightcoral", rgb(240, 128, 128) },
+ { "lightcyan", rgb(224, 255, 255) },
+ { "lightgoldenrodyellow", rgb(250, 250, 210) },
+ { "lightgray", rgb(211, 211, 211) },
+ { "lightgreen", rgb(144, 238, 144) },
+ { "lightgrey", rgb(211, 211, 211) },
+ { "lightpink", rgb(255, 182, 193) },
+ { "lightsalmon", rgb(255, 160, 122) },
+ { "lightseagreen", rgb( 32, 178, 170) },
+ { "lightskyblue", rgb(135, 206, 250) },
+ { "lightslategray", rgb(119, 136, 153) },
+ { "lightslategrey", rgb(119, 136, 153) },
+ { "lightsteelblue", rgb(176, 196, 222) },
+ { "lightyellow", rgb(255, 255, 224) },
+ { "lime", rgb( 0, 255, 0) },
+ { "limegreen", rgb( 50, 205, 50) },
+ { "linen", rgb(250, 240, 230) },
+ { "magenta", rgb(255, 0, 255) },
+ { "maroon", rgb(128, 0, 0) },
+ { "mediumaquamarine", rgb(102, 205, 170) },
+ { "mediumblue", rgb( 0, 0, 205) },
+ { "mediumorchid", rgb(186, 85, 211) },
+ { "mediumpurple", rgb(147, 112, 219) },
+ { "mediumseagreen", rgb( 60, 179, 113) },
+ { "mediumslateblue", rgb(123, 104, 238) },
+ { "mediumspringgreen", rgb( 0, 250, 154) },
+ { "mediumturquoise", rgb( 72, 209, 204) },
+ { "mediumvioletred", rgb(199, 21, 133) },
+ { "midnightblue", rgb( 25, 25, 112) },
+ { "mintcream", rgb(245, 255, 250) },
+ { "mistyrose", rgb(255, 228, 225) },
+ { "moccasin", rgb(255, 228, 181) },
+ { "navajowhite", rgb(255, 222, 173) },
+ { "navy", rgb( 0, 0, 128) },
+ { "oldlace", rgb(253, 245, 230) },
+ { "olive", rgb(128, 128, 0) },
+ { "olivedrab", rgb(107, 142, 35) },
+ { "orange", rgb(255, 165, 0) },
+ { "orangered", rgb(255, 69, 0) },
+ { "orchid", rgb(218, 112, 214) },
+ { "palegoldenrod", rgb(238, 232, 170) },
+ { "palegreen", rgb(152, 251, 152) },
+ { "paleturquoise", rgb(175, 238, 238) },
+ { "palevioletred", rgb(219, 112, 147) },
+ { "papayawhip", rgb(255, 239, 213) },
+ { "peachpuff", rgb(255, 218, 185) },
+ { "peru", rgb(205, 133, 63) },
+ { "pink", rgb(255, 192, 203) },
+ { "plum", rgb(221, 160, 221) },
+ { "powderblue", rgb(176, 224, 230) },
+ { "purple", rgb(128, 0, 128) },
+ { "red", rgb(255, 0, 0) },
+ { "rosybrown", rgb(188, 143, 143) },
+ { "royalblue", rgb( 65, 105, 225) },
+ { "saddlebrown", rgb(139, 69, 19) },
+ { "salmon", rgb(250, 128, 114) },
+ { "sandybrown", rgb(244, 164, 96) },
+ { "seagreen", rgb( 46, 139, 87) },
+ { "seashell", rgb(255, 245, 238) },
+ { "sienna", rgb(160, 82, 45) },
+ { "silver", rgb(192, 192, 192) },
+ { "skyblue", rgb(135, 206, 235) },
+ { "slateblue", rgb(106, 90, 205) },
+ { "slategray", rgb(112, 128, 144) },
+ { "slategrey", rgb(112, 128, 144) },
+ { "snow", rgb(255, 250, 250) },
+ { "springgreen", rgb( 0, 255, 127) },
+ { "steelblue", rgb( 70, 130, 180) },
+ { "tan", rgb(210, 180, 140) },
+ { "teal", rgb( 0, 128, 128) },
+ { "thistle", rgb(216, 191, 216) },
+ { "tomato", rgb(255, 99, 71) },
+ { "transparent", 0 },
+ { "turquoise", rgb( 64, 224, 208) },
+ { "violet", rgb(238, 130, 238) },
+ { "wheat", rgb(245, 222, 179) },
+ { "white", rgb(255, 255, 255) },
+ { "whitesmoke", rgb(245, 245, 245) },
+ { "yellow", rgb(255, 255, 0) },
+ { "yellowgreen", rgb(154, 205, 50) }
+};
+
+static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
+
+#undef rgb
+
+#if defined(Q_CC_MSVC) && _MSC_VER < 1600
+inline bool operator<(const RGBData &data1, const RGBData &data2)
+{ return qstrcmp(data1.name, data2.name) < 0; }
+#endif
+
+inline bool operator<(const char *name, const RGBData &data)
+{ return qstrcmp(name, data.name) < 0; }
+inline bool operator<(const RGBData &data, const char *name)
+{ return qstrcmp(data.name, name) < 0; }
+
+static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
+{
+ const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
+ if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
+ *rgb = r->value;
+ return true;
+ }
+ return false;
+}
+
+bool qt_get_named_rgb(const char *name, QRgb* rgb)
+{
+ int len = int(strlen(name));
+ if (len > 255)
+ return false;
+ char name_no_space[256];
+ int pos = 0;
+ for (int i = 0; i < len; i++) {
+ if (name[i] != '\t' && name[i] != ' ')
+ name_no_space[pos++] = QChar::toLower(name[i]);
+ }
+ name_no_space[pos] = 0;
+
+ return get_named_rgb(name_no_space, rgb);
+}
+
+bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
+{
+ if (len > 255)
+ return false;
+ char name_no_space[256];
+ int pos = 0;
+ for (int i = 0; i < len; i++) {
+ if (name[i] != QLatin1Char('\t') && name[i] != QLatin1Char(' '))
+ name_no_space[pos++] = name[i].toLower().toLatin1();
+ }
+ name_no_space[pos] = 0;
+ return get_named_rgb(name_no_space, rgb);
+}
+
+QStringList qt_get_colornames()
+{
+ int i = 0;
+ QStringList lst;
+ lst.reserve(rgbTblSize);
+ for (i = 0; i < rgbTblSize; i++)
+ lst << QLatin1String(rgbTbl[i].name);
+ return lst;
+}
+
+#else
+
+bool qt_get_named_rgb(const char *, QRgb*)
+{
+ return false;
+}
+
+QStringList qt_get_colornames()
+{
+ return QStringList();
+}
+#endif // QT_NO_COLORNAMES
+
+/*!
\class QColor
\brief The QColor class provides colors based on RGB, HSV or CMYK values.
diff --git a/src/gui/painting/qcolor_p.cpp b/src/gui/painting/qcolor_p.cpp
deleted file mode 100644
index b4ade9dc58..0000000000
--- a/src/gui/painting/qcolor_p.cpp
+++ /dev/null
@@ -1,369 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of the QtGui module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU Lesser General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 3 as published by the Free Software
-** Foundation and appearing in the file LICENSE.LGPL3 included in the
-** packaging of this file. Please review the following information to
-** ensure the GNU Lesser General Public License version 3 requirements
-** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 2.0 or (at your option) the GNU General
-** Public license version 3 or any later version approved by the KDE Free
-** Qt Foundation. The licenses are as published by the Free Software
-** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-2.0.html and
-** https://www.gnu.org/licenses/gpl-3.0.html.
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qglobal.h"
-#include "qrgb.h"
-#include "qstringlist.h"
-#include "private/qtools_p.h"
-
-#include <algorithm>
-
-QT_BEGIN_NAMESPACE
-
-/*!
- \internal
- If s[0..1] is a valid hex number, returns its integer value,
- otherwise returns -1.
- */
-static inline int hex2int(const char *s)
-{
- const int hi = QtMiscUtils::fromHex(s[0]);
- if (hi < 0)
- return -1;
- const int lo = QtMiscUtils::fromHex(s[1]);
- if (lo < 0)
- return -1;
- return (hi << 4) | lo;
-}
-
-/*!
- \internal
- If s is a valid hex digit, returns its integer value,
- multiplied by 0x11, otherwise returns -1.
- */
-static inline int hex2int(char s)
-{
- const int h = QtMiscUtils::fromHex(s);
- return h < 0 ? h : (h << 4) | h;
-}
-
-bool qt_get_hex_rgb(const char *name, QRgb *rgb)
-{
- if(name[0] != '#')
- return false;
- name++;
- int len = qstrlen(name);
- int a, r, g, b;
- a = 255;
- if (len == 12) {
- r = hex2int(name);
- g = hex2int(name + 4);
- b = hex2int(name + 8);
- } else if (len == 9) {
- r = hex2int(name);
- g = hex2int(name + 3);
- b = hex2int(name + 6);
- } else if (len == 8) {
- a = hex2int(name);
- r = hex2int(name + 2);
- g = hex2int(name + 4);
- b = hex2int(name + 6);
- } else if (len == 6) {
- r = hex2int(name);
- g = hex2int(name + 2);
- b = hex2int(name + 4);
- } else if (len == 3) {
- r = hex2int(name[0]);
- g = hex2int(name[1]);
- b = hex2int(name[2]);
- } else {
- r = g = b = -1;
- }
- if ((uint)r > 255 || (uint)g > 255 || (uint)b > 255 || (uint)a > 255) {
- *rgb = 0;
- return false;
- }
- *rgb = qRgba(r, g ,b, a);
- return true;
-}
-
-bool qt_get_hex_rgb(const QChar *str, int len, QRgb *rgb)
-{
- if (len > 13)
- return false;
- char tmp[16];
- for(int i = 0; i < len; ++i)
- tmp[i] = str[i].toLatin1();
- tmp[len] = 0;
- return qt_get_hex_rgb(tmp, rgb);
-}
-
-#ifndef QT_NO_COLORNAMES
-
-/*
- CSS color names = SVG 1.0 color names + transparent (rgba(0,0,0,0))
-*/
-
-#ifdef rgb
-# undef rgb
-#endif
-#define rgb(r,g,b) (0xff000000 | (r << 16) | (g << 8) | b)
-
-static const struct RGBData {
- const char name[21];
- uint value;
-} rgbTbl[] = {
- { "aliceblue", rgb(240, 248, 255) },
- { "antiquewhite", rgb(250, 235, 215) },
- { "aqua", rgb( 0, 255, 255) },
- { "aquamarine", rgb(127, 255, 212) },
- { "azure", rgb(240, 255, 255) },
- { "beige", rgb(245, 245, 220) },
- { "bisque", rgb(255, 228, 196) },
- { "black", rgb( 0, 0, 0) },
- { "blanchedalmond", rgb(255, 235, 205) },
- { "blue", rgb( 0, 0, 255) },
- { "blueviolet", rgb(138, 43, 226) },
- { "brown", rgb(165, 42, 42) },
- { "burlywood", rgb(222, 184, 135) },
- { "cadetblue", rgb( 95, 158, 160) },
- { "chartreuse", rgb(127, 255, 0) },
- { "chocolate", rgb(210, 105, 30) },
- { "coral", rgb(255, 127, 80) },
- { "cornflowerblue", rgb(100, 149, 237) },
- { "cornsilk", rgb(255, 248, 220) },
- { "crimson", rgb(220, 20, 60) },
- { "cyan", rgb( 0, 255, 255) },
- { "darkblue", rgb( 0, 0, 139) },
- { "darkcyan", rgb( 0, 139, 139) },
- { "darkgoldenrod", rgb(184, 134, 11) },
- { "darkgray", rgb(169, 169, 169) },
- { "darkgreen", rgb( 0, 100, 0) },
- { "darkgrey", rgb(169, 169, 169) },
- { "darkkhaki", rgb(189, 183, 107) },
- { "darkmagenta", rgb(139, 0, 139) },
- { "darkolivegreen", rgb( 85, 107, 47) },
- { "darkorange", rgb(255, 140, 0) },
- { "darkorchid", rgb(153, 50, 204) },
- { "darkred", rgb(139, 0, 0) },
- { "darksalmon", rgb(233, 150, 122) },
- { "darkseagreen", rgb(143, 188, 143) },
- { "darkslateblue", rgb( 72, 61, 139) },
- { "darkslategray", rgb( 47, 79, 79) },
- { "darkslategrey", rgb( 47, 79, 79) },
- { "darkturquoise", rgb( 0, 206, 209) },
- { "darkviolet", rgb(148, 0, 211) },
- { "deeppink", rgb(255, 20, 147) },
- { "deepskyblue", rgb( 0, 191, 255) },
- { "dimgray", rgb(105, 105, 105) },
- { "dimgrey", rgb(105, 105, 105) },
- { "dodgerblue", rgb( 30, 144, 255) },
- { "firebrick", rgb(178, 34, 34) },
- { "floralwhite", rgb(255, 250, 240) },
- { "forestgreen", rgb( 34, 139, 34) },
- { "fuchsia", rgb(255, 0, 255) },
- { "gainsboro", rgb(220, 220, 220) },
- { "ghostwhite", rgb(248, 248, 255) },
- { "gold", rgb(255, 215, 0) },
- { "goldenrod", rgb(218, 165, 32) },
- { "gray", rgb(128, 128, 128) },
- { "green", rgb( 0, 128, 0) },
- { "greenyellow", rgb(173, 255, 47) },
- { "grey", rgb(128, 128, 128) },
- { "honeydew", rgb(240, 255, 240) },
- { "hotpink", rgb(255, 105, 180) },
- { "indianred", rgb(205, 92, 92) },
- { "indigo", rgb( 75, 0, 130) },
- { "ivory", rgb(255, 255, 240) },
- { "khaki", rgb(240, 230, 140) },
- { "lavender", rgb(230, 230, 250) },
- { "lavenderblush", rgb(255, 240, 245) },
- { "lawngreen", rgb(124, 252, 0) },
- { "lemonchiffon", rgb(255, 250, 205) },
- { "lightblue", rgb(173, 216, 230) },
- { "lightcoral", rgb(240, 128, 128) },
- { "lightcyan", rgb(224, 255, 255) },
- { "lightgoldenrodyellow", rgb(250, 250, 210) },
- { "lightgray", rgb(211, 211, 211) },
- { "lightgreen", rgb(144, 238, 144) },
- { "lightgrey", rgb(211, 211, 211) },
- { "lightpink", rgb(255, 182, 193) },
- { "lightsalmon", rgb(255, 160, 122) },
- { "lightseagreen", rgb( 32, 178, 170) },
- { "lightskyblue", rgb(135, 206, 250) },
- { "lightslategray", rgb(119, 136, 153) },
- { "lightslategrey", rgb(119, 136, 153) },
- { "lightsteelblue", rgb(176, 196, 222) },
- { "lightyellow", rgb(255, 255, 224) },
- { "lime", rgb( 0, 255, 0) },
- { "limegreen", rgb( 50, 205, 50) },
- { "linen", rgb(250, 240, 230) },
- { "magenta", rgb(255, 0, 255) },
- { "maroon", rgb(128, 0, 0) },
- { "mediumaquamarine", rgb(102, 205, 170) },
- { "mediumblue", rgb( 0, 0, 205) },
- { "mediumorchid", rgb(186, 85, 211) },
- { "mediumpurple", rgb(147, 112, 219) },
- { "mediumseagreen", rgb( 60, 179, 113) },
- { "mediumslateblue", rgb(123, 104, 238) },
- { "mediumspringgreen", rgb( 0, 250, 154) },
- { "mediumturquoise", rgb( 72, 209, 204) },
- { "mediumvioletred", rgb(199, 21, 133) },
- { "midnightblue", rgb( 25, 25, 112) },
- { "mintcream", rgb(245, 255, 250) },
- { "mistyrose", rgb(255, 228, 225) },
- { "moccasin", rgb(255, 228, 181) },
- { "navajowhite", rgb(255, 222, 173) },
- { "navy", rgb( 0, 0, 128) },
- { "oldlace", rgb(253, 245, 230) },
- { "olive", rgb(128, 128, 0) },
- { "olivedrab", rgb(107, 142, 35) },
- { "orange", rgb(255, 165, 0) },
- { "orangered", rgb(255, 69, 0) },
- { "orchid", rgb(218, 112, 214) },
- { "palegoldenrod", rgb(238, 232, 170) },
- { "palegreen", rgb(152, 251, 152) },
- { "paleturquoise", rgb(175, 238, 238) },
- { "palevioletred", rgb(219, 112, 147) },
- { "papayawhip", rgb(255, 239, 213) },
- { "peachpuff", rgb(255, 218, 185) },
- { "peru", rgb(205, 133, 63) },
- { "pink", rgb(255, 192, 203) },
- { "plum", rgb(221, 160, 221) },
- { "powderblue", rgb(176, 224, 230) },
- { "purple", rgb(128, 0, 128) },
- { "red", rgb(255, 0, 0) },
- { "rosybrown", rgb(188, 143, 143) },
- { "royalblue", rgb( 65, 105, 225) },
- { "saddlebrown", rgb(139, 69, 19) },
- { "salmon", rgb(250, 128, 114) },
- { "sandybrown", rgb(244, 164, 96) },
- { "seagreen", rgb( 46, 139, 87) },
- { "seashell", rgb(255, 245, 238) },
- { "sienna", rgb(160, 82, 45) },
- { "silver", rgb(192, 192, 192) },
- { "skyblue", rgb(135, 206, 235) },
- { "slateblue", rgb(106, 90, 205) },
- { "slategray", rgb(112, 128, 144) },
- { "slategrey", rgb(112, 128, 144) },
- { "snow", rgb(255, 250, 250) },
- { "springgreen", rgb( 0, 255, 127) },
- { "steelblue", rgb( 70, 130, 180) },
- { "tan", rgb(210, 180, 140) },
- { "teal", rgb( 0, 128, 128) },
- { "thistle", rgb(216, 191, 216) },
- { "tomato", rgb(255, 99, 71) },
- { "transparent", 0 },
- { "turquoise", rgb( 64, 224, 208) },
- { "violet", rgb(238, 130, 238) },
- { "wheat", rgb(245, 222, 179) },
- { "white", rgb(255, 255, 255) },
- { "whitesmoke", rgb(245, 245, 245) },
- { "yellow", rgb(255, 255, 0) },
- { "yellowgreen", rgb(154, 205, 50) }
-};
-
-static const int rgbTblSize = sizeof(rgbTbl) / sizeof(RGBData);
-
-#undef rgb
-
-#if defined(Q_CC_MSVC) && _MSC_VER < 1600
-inline bool operator<(const RGBData &data1, const RGBData &data2)
-{ return qstrcmp(data1.name, data2.name) < 0; }
-#endif
-
-inline bool operator<(const char *name, const RGBData &data)
-{ return qstrcmp(name, data.name) < 0; }
-inline bool operator<(const RGBData &data, const char *name)
-{ return qstrcmp(data.name, name) < 0; }
-
-static bool get_named_rgb(const char *name_no_space, QRgb *rgb)
-{
- const RGBData *r = std::lower_bound(rgbTbl, rgbTbl + rgbTblSize, name_no_space);
- if ((r != rgbTbl + rgbTblSize) && !(name_no_space < *r)) {
- *rgb = r->value;
- return true;
- }
- return false;
-}
-
-bool qt_get_named_rgb(const char *name, QRgb* rgb)
-{
- int len = int(strlen(name));
- if(len > 255)
- return false;
- char name_no_space[256];
- int pos = 0;
- for(int i = 0; i < len; i++) {
- if(name[i] != '\t' && name[i] != ' ')
- name_no_space[pos++] = QChar::toLower(name[i]);
- }
- name_no_space[pos] = 0;
-
- return get_named_rgb(name_no_space, rgb);
-}
-
-bool qt_get_named_rgb(const QChar *name, int len, QRgb *rgb)
-{
- if(len > 255)
- return false;
- char name_no_space[256];
- int pos = 0;
- for(int i = 0; i < len; i++) {
- if(name[i] != QLatin1Char('\t') && name[i] != QLatin1Char(' '))
- name_no_space[pos++] = name[i].toLower().toLatin1();
- }
- name_no_space[pos] = 0;
- return get_named_rgb(name_no_space, rgb);
-}
-
-QStringList qt_get_colornames()
-{
- int i = 0;
- QStringList lst;
- lst.reserve(rgbTblSize);
- for (i = 0; i < rgbTblSize; i++)
- lst << QLatin1String(rgbTbl[i].name);
- return lst;
-}
-
-#else
-
-bool qt_get_named_rgb(const char *, QRgb*)
-{
- return false;
-}
-
-QStringList qt_get_colornames()
-{
- return QStringList();
-}
-#endif // QT_NO_COLORNAMES
-
-QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index ac11b0f324..c697aceaf3 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -2176,7 +2176,8 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
const uint *s1 = (const uint *)data->texture.scanLine(y1);
const uint *s2 = (const uint *)data->texture.scanLine(y2);
- int disty = ((fy & 0x0000ffff) + 0x0800) >> 12;
+ const int disty8 = (fy & 0x0000ffff) >> 8;
+ const int disty4 = (disty8 + 0x08) >> 4;
if (blendType != BlendTransformedBilinearTiled) {
#define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \
@@ -2188,12 +2189,9 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); \
if (x1 != x2) \
break; \
- uint tl = s1[x1]; \
- uint tr = s1[x2]; \
- uint bl = s2[x1]; \
- uint br = s2[x2]; \
- int distx = ((fx & 0x0000ffff) + 0x0800) >> 12; \
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); \
+ uint top = s1[x1]; \
+ uint bot = s2[x1]; \
+ *b = INTERPOLATE_PIXEL_256(top, 256 - disty8, bot, disty8); \
fx += fdx; \
++b; \
} \
@@ -2209,7 +2207,7 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
const __m128i v_256 = _mm_set1_epi16(256);
- const __m128i v_disty = _mm_set1_epi16(disty);
+ const __m128i v_disty = _mm_set1_epi16(disty4);
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
const __m128i v_fx_r = _mm_set1_epi32(0x8);
__m128i v_fx = _mm_setr_epi32(fx, fx + fdx, fx + fdx + fdx, fx + fdx + fdx + fdx);
@@ -2241,18 +2239,14 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
const int16x8_t colorMask = vdupq_n_s16(0x00ff);
const int16x8_t invColorMask = vmvnq_s16(colorMask);
const int16x8_t v_256 = vdupq_n_s16(256);
- const int16x8_t v_disty = vdupq_n_s16(disty);
+ const int16x8_t v_disty = vdupq_n_s16(disty4);
const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4);
int32x4_t v_fdx = vdupq_n_s32(fdx*4);
int32x4_t v_fx = vmovq_n_s32(fx);
- fx += fdx;
- v_fx = vsetq_lane_s32(fx, v_fx, 1);
- fx += fdx;
- v_fx = vsetq_lane_s32(fx, v_fx, 2);
- fx += fdx;
- v_fx = vsetq_lane_s32(fx, v_fx, 3);
- fx += fdx;
+ v_fx = vsetq_lane_s32(fx + fdx, v_fx, 1);
+ v_fx = vsetq_lane_s32(fx + fdx * 2, v_fx, 2);
+ v_fx = vsetq_lane_s32(fx + fdx * 3, v_fx, 3);
const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
const int32x4_t v_fx_r = vdupq_n_s32(0x0800);
@@ -2260,18 +2254,20 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
while (b < boundedEnd) {
uint32x4x2_t v_top, v_bot;
- int32x4_t v_fx_shifted = vshrq_n_s32(v_fx, 16);
-
- int x1 = vgetq_lane_s32(v_fx_shifted, 0);
+ int x1 = (fx >> 16);
+ fx += fdx;
v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
- x1 = vgetq_lane_s32(v_fx_shifted, 1);
+ x1 = (fx >> 16);
+ fx += fdx;
v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
- x1 = vgetq_lane_s32(v_fx_shifted, 2);
+ x1 = (fx >> 16);
+ fx += fdx;
v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
- x1 = vgetq_lane_s32(v_fx_shifted, 3);
+ x1 = (fx >> 16);
+ fx += fdx;
v_top = vld2q_lane_u32(s1 + x1, v_top, 3);
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 3);
@@ -2286,7 +2282,6 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
b+=4;
v_fx = vaddq_s32(v_fx, v_fdx);
}
- fx = vgetq_lane_s32(v_fx, 0);
#endif
}
@@ -2298,8 +2293,14 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
uint tr = s1[x2];
uint bl = s2[x1];
uint br = s2[x2];
- int distx = ((fx & 0x0000ffff) + 0x0800) >> 12;
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
+#if defined(__SSE2__) || defined(__ARM_NEON__)
+ // The optimized interpolate_4_pixels are faster than interpolate_4_pixels_16.
+ int distx8 = (fx & 0x0000ffff) >> 8;
+ *b = interpolate_4_pixels(tl, tr, bl, br, distx8, disty8);
+#else
+ int distx4 = ((fx & 0x0000ffff) + 0x0800) >> 12;
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx4, disty4);
+#endif
fx += fdx;
++b;
}
@@ -2436,16 +2437,12 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
int32x4_t v_fx = vmovq_n_s32(fx);
int32x4_t v_fy = vmovq_n_s32(fy);
- fx += fdx; fy += fdy;
- v_fx = vsetq_lane_s32(fx, v_fx, 1);
- v_fy = vsetq_lane_s32(fy, v_fy, 1);
- fx += fdx; fy += fdy;
- v_fx = vsetq_lane_s32(fx, v_fx, 2);
- v_fy = vsetq_lane_s32(fy, v_fy, 2);
- fx += fdx; fy += fdy;
- v_fx = vsetq_lane_s32(fx, v_fx, 3);
- v_fy = vsetq_lane_s32(fy, v_fy, 3);
- fx += fdx; fy += fdy;
+ v_fx = vsetq_lane_s32(fx + fdx, v_fx, 1);
+ v_fy = vsetq_lane_s32(fy + fdy, v_fy, 1);
+ v_fx = vsetq_lane_s32(fx + fdx * 2, v_fx, 2);
+ v_fy = vsetq_lane_s32(fy + fdy * 2, v_fy, 2);
+ v_fx = vsetq_lane_s32(fx + fdx * 3, v_fx, 3);
+ v_fy = vsetq_lane_s32(fy + fdy * 3, v_fy, 3);
const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
const int32x4_t v_round = vdupq_n_s32(0x0800);
@@ -2453,33 +2450,33 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
while (b < boundedEnd) {
uint32x4x2_t v_top, v_bot;
- int32x4_t v_fx_shifted, v_fy_shifted;
- v_fx_shifted = vshrq_n_s32(v_fx, 16);
- v_fy_shifted = vshrq_n_s32(v_fy, 16);
-
- int x1 = vgetq_lane_s32(v_fx_shifted, 0);
- int y1 = vgetq_lane_s32(v_fy_shifted, 0);
+ int x1 = (fx >> 16);
+ int y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
const uchar *sl = textureData + bytesPerLine * y1;
const uint *s1 = reinterpret_cast<const uint *>(sl);
const uint *s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
v_top = vld2q_lane_u32(s1 + x1, v_top, 0);
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 0);
- x1 = vgetq_lane_s32(v_fx_shifted, 1);
- y1 = vgetq_lane_s32(v_fy_shifted, 1);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
sl = textureData + bytesPerLine * y1;
s1 = reinterpret_cast<const uint *>(sl);
s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
v_top = vld2q_lane_u32(s1 + x1, v_top, 1);
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 1);
- x1 = vgetq_lane_s32(v_fx_shifted, 2);
- y1 = vgetq_lane_s32(v_fy_shifted, 2);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
sl = textureData + bytesPerLine * y1;
s1 = reinterpret_cast<const uint *>(sl);
s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
v_top = vld2q_lane_u32(s1 + x1, v_top, 2);
v_bot = vld2q_lane_u32(s2 + x1, v_bot, 2);
- x1 = vgetq_lane_s32(v_fx_shifted, 3);
- y1 = vgetq_lane_s32(v_fy_shifted, 3);
+ x1 = (fx >> 16);
+ y1 = (fy >> 16);
+ fx += fdx; fy += fdy;
sl = textureData + bytesPerLine * y1;
s1 = reinterpret_cast<const uint *>(sl);
s2 = reinterpret_cast<const uint *>(sl + bytesPerLine);
@@ -2501,8 +2498,6 @@ static const uint * QT_FASTCALL fetchTransformedBilinearARGB32PM(uint *buffer, c
v_fx = vaddq_s32(v_fx, v_fdx);
v_fy = vaddq_s32(v_fy, v_fdy);
}
- fx = vgetq_lane_s32(v_fx, 0);
- fy = vgetq_lane_s32(v_fy, 0);
#endif
}
@@ -2980,10 +2975,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
if (x1 != x2)
break;
- sbuf1[i * 2 + 0] = ((const uint*)s1)[x1];
- sbuf1[i * 2 + 1] = ((const uint*)s1)[x2];
- sbuf2[i * 2 + 0] = ((const uint*)s2)[x1];
- sbuf2[i * 2 + 1] = ((const uint*)s2)[x2];
+ sbuf1[i * 2 + 0] = sbuf1[i * 2 + 1] = ((const uint*)s1)[x1];
+ sbuf2[i * 2 + 0] = sbuf2[i * 2 + 1] = ((const uint*)s2)[x1];
fx += fdx;
}
int fastLen;
@@ -3102,6 +3095,16 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
fy += fdy;
}
+ int fastLen = len;
+ if (fdx > 0)
+ fastLen = qMin(fastLen, int((qint64(image_x2) * fixed_scale - fx) / fdx));
+ else if (fdx < 0)
+ fastLen = qMin(fastLen, int((qint64(image_x1) * fixed_scale - fx) / fdx));
+ if (fdy > 0)
+ fastLen = qMin(fastLen, int((qint64(image_y2) * fixed_scale - fy) / fdy));
+ else if (fdy < 0)
+ fastLen = qMin(fastLen, int((qint64(image_y1) * fixed_scale - fy) / fdy));
+ fastLen -= 3;
const __m128i v_fdx = _mm_set1_epi32(fdx*4);
const __m128i v_fdy = _mm_set1_epi32(fdy*4);
@@ -3111,15 +3114,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
const uchar *s1 = data->texture.imageData;
const uchar *s2 = s1 + bytesPerLine;
const __m128i vbpl = _mm_shufflelo_epi16(_mm_cvtsi32_si128(bytesPerLine/4), _MM_SHUFFLE(0, 0, 0, 0));
- for (; i < len-3; i+=4) {
- if (fdx > 0 && (short)_mm_extract_epi16(v_fx, 7) >= image_x2)
- break;
- if (fdx < 0 && (short)_mm_extract_epi16(v_fx, 7) < image_x1)
- break;
- if (fdy > 0 && (short)_mm_extract_epi16(v_fy, 7) >= image_y2)
- break;
- if (fdy < 0 && (short)_mm_extract_epi16(v_fy, 7) < image_y1)
- break;
+ for (; i < fastLen; i += 4) {
const __m128i vy = _mm_packs_epi32(_mm_srai_epi32(v_fy, 16), _mm_setzero_si128());
__m128i voffset = _mm_unpacklo_epi16(_mm_mullo_epi16(vy, vbpl), _mm_mulhi_epu16(vy, vbpl));
voffset = _mm_add_epi32(voffset, _mm_srli_epi32(v_fx, 16));
@@ -5555,17 +5550,17 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic, // ARGB32
blend_transformed_argb, // ARGB32_Premultiplied
blend_transformed_rgb565,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
+ blend_src_generic, // ARGB8565_Premultiplied
+ blend_src_generic, // RGB666
+ blend_src_generic, // ARGB6666_Premultiplied
+ blend_src_generic, // RGB555
+ blend_src_generic, // ARGB8555_Premultiplied
+ blend_src_generic, // RGB888
+ blend_src_generic, // RGB444
+ blend_src_generic, // ARGB4444_Premultiplied
+ blend_src_generic, // RGBX8888
+ blend_src_generic, // RGBA8888
+ blend_src_generic, // RGBA8888_Premultiplied
blend_src_generic_rgb64,
blend_src_generic_rgb64,
blend_src_generic_rgb64,
@@ -5583,16 +5578,17 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic, // ARGB32
blend_transformed_tiled_argb, // ARGB32_Premultiplied
blend_transformed_tiled_rgb565,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
+ blend_src_generic, // ARGB8565_Premultiplied
+ blend_src_generic, // RGB666
+ blend_src_generic, // ARGB6666_Premultiplied
+ blend_src_generic, // RGB555
+ blend_src_generic, // ARGB8555_Premultiplied
+ blend_src_generic, // RGB888
+ blend_src_generic, // RGB444
+ blend_src_generic, // ARGB4444_Premultiplied
+ blend_src_generic, // RGBX8888
+ blend_src_generic, // RGBA8888
+ blend_src_generic, // RGBA8888_Premultiplied
blend_src_generic_rgb64,
blend_src_generic_rgb64,
blend_src_generic_rgb64,
@@ -5610,17 +5606,17 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
blend_src_generic, // ARGB32
blend_src_generic, // ARGB32_Premultiplied
blend_transformed_bilinear_rgb565,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
- blend_src_generic,
+ blend_src_generic, // ARGB8565_Premultiplied
+ blend_src_generic, // RGB666
+ blend_src_generic, // ARGB6666_Premultiplied
+ blend_src_generic, // RGB555
+ blend_src_generic, // ARGB8555_Premultiplied
+ blend_src_generic, // RGB888
+ blend_src_generic, // RGB444
+ blend_src_generic, // ARGB4444_Premultiplied
+ blend_src_generic, // RGBX8888
+ blend_src_generic, // RGBA8888
+ blend_src_generic, // RGBA8888_Premultiplied
blend_src_generic_rgb64,
blend_src_generic_rgb64,
blend_src_generic_rgb64,
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 664117a730..45a3174734 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -636,6 +636,22 @@ static Q_ALWAYS_INLINE uint BYTE_MUL(uint x, uint a) {
}
#endif
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src)
+{
+ if (src >= 0xff000000)
+ dst = src;
+ else if (src != 0)
+ dst = src + BYTE_MUL(dst, qAlpha(~src));
+}
+
+static Q_ALWAYS_INLINE void blend_pixel(quint32 &dst, const quint32 src, const int const_alpha)
+{
+ if (src != 0) {
+ const quint32 s = BYTE_MUL(src, const_alpha);
+ dst = s + BYTE_MUL(dst, qAlpha(~s));
+ }
+}
+
#if defined(__SSE2__)
static Q_ALWAYS_INLINE uint interpolate_4_pixels_sse2(__m128i vt, __m128i vb, uint distx, uint disty)
{
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index 7cd3e9ca1b..2026a4e656 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -45,15 +45,6 @@
QT_BEGIN_NAMESPACE
-inline static void blend_pixel(quint32 &dst, const quint32 src)
-{
- if (src >= 0xff000000)
- dst = src;
- else if (src != 0)
- dst = src + BYTE_MUL(dst, qAlpha(~src));
-}
-
-
/* The instruction palignr uses direct arguments, so we have to generate the code fo the different
shift (4, 8, 12). Checking the alignment inside the loop is unfortunatelly way too slow.
*/
diff --git a/src/gui/painting/qdrawingprimitive_sse2_p.h b/src/gui/painting/qdrawingprimitive_sse2_p.h
index 8799dff92a..7affc63b32 100644
--- a/src/gui/painting/qdrawingprimitive_sse2_p.h
+++ b/src/gui/painting/qdrawingprimitive_sse2_p.h
@@ -171,11 +171,7 @@ QT_BEGIN_NAMESPACE
\
/* First, get dst aligned. */ \
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
- uint s = src[x]; \
- if (s >= 0xff000000) \
- dst[x] = s; \
- else if (s != 0) \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ blend_pixel(dst[x], src[x]); \
} \
\
for (; x < length-3; x += 4) { \
@@ -183,11 +179,7 @@ QT_BEGIN_NAMESPACE
BLEND_SOURCE_OVER_ARGB32_SSE2_helper(dst, srcVector, nullVector, half, one, colorMask, alphaMask) \
} \
for (; x < length; ++x) { \
- uint s = src[x]; \
- if (s >= 0xff000000) \
- dst[x] = s; \
- else if (s != 0) \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
+ blend_pixel(dst[x], src[x]); \
} \
}
@@ -207,11 +199,7 @@ QT_BEGIN_NAMESPACE
int x = 0; \
\
ALIGNMENT_PROLOGUE_16BYTES(dst, x, length) { \
- quint32 s = src[x]; \
- if (s != 0) { \
- s = BYTE_MUL(s, const_alpha); \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
- } \
+ blend_pixel(dst[x], src[x], const_alpha); \
} \
\
for (; x < length-3; x += 4) { \
@@ -232,11 +220,7 @@ QT_BEGIN_NAMESPACE
} \
} \
for (; x < length; ++x) { \
- quint32 s = src[x]; \
- if (s != 0) { \
- s = BYTE_MUL(s, const_alpha); \
- dst[x] = s + BYTE_MUL(dst[x], qAlpha(~s)); \
- } \
+ blend_pixel(dst[x], src[x], const_alpha); \
} \
}
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index e8f29ce520..a3a3f20b18 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -663,11 +663,8 @@ struct QtFontDesc
static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef, bool multi)
{
fontDef->family = desc.family->name;
- if (! desc.foundry->name.isEmpty() && desc.family->count > 1) {
- fontDef->family += QString::fromLatin1(" [");
- fontDef->family += desc.foundry->name;
- fontDef->family += QLatin1Char(']');
- }
+ if (! desc.foundry->name.isEmpty() && desc.family->count > 1)
+ fontDef->family += QLatin1String(" [") + desc.foundry->name + QLatin1Char(']');
if (desc.style->smoothScalable
|| QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fontsAlwaysScalable()
@@ -842,9 +839,13 @@ QStringList QPlatformFontDatabase::fallbacksForFamily(const QString &family, QFo
return retList;
}
+static void initializeDb();
+
static QStringList fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
{
QFontDatabasePrivate *db = privateDb();
+ if (!db->count)
+ initializeDb();
const FallbacksCacheKey cacheKey = { family, style, styleHint, script };
diff --git a/src/gui/text/qplatformfontdatabase.cpp b/src/gui/text/qplatformfontdatabase.cpp
index 0d7cb204ff..b83affecdc 100644
--- a/src/gui/text/qplatformfontdatabase.cpp
+++ b/src/gui/text/qplatformfontdatabase.cpp
@@ -395,10 +395,8 @@ void QPlatformFontDatabase::releaseHandle(void *handle)
QString QPlatformFontDatabase::fontDir() const
{
QString fontpath = QString::fromLocal8Bit(qgetenv("QT_QPA_FONTDIR"));
- if (fontpath.isEmpty()) {
- fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath);
- fontpath += QLatin1String("/fonts");
- }
+ if (fontpath.isEmpty())
+ fontpath = QLibraryInfo::location(QLibraryInfo::LibrariesPath) + QLatin1String("/fonts");
return fontpath;
}
diff --git a/src/gui/text/qtextimagehandler.cpp b/src/gui/text/qtextimagehandler.cpp
index 18311ed161..f7117bfe0a 100644
--- a/src/gui/text/qtextimagehandler.cpp
+++ b/src/gui/text/qtextimagehandler.cpp
@@ -61,10 +61,10 @@ static QString resolveFileName(QString fileName, QUrl *url, qreal targetDevicePi
// Also, QFile{Info}::exists works only on filepaths (not urls)
if (url->isValid()) {
- if (url->scheme() == QLatin1Literal("qrc")) {
+ if (url->scheme() == QLatin1String("qrc")) {
fileName = fileName.right(fileName.length() - 3);
}
- else if (url->scheme() == QLatin1Literal("file")) {
+ else if (url->scheme() == QLatin1String("file")) {
fileName = url->toLocalFile();
}
}