summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/corelib/global/qglobal.cpp130
-rw-r--r--src/corelib/global/qsysinfo.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp12
-rw-r--r--src/gui/painting/qcompositionfunctions.cpp223
-rw-r--r--src/gui/painting/qdrawhelper_p.h14
-rw-r--r--src/network/access/access.pri59
-rw-r--r--src/network/access/http2/http2streams_p.h2
-rw-r--r--src/network/access/qabstractprotocolhandler.cpp4
-rw-r--r--src/network/access/qabstractprotocolhandler_p.h4
-rw-r--r--src/network/access/qhttp2protocolhandler.cpp4
-rw-r--r--src/network/access/qhttp2protocolhandler_p.h6
-rw-r--r--src/network/access/qhttpmultipart.h2
-rw-r--r--src/network/access/qhttpmultipart_p.h2
-rw-r--r--src/network/access/qhttpnetworkconnection.cpp4
-rw-r--r--src/network/access/qhttpnetworkconnection_p.h4
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel.cpp4
-rw-r--r--src/network/access/qhttpnetworkconnectionchannel_p.h6
-rw-r--r--src/network/access/qhttpnetworkheader.cpp4
-rw-r--r--src/network/access/qhttpnetworkheader_p.h8
-rw-r--r--src/network/access/qhttpnetworkreply.cpp4
-rw-r--r--src/network/access/qhttpnetworkreply_p.h7
-rw-r--r--src/network/access/qhttpnetworkrequest.cpp4
-rw-r--r--src/network/access/qhttpnetworkrequest_p.h7
-rw-r--r--src/network/access/qhttpprotocolhandler.cpp4
-rw-r--r--src/network/access/qhttpprotocolhandler_p.h4
-rw-r--r--src/network/access/qhttpthreaddelegate.cpp4
-rw-r--r--src/network/access/qhttpthreaddelegate_p.h4
-rw-r--r--src/network/access/qnetworkaccessmanager.cpp20
-rw-r--r--src/network/access/qnetworkaccessmanager.h7
-rw-r--r--src/network/access/qnetworkaccessmanager_p.h2
-rw-r--r--src/network/access/qnetworkreplyhttpimpl.cpp4
-rw-r--r--src/network/access/qnetworkreplyhttpimpl_p.h4
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp4
-rw-r--r--src/network/access/qspdyprotocolhandler_p.h6
-rw-r--r--src/network/kernel/qnetworkproxy.cpp12
-rw-r--r--src/network/socket/qhttpsocketengine.cpp4
-rw-r--r--src/network/socket/qhttpsocketengine_p.h4
-rw-r--r--src/network/socket/socket.pri9
-rw-r--r--tests/auto/gui/kernel/qwindow/tst_qwindow.cpp53
-rw-r--r--tests/manual/qsysinfo/main.cpp4
40 files changed, 353 insertions, 312 deletions
diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp
index 6ab45e1487..619436e3db 100644
--- a/src/corelib/global/qglobal.cpp
+++ b/src/corelib/global/qglobal.cpp
@@ -1,7 +1,7 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtCore module of the Qt Toolkit.
@@ -73,6 +73,10 @@
#include <Ws2tcpip.h>
#endif // Q_OS_WINRT
+#ifdef Q_OS_WIN
+# include <qt_windows.h>
+#endif
+
#if defined(Q_OS_VXWORKS) && defined(_WRS_KERNEL)
# include <envLib.h>
#endif
@@ -2818,10 +2822,11 @@ QString QSysInfo::prettyProductName()
This function returns the same as QHostInfo::localHostName().
- \sa QHostInfo::localDomainName
+ \sa QHostInfo::localDomainName, machineUniqueId()
*/
QString QSysInfo::machineHostName()
{
+ // the hostname can change, so we can't cache it
#if defined(Q_OS_LINUX)
// gethostname(3) on Linux just calls uname(2), so do it ourselves
// and avoid a memcpy
@@ -2844,6 +2849,127 @@ QString QSysInfo::machineHostName()
}
#endif // QT_BOOTSTRAPPED
+enum {
+ UuidStringLen = sizeof("00000000-0000-0000-0000-000000000000") - 1
+};
+
+/*!
+ \since 5.10
+
+ Returns a unique ID for this machine, if one can be determined. If no
+ unique ID could be determined, this function returns an empty byte array.
+ Unlike machineHostName(), the value returned by this function is likely
+ globally unique.
+
+ A unique ID is useful in network operations to identify this machine for an
+ extended period of time, when the IP address could change or if this
+ machine could have more than one IP address. For example, the ID could be
+ used when communicating with a server or when storing device-specific data
+ in shared network storage.
+
+ Note that on some systems, this value will persist across reboots and on
+ some it will not. Applications should not blindly depend on this fact
+ without verifying the OS capabilities. In particular, on Linux systems,
+ this ID is usually permanent and it matches the D-Bus machine ID, except
+ for nodes without their own storage (replicated nodes).
+
+ \sa machineHostName(), bootUniqueId()
+*/
+QByteArray QSysInfo::machineUniqueId()
+{
+ // the machine unique ID cannot change
+ static const QByteArray cache = []() {
+#ifdef Q_OS_BSD4
+ char uuid[UuidStringLen];
+ size_t uuidlen = sizeof(uuid);
+# ifdef KERN_HOSTUUID
+ int name[] = { CTL_KERN, KERN_HOSTUUID };
+ if (sysctl(name, sizeof name / sizeof name[0], &uuid, &uuidlen, nullptr, 0) == 0
+ && uuidlen == sizeof(uuid))
+ return QByteArray(uuid, uuidlen);
+
+# else
+ // Darwin: no fixed value, we need to search by name
+ if (sysctlbyname("kern.uuid", uuid, &uuidlen, nullptr, 0) == 0 && uuidlen == sizeof(uuid))
+ return QByteArray(uuid, uuidlen);
+# endif
+#elif defined(Q_OS_UNIX)
+ // The modern name on Linux is /etc/machine-id, but that path is
+ // unlikely to exist on non-Linux (non-systemd) systems. The old
+ // path is more than enough.
+ static const char fullfilename[] = "/usr/local/var/lib/dbus/machine-id";
+ const char *firstfilename = fullfilename + sizeof("/usr/local") - 1;
+ int fd = qt_safe_open(firstfilename, O_RDONLY);
+ if (fd == -1 && errno == ENOENT)
+ fd = qt_safe_open(fullfilename, O_RDONLY);
+
+ if (fd != -1) {
+ char buffer[32]; // 128 bits, hex-encoded
+ qint64 len = qt_safe_read(fd, buffer, sizeof(buffer));
+ qt_safe_close(fd);
+
+ if (len != -1)
+ return QByteArray(buffer, len);
+ }
+#elif defined(Q_OS_WIN) && !defined(Q_OS_WINRT)
+ // Let's poke at the registry
+ HKEY key = NULL;
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"SOFTWARE\\Microsoft\\Cryptography", 0, KEY_READ, &key)
+ == ERROR_SUCCESS) {
+ wchar_t buffer[UuidStringLen + 1];
+ DWORD size = sizeof(buffer);
+ bool ok = (RegQueryValueEx(key, L"MachineGuid", NULL, NULL, (LPBYTE)buffer, &size) ==
+ ERROR_SUCCESS);
+ RegCloseKey(key);
+ if (ok)
+ return QStringView(buffer, (size - 1) / 2).toLatin1();
+ }
+#endif
+ return QByteArray();
+ }();
+ return cache;
+}
+
+/*!
+ \since 5.10
+
+ Returns a unique ID for this machine's boot, if one can be determined. If
+ no unique ID could be determined, this function returns an empty byte
+ array. This value is expected to change after every boot and can be
+ considered globally unique.
+
+ This function is currently only implemented for Linux and Apple operating
+ systems.
+
+ \sa machineUniqueId()
+*/
+QByteArray QSysInfo::bootUniqueId()
+{
+ // the boot unique ID cannot change
+ static const QByteArray cache = []() {
+#ifdef Q_OS_LINUX
+ // use low-level API here for simplicity
+ int fd = qt_safe_open("/proc/sys/kernel/random/boot_id", O_RDONLY);
+ if (fd != -1) {
+ char uuid[UuidStringLen];
+ qint64 len = qt_safe_read(fd, uuid, sizeof(uuid));
+ qt_safe_close(fd);
+ if (len == UuidStringLen)
+ return QByteArray(uuid, UuidStringLen);
+ }
+#elif defined(Q_OS_DARWIN)
+ // "kern.bootsessionuuid" is only available by name
+ char uuid[UuidStringLen];
+ size_t uuidlen = sizeof(uuid);
+ if (sysctlbyname("kern.bootsessionuuid", uuid, &uuidlen, nullptr, 0) == 0
+ && uuidlen == sizeof(uuid))
+ return QByteArray(uuid, uuidlen);
+#endif
+ return QByteArray();
+ }();
+ return cache;
+};
+
/*!
\macro void Q_ASSERT(bool test)
\relates <QtGlobal>
diff --git a/src/corelib/global/qsysinfo.h b/src/corelib/global/qsysinfo.h
index 6b73a17dc5..a3fa0fcb27 100644
--- a/src/corelib/global/qsysinfo.h
+++ b/src/corelib/global/qsysinfo.h
@@ -240,6 +240,8 @@ QT_WARNING_POP
static QString prettyProductName();
static QString machineHostName();
+ static QByteArray machineUniqueId();
+ static QByteArray bootUniqueId();
};
#undef QT_SYSINFO_DEPRECATED_X
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index d967b03fee..f566677ff4 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1852,7 +1852,7 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
only see a press in a new location without any intervening moves. This could
confuse code that is written for a real mouse. The same is true for mouse
release events that change position, see tst_QWidget::touchEventSynthesizedMouseEvent()
- auto test.
+ and tst_QWindow::generatedMouseMove() auto tests.
*/
void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e)
{
@@ -1874,7 +1874,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (!mouseMove && positionChanged) {
QWindowSystemInterfacePrivate::MouseEvent moveEvent(window, e->timestamp,
- e->localPos, e->globalPos, e->buttons & ~button, e->modifiers, Qt::NoButton,
+ e->localPos, e->globalPos, e->buttons ^ button, e->modifiers, Qt::NoButton,
e->nonClientArea ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove,
e->source, e->nonClientArea);
if (e->synthetic())
@@ -1977,14 +1977,14 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
const QPointF nativeLocalPoint = QHighDpi::toNativePixels(localPoint, screen);
const QPointF nativeGlobalPoint = QHighDpi::toNativePixels(globalPoint, screen);
QMouseEvent ev(type, nativeLocalPoint, nativeLocalPoint, nativeGlobalPoint,
- button, mouse_buttons, e->modifiers, e->source);
+ button, e->buttons, e->modifiers, e->source);
ev.setTimestamp(e->timestamp);
cursor->pointerEvent(ev);
}
}
#endif
- QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, mouse_buttons, e->modifiers, e->source);
+ QMouseEvent ev(type, localPoint, localPoint, globalPoint, button, e->buttons, e->modifiers, e->source);
ev.setTimestamp(e->timestamp);
if (window->d_func()->blockedByModalWindow && !qApp->d_func()->popupActive()) {
@@ -2018,7 +2018,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
point.state = Qt::TouchPointPressed;
} else if (type == QEvent::MouseButtonRelease && button == Qt::LeftButton) {
point.state = Qt::TouchPointReleased;
- } else if (type == QEvent::MouseMove && (mouse_buttons & Qt::LeftButton)) {
+ } else if (type == QEvent::MouseMove && (e->buttons & Qt::LeftButton)) {
point.state = Qt::TouchPointMoved;
} else {
return;
@@ -2039,7 +2039,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo
if (!e->window.isNull() || e->nullWindow()) { // QTBUG-36364, check if window closed in response to press
const QEvent::Type doubleClickType = e->nonClientArea ? QEvent::NonClientAreaMouseButtonDblClick : QEvent::MouseButtonDblClick;
QMouseEvent dblClickEvent(doubleClickType, localPoint, localPoint, globalPoint,
- button, mouse_buttons, e->modifiers, e->source);
+ button, e->buttons, e->modifiers, e->source);
dblClickEvent.setTimestamp(e->timestamp);
QGuiApplication::sendSpontaneousEvent(window, &dblClickEvent);
}
diff --git a/src/gui/painting/qcompositionfunctions.cpp b/src/gui/painting/qcompositionfunctions.cpp
index ee05f810f1..339a9749b8 100644
--- a/src/gui/painting/qcompositionfunctions.cpp
+++ b/src/gui/painting/qcompositionfunctions.cpp
@@ -38,16 +38,11 @@
****************************************************************************/
#include <qglobal.h>
-#include <private/qdrawhelper_p.h>
-#include <private/qrgba64_p.h>
+#include "qdrawhelper_p.h"
+#include "qrgba64_p.h"
QT_BEGIN_NAMESPACE
-# define PRELOAD_INIT(x)
-# define PRELOAD_INIT2(x,y)
-# define PRELOAD_COND(x)
-# define PRELOAD_COND2(x,y)
-
/* The constant alpha factor describes an alpha factor that gets applied
to the result of the composition operation combining it with the destination.
@@ -69,24 +64,6 @@ QT_BEGIN_NAMESPACE
where the source is an array of pixels.
*/
-/*
- result = 0
- d = d * cia
-*/
-#define comp_func_Clear_impl(dest, length, const_alpha)\
-{\
- if (const_alpha == 255) {\
- QT_MEMFILL_UINT(dest, length, 0);\
- } else {\
- int ialpha = 255 - const_alpha;\
- PRELOAD_INIT(dest)\
- for (int i = 0; i < length; ++i) {\
- PRELOAD_COND(dest)\
- dest[i] = BYTE_MUL(dest[i], ialpha);\
- }\
- }\
-}
-
#if defined __SSE2__
# define LOAD(ptr) _mm_loadl_epi64(reinterpret_cast<const __m128i *>(ptr))
#ifdef Q_PROCESSOR_X86_64
@@ -117,38 +94,41 @@ QT_BEGIN_NAMESPACE
# define INVALPHA(c) (65535 - ALPHA(c))
#endif
+
+/*
+ result = 0
+ d = d * cia
+*/
void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
{
- comp_func_Clear_impl(dest, length, const_alpha);
+ if (const_alpha == 255) {
+ qt_memfill32(dest, 0, length);
+ } else {
+ uint ialpha = 255 - const_alpha;
+ for (int i = 0; i < length; ++i)
+ dest[i] = BYTE_MUL(dest[i], ialpha);
+ }
}
void QT_FASTCALL comp_func_solid_Clear_rgb64(QRgba64 *dest, int length, QRgba64, uint const_alpha)
{
- if (const_alpha == 255)
+ if (const_alpha == 255) {
qt_memfill64((quint64*)dest, 0, length);
- else {
- int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i) {
+ } else {
+ uint ialpha = 255 - const_alpha;
+ for (int i = 0; i < length; ++i)
STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
- }
}
}
void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint const_alpha)
{
- comp_func_Clear_impl(dest, length, const_alpha);
+ comp_func_solid_Clear(dest, length, 0, const_alpha);
}
void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int length, uint const_alpha)
{
- if (const_alpha == 255)
- qt_memfill64((quint64*)dest, 0, length);
- else {
- int ialpha = 255 - const_alpha;
- for (int i = 0; i < length; ++i) {
- STORE(&dest[i], multiplyAlpha255(LOAD(&dest[i]), ialpha));
- }
- }
+ comp_func_solid_Clear_rgb64(dest, length, QRgba64(), const_alpha);
}
/*
@@ -158,13 +138,11 @@ void QT_FASTCALL comp_func_Clear_rgb64(QRgba64 *dest, const QRgba64 *, int lengt
void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255) {
- QT_MEMFILL_UINT(dest, length, color);
+ qt_memfill32(dest, color, length);
} else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], ialpha);
}
}
@@ -175,7 +153,7 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
if (const_alpha == 255)
qt_memfill64((quint64*)dest, color, length);
else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
auto c = multiplyAlpha255(CONVERT(color), const_alpha);
for (int i = 0; i < length; ++i) {
STORE(&dest[i], ADD(c, multiplyAlpha255(LOAD(&dest[i]), ialpha)));
@@ -186,12 +164,10 @@ void QT_FASTCALL comp_func_solid_Source_rgb64(QRgba64 *dest, int length, QRgba64
void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255) {
- ::memcpy(dest, src, length * sizeof(uint));
+ ::memcpy(dest, src, size_t(length) * sizeof(uint));
} else {
- int ialpha = 255 - const_alpha;
- PRELOAD_INIT2(dest, src)
+ uint ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = INTERPOLATE_PIXEL_255(src[i], const_alpha, dest[i], ialpha);
}
}
@@ -200,9 +176,9 @@ void QT_FASTCALL comp_func_Source(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL
void QT_FASTCALL comp_func_Source_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba64 *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
if (const_alpha == 255)
- ::memcpy(dest, src, length * sizeof(quint64));
+ ::memcpy(dest, src, size_t(length) * sizeof(quint64));
else {
- int ialpha = 255 - const_alpha;
+ uint ialpha = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
STORE(&dest[i], interpolate255(LOAD(&src[i]), const_alpha, LOAD(&dest[i]), ialpha));
}
@@ -234,13 +210,11 @@ void QT_FASTCALL comp_func_Destination_rgb64(QRgba64 *, const QRgba64 *, int, ui
void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha)
{
if ((const_alpha & qAlpha(color)) == 255) {
- QT_MEMFILL_UINT(dest, length, color);
+ qt_memfill32(dest, color, length);
} else {
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = color + BYTE_MUL(dest[i], qAlpha(~color));
}
}
@@ -263,10 +237,8 @@ void QT_FASTCALL comp_func_solid_SourceOver_rgb64(QRgba64 *dest, int length, QRg
void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
if (s >= 0xff000000)
dest[i] = s;
@@ -275,7 +247,6 @@ void QT_FASTCALL comp_func_SourceOver(uint *Q_DECL_RESTRICT dest, const uint *Q_
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = s + BYTE_MUL(dest[i], qAlpha(~s));
}
@@ -309,9 +280,7 @@ void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint co
{
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = d + BYTE_MUL(color, qAlpha(~d));
}
@@ -330,16 +299,13 @@ void QT_FASTCALL comp_func_solid_DestinationOver_rgb64(QRgba64 *dest, int length
void QT_FASTCALL comp_func_DestinationOver(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
dest[i] = d + BYTE_MUL(src[i], qAlpha(~d));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = d + BYTE_MUL(s, qAlpha(~d));
@@ -369,17 +335,14 @@ void QT_FASTCALL comp_func_DestinationOver_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
*/
void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha)
{
- PRELOAD_INIT(dest)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(dest[i]));
}
} else {
color = BYTE_MUL(color, const_alpha);
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(d), d, cia);
}
@@ -389,32 +352,30 @@ void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, ui
void QT_FASTCALL comp_func_solid_SourceIn_rgb64(QRgba64 *dest, int length, QRgba64 color, uint const_alpha)
{
if (const_alpha == 255) {
+ auto c = CONVERT(color);
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(color, dest[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(c, dest[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
- uint cia = 65535 - ca;
- color = multiplyAlpha65535(color, ca);
+ auto cia = CONST(65535 - ca);
+ auto c = multiplyAlpha65535(CONVERT(color), ca);
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = interpolate65535(color, d.alpha(), d, cia);
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], interpolate65535(c, ALPHA(d), d, cia));
}
}
}
void QT_FASTCALL comp_func_SourceIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(dest[i]));
}
} else {
uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, cia);
@@ -450,9 +411,7 @@ void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint colo
if (const_alpha != 255) {
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
}
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
}
}
@@ -470,16 +429,13 @@ void QT_FASTCALL comp_func_solid_DestinationIn_rgb64(QRgba64 *dest, int length,
void QT_FASTCALL comp_func_DestinationIn(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(src[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint a = BYTE_MUL(qAlpha(src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], a);
}
@@ -490,14 +446,14 @@ void QT_FASTCALL comp_func_DestinationIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, co
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- dest[i] = multiplyAlpha65535(dest[i], src[i].alpha());
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), src[i].alpha()));
}
} else {
uint ca = const_alpha * 257;
uint cia = 65535 - ca;
for (int i = 0; i < length; ++i) {
uint a = qt_div_65535(src[i].alpha() * ca) + cia;
- dest[i] = multiplyAlpha65535(dest[i], a);
+ STORE(&dest[i], multiplyAlpha65535(LOAD(&dest[i]), a));
}
}
}
@@ -509,17 +465,14 @@ void QT_FASTCALL comp_func_DestinationIn_rgb64(QRgba64 *Q_DECL_RESTRICT dest, co
void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha)
{
- PRELOAD_INIT(dest)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(color, qAlpha(~dest[i]));
}
} else {
color = BYTE_MUL(color, const_alpha);
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, cia);
}
@@ -545,16 +498,13 @@ void QT_FASTCALL comp_func_solid_SourceOut_rgb64(QRgba64 *dest, int length, QRgb
void QT_FASTCALL comp_func_SourceOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(src[i], qAlpha(~dest[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, cia);
@@ -589,9 +539,7 @@ void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint col
uint a = qAlpha(~color);
if (const_alpha != 255)
a = BYTE_MUL(a, const_alpha) + 255 - const_alpha;
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = BYTE_MUL(dest[i], a);
}
}
@@ -609,16 +557,13 @@ void QT_FASTCALL comp_func_solid_DestinationOut_rgb64(QRgba64 *dest, int length,
void QT_FASTCALL comp_func_DestinationOut(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
dest[i] = BYTE_MUL(dest[i], qAlpha(~src[i]));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint sia = BYTE_MUL(qAlpha(~src[i]), const_alpha) + cia;
dest[i] = BYTE_MUL(dest[i], sia);
}
@@ -653,9 +598,7 @@ void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color,
color = BYTE_MUL(color, const_alpha);
}
uint sia = qAlpha(~color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(dest[i]), dest[i], sia);
}
}
@@ -672,17 +615,14 @@ void QT_FASTCALL comp_func_solid_SourceAtop_rgb64(QRgba64 *dest, int length, QRg
void QT_FASTCALL comp_func_SourceAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(d), d, qAlpha(~s));
@@ -719,9 +659,7 @@ void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint co
color = BYTE_MUL(color, const_alpha);
a = qAlpha(color) + 255 - const_alpha;
}
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, a, color, qAlpha(~d));
}
@@ -742,18 +680,15 @@ void QT_FASTCALL comp_func_solid_DestinationAtop_rgb64(QRgba64 *dest, int length
void QT_FASTCALL comp_func_DestinationAtop(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = src[i];
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(d, qAlpha(s), s, qAlpha(~d));
}
} else {
- int cia = 255 - const_alpha;
+ uint cia = 255 - const_alpha;
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint s = BYTE_MUL(src[i], const_alpha);
uint d = dest[i];
uint a = qAlpha(s) + cia;
@@ -771,8 +706,8 @@ void QT_FASTCALL comp_func_DestinationAtop_rgb64(QRgba64 *Q_DECL_RESTRICT dest,
dest[i] = interpolate65535(d, s.alpha(), s, 65535 - d.alpha());
}
} else {
- int ca = const_alpha * 257;
- int cia = 65535 - ca;
+ uint ca = const_alpha * 257;
+ uint cia = 65535 - ca;
for (int i = 0; i < length; ++i) {
QRgba64 s = multiplyAlpha65535(src[i], ca);
QRgba64 d = dest[i];
@@ -794,9 +729,7 @@ void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint co
color = BYTE_MUL(color, const_alpha);
uint sia = qAlpha(~color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
dest[i] = INTERPOLATE_PIXEL_255(color, qAlpha(~d), d, sia);
}
@@ -806,26 +739,24 @@ void QT_FASTCALL comp_func_solid_XOR_rgb64(QRgba64 *dest, int length, QRgba64 co
{
if (const_alpha != 255)
color = multiplyAlpha255(color, const_alpha);
- uint sia = 65535 - color.alpha();
+ auto s = CONVERT(color);
+ auto sia = CONST(65535 - color.alpha());
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- dest[i] = interpolate65535(color, 65535 - d.alpha(), d, sia);
+ auto d = LOAD(&dest[i]);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, sia));
}
}
void QT_FASTCALL comp_func_XOR(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, uint const_alpha)
{
- PRELOAD_INIT2(dest, src)
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
}
} else {
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = BYTE_MUL(src[i], const_alpha);
dest[i] = INTERPOLATE_PIXEL_255(s, qAlpha(~d), d, qAlpha(~s));
@@ -837,15 +768,15 @@ void QT_FASTCALL comp_func_XOR_rgb64(QRgba64 *Q_DECL_RESTRICT dest, const QRgba6
{
if (const_alpha == 255) {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = src[i];
- dest[i] = interpolate65535(s, 65535 - d.alpha(), d, 65535 - s.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = LOAD(&src[i]);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, INVALPHA(s)));
}
} else {
for (int i = 0; i < length; ++i) {
- QRgba64 d = dest[i];
- QRgba64 s = multiplyAlpha255(src[i], const_alpha);
- dest[i] = interpolate65535(s, 65535 - d.alpha(), d, 65535 - s.alpha());
+ auto d = LOAD(&dest[i]);
+ auto s = multiplyAlpha255(LOAD(&src[i]), const_alpha);
+ STORE(&dest[i], interpolate65535(s, INVALPHA(d), d, INVALPHA(s)));
}
}
}
@@ -901,9 +832,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Plus_impl(uint *dest, int
{
uint s = color;
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
d = comp_func_Plus_one_pixel(d, s);
coverage.store(&dest[i], d);
@@ -940,9 +869,7 @@ void QT_FASTCALL comp_func_solid_Plus_rgb64(QRgba64 *dest, int length, QRgba64 c
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1001,9 +928,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Multiply_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1060,9 +985,7 @@ void QT_FASTCALL comp_func_solid_Multiply_rgb64(QRgba64 *dest, int length, QRgba
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Multiply_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1129,9 +1052,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Screen_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1188,9 +1109,7 @@ void QT_FASTCALL comp_func_solid_Screen_rgb64(QRgba64 *dest, int length, QRgba64
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Screen_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1277,9 +1196,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Overlay_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1336,9 +1253,7 @@ void QT_FASTCALL comp_func_solid_Overlay_rgb64(QRgba64 *dest, int length, QRgba6
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Overlay_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1415,9 +1330,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Darken_impl(uint *dest, i
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1474,9 +1387,7 @@ void QT_FASTCALL comp_func_solid_Darken_rgb64(QRgba64 *dest, int length, QRgba64
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Darken_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1553,9 +1464,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Lighten_impl(uint *dest,
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1612,9 +1521,7 @@ void QT_FASTCALL comp_func_solid_Lighten_rgb64(QRgba64 *dest, int length, QRgba6
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Lighten_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1709,9 +1616,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorDodge_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1768,9 +1673,7 @@ void QT_FASTCALL comp_func_solid_ColorDodge_rgb64(QRgba64 *dest, int length, QRg
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorDodge_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -1865,9 +1768,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorBurn_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -1924,9 +1825,7 @@ void QT_FASTCALL comp_func_solid_ColorBurn_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_ColorBurn_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2015,9 +1914,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_HardLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2074,9 +1971,7 @@ void QT_FASTCALL comp_func_solid_HardLight_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_HardLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2178,9 +2073,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_SoftLight_impl(uint *dest
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2237,9 +2130,7 @@ void QT_FASTCALL comp_func_solid_SoftLight_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_SoftLight_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2316,9 +2207,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Difference_impl(uint *des
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2375,9 +2264,7 @@ void QT_FASTCALL comp_func_solid_Difference_rgb64(QRgba64 *dest, int length, QRg
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Difference_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
@@ -2443,9 +2330,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void QT_FASTCALL comp_func_solid_Exclusion_imp
int sg = qGreen(color);
int sb = qBlue(color);
- PRELOAD_INIT(dest)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND(dest)
uint d = dest[i];
int da = qAlpha(d);
@@ -2503,9 +2388,7 @@ void QT_FASTCALL comp_func_solid_Exclusion_rgb64(QRgba64 *dest, int length, QRgb
template <typename T>
Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Exclusion_impl(uint *Q_DECL_RESTRICT dest, const uint *Q_DECL_RESTRICT src, int length, const T &coverage)
{
- PRELOAD_INIT2(dest, src)
for (int i = 0; i < length; ++i) {
- PRELOAD_COND2(dest, src)
uint d = dest[i];
uint s = src[i];
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 2be10d2cfb..2db139d794 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1160,23 +1160,23 @@ const uint qt_bayer_matrix[16][16] = {
#if Q_PROCESSOR_WORDSIZE == 8 // 64-bit versions
-#define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
-#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define AMIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
+#define MIX(mask) (qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
#else // 32 bits
// The mask for alpha can overflow over 32 bits
-#define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define AMIX(mask) quint32(qMin(((quint64(s)&mask) + (quint64(d)&mask)), quint64(mask)))
#define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask)))
#endif
-inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
+inline uint comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
{
- const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ const uint result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
}
-inline int comp_func_Plus_one_pixel(uint d, const uint s)
+inline uint comp_func_Plus_one_pixel(uint d, const uint s)
{
- const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ const uint result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
return result;
}
diff --git a/src/network/access/access.pri b/src/network/access/access.pri
index e8669dcec8..1d6a04a424 100644
--- a/src/network/access/access.pri
+++ b/src/network/access/access.pri
@@ -1,14 +1,6 @@
# Qt network access module
HEADERS += \
- access/qhttpnetworkheader_p.h \
- access/qhttpnetworkrequest_p.h \
- access/qhttpnetworkreply_p.h \
- access/qhttpnetworkconnection_p.h \
- access/qhttpnetworkconnectionchannel_p.h \
- access/qabstractprotocolhandler_p.h \
- access/qhttpprotocolhandler_p.h \
- access/qspdyprotocolhandler_p.h \
access/qnetworkaccessauthenticationmanager_p.h \
access/qnetworkaccessmanager.h \
access/qnetworkaccessmanager_p.h \
@@ -27,28 +19,15 @@ HEADERS += \
access/qnetworkreply_p.h \
access/qnetworkreplyimpl_p.h \
access/qnetworkreplydataimpl_p.h \
- access/qnetworkreplyhttpimpl_p.h \
access/qnetworkreplyfileimpl_p.h \
access/qabstractnetworkcache_p.h \
access/qabstractnetworkcache.h \
- access/qhttpthreaddelegate_p.h \
- access/qhttpmultipart.h \
- access/qhttpmultipart_p.h \
access/qnetworkfile_p.h \
- access/qhttp2protocolhandler_p.h \
access/qhsts_p.h \
access/qhstspolicy.h \
access/qhstsstore_p.h
SOURCES += \
- access/qhttpnetworkheader.cpp \
- access/qhttpnetworkrequest.cpp \
- access/qhttpnetworkreply.cpp \
- access/qhttpnetworkconnection.cpp \
- access/qhttpnetworkconnectionchannel.cpp \
- access/qabstractprotocolhandler.cpp \
- access/qhttpprotocolhandler.cpp \
- access/qspdyprotocolhandler.cpp \
access/qnetworkaccessauthenticationmanager.cpp \
access/qnetworkaccessmanager.cpp \
access/qnetworkaccesscache.cpp \
@@ -62,13 +41,9 @@ SOURCES += \
access/qnetworkreply.cpp \
access/qnetworkreplyimpl.cpp \
access/qnetworkreplydataimpl.cpp \
- access/qnetworkreplyhttpimpl.cpp \
access/qnetworkreplyfileimpl.cpp \
access/qabstractnetworkcache.cpp \
- access/qhttpthreaddelegate.cpp \
- access/qhttpmultipart.cpp \
access/qnetworkfile.cpp \
- access/qhttp2protocolhandler.cpp \
access/qhsts.cpp \
access/qhstspolicy.cpp \
access/qhstsstore.cpp
@@ -94,4 +69,36 @@ qtConfig(networkdiskcache) {
mac: LIBS_PRIVATE += -framework Security
include($$PWD/../../3rdparty/zlib_dependency.pri)
-include($$PWD/http2/http2.pri)
+
+qtConfig(http) {
+ include($$PWD/http2/http2.pri)
+
+ SOURCES += \
+ access/qabstractprotocolhandler.cpp \
+ access/qhttp2protocolhandler.cpp \
+ access/qhttpmultipart.cpp \
+ access/qhttpnetworkconnection.cpp \
+ access/qhttpnetworkconnectionchannel.cpp \
+ access/qhttpnetworkheader.cpp \
+ access/qhttpnetworkreply.cpp \
+ access/qhttpnetworkrequest.cpp \
+ access/qhttpprotocolhandler.cpp \
+ access/qhttpthreaddelegate.cpp \
+ access/qnetworkreplyhttpimpl.cpp \
+ access/qspdyprotocolhandler.cpp
+
+ HEADERS += \
+ access/qabstractprotocolhandler_p.h \
+ access/qhttp2protocolhandler_p.h \
+ access/qhttpmultipart.h \
+ access/qhttpmultipart_p.h \
+ access/qhttpnetworkconnection_p.h \
+ access/qhttpnetworkconnectionchannel_p.h \
+ access/qhttpnetworkheader_p.h \
+ access/qhttpnetworkreply_p.h \
+ access/qhttpnetworkrequest_p.h \
+ access/qhttpprotocolhandler_p.h \
+ access/qhttpthreaddelegate_p.h \
+ access/qnetworkreplyhttpimpl_p.h \
+ access/qspdyprotocolhandler_p.h
+}
diff --git a/src/network/access/http2/http2streams_p.h b/src/network/access/http2/http2streams_p.h
index 8465486ae8..0be6b3b253 100644
--- a/src/network/access/http2/http2streams_p.h
+++ b/src/network/access/http2/http2streams_p.h
@@ -62,6 +62,8 @@
#include <vector>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QNonContiguousByteDevice;
diff --git a/src/network/access/qabstractprotocolhandler.cpp b/src/network/access/qabstractprotocolhandler.cpp
index d408f3b37a..f15dfe6899 100644
--- a/src/network/access/qabstractprotocolhandler.cpp
+++ b/src/network/access/qabstractprotocolhandler.cpp
@@ -40,8 +40,6 @@
#include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h>
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QAbstractProtocolHandler::QAbstractProtocolHandler(QHttpNetworkConnectionChannel *channel)
@@ -62,5 +60,3 @@ void QAbstractProtocolHandler::setReply(QHttpNetworkReply *reply)
}
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qabstractprotocolhandler_p.h b/src/network/access/qabstractprotocolhandler_p.h
index 30814d6737..04a07734dd 100644
--- a/src/network/access/qabstractprotocolhandler_p.h
+++ b/src/network/access/qabstractprotocolhandler_p.h
@@ -53,7 +53,7 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -81,6 +81,4 @@ protected:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif // QABSTRACTPROTOCOLHANDLER_H
diff --git a/src/network/access/qhttp2protocolhandler.cpp b/src/network/access/qhttp2protocolhandler.cpp
index c261a8042f..dbcbcff8d1 100644
--- a/src/network/access/qhttp2protocolhandler.cpp
+++ b/src/network/access/qhttp2protocolhandler.cpp
@@ -40,8 +40,6 @@
#include "qhttpnetworkconnection_p.h"
#include "qhttp2protocolhandler_p.h"
-#if !defined(QT_NO_HTTP)
-
#include "http2/bitstreams_p.h"
#include <private/qnoncontiguousbytedevice_p.h>
@@ -1512,5 +1510,3 @@ void QHttp2ProtocolHandler::closeSession()
}
QT_END_NAMESPACE
-
-#endif // !defined(QT_NO_HTTP)
diff --git a/src/network/access/qhttp2protocolhandler_p.h b/src/network/access/qhttp2protocolhandler_p.h
index a006663491..b338934691 100644
--- a/src/network/access/qhttp2protocolhandler_p.h
+++ b/src/network/access/qhttp2protocolhandler_p.h
@@ -55,8 +55,6 @@
#include <private/qabstractprotocolhandler_p.h>
#include <private/qhttpnetworkrequest_p.h>
-#if !defined(QT_NO_HTTP)
-
#include "http2/http2protocol_p.h"
#include "http2/http2streams_p.h"
#include "http2/http2frames_p.h"
@@ -75,6 +73,8 @@
#include <deque>
#include <set>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QHttp2ProtocolHandler : public QObject, public QAbstractProtocolHandler
@@ -228,6 +228,4 @@ private:
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP)
-
#endif
diff --git a/src/network/access/qhttpmultipart.h b/src/network/access/qhttpmultipart.h
index 9e95e82a77..78585a704d 100644
--- a/src/network/access/qhttpmultipart.h
+++ b/src/network/access/qhttpmultipart.h
@@ -46,6 +46,8 @@
#include <QtCore/QIODevice>
#include <QtNetwork/QNetworkRequest>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
diff --git a/src/network/access/qhttpmultipart_p.h b/src/network/access/qhttpmultipart_p.h
index 342ec775b4..363e0b346c 100644
--- a/src/network/access/qhttpmultipart_p.h
+++ b/src/network/access/qhttpmultipart_p.h
@@ -56,6 +56,8 @@
#include "qnetworkrequest_p.h" // for deriving QHttpPartPrivate from QNetworkHeadersPrivate
#include "private/qobject_p.h"
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
diff --git a/src/network/access/qhttpnetworkconnection.cpp b/src/network/access/qhttpnetworkconnection.cpp
index 459296bef4..842a73a2f9 100644
--- a/src/network/access/qhttpnetworkconnection.cpp
+++ b/src/network/access/qhttpnetworkconnection.cpp
@@ -53,8 +53,6 @@
#include <qpair.h>
#include <qdebug.h>
-#ifndef QT_NO_HTTP
-
#ifndef QT_NO_SSL
# include <private/qsslsocket_p.h>
# include <QtNetwork/qsslkey.h>
@@ -1556,5 +1554,3 @@ void QHttpNetworkConnectionPrivate::emitProxyAuthenticationRequired(const QHttpN
QT_END_NAMESPACE
#include "moc_qhttpnetworkconnection_p.cpp"
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpnetworkconnection_p.h b/src/network/access/qhttpnetworkconnection_p.h
index 96a7b2e122..91827a6eb1 100644
--- a/src/network/access/qhttpnetworkconnection_p.h
+++ b/src/network/access/qhttpnetworkconnection_p.h
@@ -71,7 +71,7 @@
#include <private/qhttpnetworkconnectionchannel_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -296,6 +296,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp
index e6d9c07cef..0ac14c78f6 100644
--- a/src/network/access/qhttpnetworkconnectionchannel.cpp
+++ b/src/network/access/qhttpnetworkconnectionchannel.cpp
@@ -45,8 +45,6 @@
#include <qpair.h>
#include <qdebug.h>
-#ifndef QT_NO_HTTP
-
#include <private/qhttp2protocolhandler_p.h>
#include <private/qhttpprotocolhandler_p.h>
#include <private/qspdyprotocolhandler_p.h>
@@ -1321,5 +1319,3 @@ void QHttpNetworkConnectionChannel::setConnection(QHttpNetworkConnection *c)
QT_END_NAMESPACE
#include "moc_qhttpnetworkconnectionchannel_p.cpp"
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpnetworkconnectionchannel_p.h b/src/network/access/qhttpnetworkconnectionchannel_p.h
index 844a7d5d15..e9cdae5653 100644
--- a/src/network/access/qhttpnetworkconnectionchannel_p.h
+++ b/src/network/access/qhttpnetworkconnectionchannel_p.h
@@ -68,8 +68,6 @@
#include <private/qhttpnetworkconnection_p.h>
#include <private/qabstractprotocolhandler_p.h>
-#ifndef QT_NO_HTTP
-
#ifndef QT_NO_SSL
# include <QtNetwork/qsslsocket.h>
# include <QtNetwork/qsslerror.h>
@@ -80,6 +78,8 @@
#include <QtCore/qscopedpointer.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QHttpNetworkRequest;
@@ -216,6 +216,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qhttpnetworkheader.cpp b/src/network/access/qhttpnetworkheader.cpp
index 7199abbf17..19a3dfcfe8 100644
--- a/src/network/access/qhttpnetworkheader.cpp
+++ b/src/network/access/qhttpnetworkheader.cpp
@@ -41,8 +41,6 @@
#include <algorithm>
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QHttpNetworkHeaderPrivate::QHttpNetworkHeaderPrivate(const QUrl &newUrl)
@@ -121,5 +119,3 @@ bool QHttpNetworkHeaderPrivate::operator==(const QHttpNetworkHeaderPrivate &othe
QT_END_NAMESPACE
-
-#endif
diff --git a/src/network/access/qhttpnetworkheader_p.h b/src/network/access/qhttpnetworkheader_p.h
index 46aec1dd8c..f46c259919 100644
--- a/src/network/access/qhttpnetworkheader_p.h
+++ b/src/network/access/qhttpnetworkheader_p.h
@@ -53,11 +53,11 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
-
#include <qshareddata.h>
#include <qurl.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class Q_AUTOTEST_EXPORT QHttpNetworkHeader
@@ -99,10 +99,6 @@ public:
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
-
-
#endif // QHTTPNETWORKHEADER_H
diff --git a/src/network/access/qhttpnetworkreply.cpp b/src/network/access/qhttpnetworkreply.cpp
index 778ba821e8..a657346958 100644
--- a/src/network/access/qhttpnetworkreply.cpp
+++ b/src/network/access/qhttpnetworkreply.cpp
@@ -40,8 +40,6 @@
#include "qhttpnetworkreply_p.h"
#include "qhttpnetworkconnection_p.h"
-#ifndef QT_NO_HTTP
-
#ifndef QT_NO_SSL
# include <QtNetwork/qsslkey.h>
# include <QtNetwork/qsslcipher.h>
@@ -1035,5 +1033,3 @@ void QHttpNetworkReply::ignoreSslErrors(const QList<QSslError> &errors)
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpnetworkreply_p.h b/src/network/access/qhttpnetworkreply_p.h
index d2248740b8..863e21ea3e 100644
--- a/src/network/access/qhttpnetworkreply_p.h
+++ b/src/network/access/qhttpnetworkreply_p.h
@@ -53,8 +53,6 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
-
#include <qplatformdefs.h>
#ifndef QT_NO_COMPRESS
@@ -77,6 +75,8 @@ struct z_stream_s;
#include <private/qringbuffer_p.h>
#include <private/qbytedata_p.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QHttpNetworkConnection;
@@ -285,7 +285,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
-
#endif // QHTTPNETWORKREPLY_H
diff --git a/src/network/access/qhttpnetworkrequest.cpp b/src/network/access/qhttpnetworkrequest.cpp
index bd34ac7e05..3fcf946945 100644
--- a/src/network/access/qhttpnetworkrequest.cpp
+++ b/src/network/access/qhttpnetworkrequest.cpp
@@ -40,8 +40,6 @@
#include "qhttpnetworkrequest_p.h"
#include "private/qnoncontiguousbytedevice_p.h"
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QHttpNetworkRequestPrivate::QHttpNetworkRequestPrivate(QHttpNetworkRequest::Operation op,
@@ -395,5 +393,3 @@ int QHttpNetworkRequest::minorVersion() const
QT_END_NAMESPACE
-#endif
-
diff --git a/src/network/access/qhttpnetworkrequest_p.h b/src/network/access/qhttpnetworkrequest_p.h
index 4fd973cf3f..2cbb8e255e 100644
--- a/src/network/access/qhttpnetworkrequest_p.h
+++ b/src/network/access/qhttpnetworkrequest_p.h
@@ -52,12 +52,12 @@
//
#include <QtNetwork/private/qtnetworkglobal_p.h>
-#ifndef QT_NO_HTTP
-
#include <private/qhttpnetworkheader_p.h>
#include <QtNetwork/qnetworkrequest.h>
#include <qmetatype.h>
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
class QNonContiguousByteDevice;
@@ -188,7 +188,4 @@ QT_END_NAMESPACE
Q_DECLARE_METATYPE(QHttpNetworkRequest)
-#endif // QT_NO_HTTP
-
-
#endif // QHTTPNETWORKREQUEST_H
diff --git a/src/network/access/qhttpprotocolhandler.cpp b/src/network/access/qhttpprotocolhandler.cpp
index 37e8b9bed8..edcbdcbe0e 100644
--- a/src/network/access/qhttpprotocolhandler.cpp
+++ b/src/network/access/qhttpprotocolhandler.cpp
@@ -42,8 +42,6 @@
#include <private/qnoncontiguousbytedevice_p.h>
#include <private/qhttpnetworkconnectionchannel_p.h>
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
QHttpProtocolHandler::QHttpProtocolHandler(QHttpNetworkConnectionChannel *channel)
@@ -437,5 +435,3 @@ bool QHttpProtocolHandler::sendRequest()
}
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qhttpprotocolhandler_p.h b/src/network/access/qhttpprotocolhandler_p.h
index 902a7ea0b2..8e766604bb 100644
--- a/src/network/access/qhttpprotocolhandler_p.h
+++ b/src/network/access/qhttpprotocolhandler_p.h
@@ -55,7 +55,7 @@
#include <QtNetwork/private/qtnetworkglobal_p.h>
#include <private/qabstractprotocolhandler_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -71,6 +71,4 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qhttpthreaddelegate.cpp b/src/network/access/qhttpthreaddelegate.cpp
index cfb9ab1139..0e97acdd9d 100644
--- a/src/network/access/qhttpthreaddelegate.cpp
+++ b/src/network/access/qhttpthreaddelegate.cpp
@@ -50,8 +50,6 @@
#include "private/qnetworkaccesscache_p.h"
#include "private/qnoncontiguousbytedevice_p.h"
-#ifndef QT_NO_HTTP
-
QT_BEGIN_NAMESPACE
static QNetworkReply::NetworkError statusCodeFromHttp(int httpStatusCode, const QUrl &url)
@@ -768,6 +766,4 @@ void QHttpThreadDelegate::synchronousProxyAuthenticationRequiredSlot(const QNet
#endif
-#endif // QT_NO_HTTP
-
QT_END_NAMESPACE
diff --git a/src/network/access/qhttpthreaddelegate_p.h b/src/network/access/qhttpthreaddelegate_p.h
index 9029d6fce8..019a8b8b74 100644
--- a/src/network/access/qhttpthreaddelegate_p.h
+++ b/src/network/access/qhttpthreaddelegate_p.h
@@ -68,7 +68,7 @@
#include "qnetworkaccessauthenticationmanager_p.h"
#include <QtNetwork/private/http2protocol_p.h>
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -327,6 +327,4 @@ signals:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif // QHTTPTHREADDELEGATE_H
diff --git a/src/network/access/qnetworkaccessmanager.cpp b/src/network/access/qnetworkaccessmanager.cpp
index edf9dee78e..248b4ccd3b 100644
--- a/src/network/access/qnetworkaccessmanager.cpp
+++ b/src/network/access/qnetworkaccessmanager.cpp
@@ -66,10 +66,12 @@
#include "QtNetwork/private/qauthenticator_p.h"
#include "QtNetwork/qsslconfiguration.h"
#include "QtNetwork/qnetworkconfigmanager.h"
-#include "QtNetwork/qhttpmultipart.h"
-#include "qhttpmultipart_p.h"
+#if QT_CONFIG(http)
+#include "qhttpmultipart.h"
+#include "qhttpmultipart_p.h"
#include "qnetworkreplyhttpimpl_p.h"
+#endif
#include "qthread.h"
@@ -469,7 +471,7 @@ QNetworkAccessManager::QNetworkAccessManager(QObject *parent)
qRegisterMetaType<QSslPreSharedKeyAuthenticator *>();
#endif
qRegisterMetaType<QList<QPair<QByteArray,QByteArray> > >();
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
qRegisterMetaType<QHttpNetworkRequest>();
#endif
qRegisterMetaType<QNetworkReply::NetworkError>();
@@ -877,6 +879,7 @@ QNetworkReply *QNetworkAccessManager::post(const QNetworkRequest &request, const
return reply;
}
+#if QT_CONFIG(http)
/*!
\since 4.8
@@ -916,6 +919,7 @@ QNetworkReply *QNetworkAccessManager::put(const QNetworkRequest &request, QHttpM
QNetworkReply *reply = put(newRequest, device);
return reply;
}
+#endif // QT_CONFIG(http)
/*!
Uploads the contents of \a data to the destination \a request and
@@ -1285,6 +1289,7 @@ QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &r
return reply;
}
+#if QT_CONFIG(http)
/*!
\since 5.8
@@ -1306,6 +1311,7 @@ QNetworkReply *QNetworkAccessManager::sendCustomRequest(const QNetworkRequest &r
QNetworkReply *reply = sendCustomRequest(newRequest, verb, device);
return reply;
}
+#endif // QT_CONFIG(http)
/*!
Returns a new QNetworkReply object to handle the operation \a op
@@ -1419,7 +1425,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
}
}
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
// Since Qt 5 we use the new QNetworkReplyHttpImpl
if (scheme == QLatin1String("http") || scheme == QLatin1String("preconnect-http")
#ifndef QT_NO_SSL
@@ -1451,7 +1457,7 @@ QNetworkReply *QNetworkAccessManager::createRequest(QNetworkAccessManager::Opera
#endif
return reply;
}
-#endif // QT_NO_HTTP
+#endif // QT_CONFIG(http)
// first step: create the reply
QNetworkReplyImpl *reply = new QNetworkReplyImpl(this);
@@ -1527,7 +1533,7 @@ QStringList QNetworkAccessManager::supportedSchemesImplementation() const
QStringList schemes = d->backendSupportedSchemes();
// Those ones don't exist in backends
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
schemes << QStringLiteral("http");
#ifndef QT_NO_SSL
if (QSslSocket::supportsSsl())
@@ -1992,6 +1998,7 @@ void QNetworkAccessManagerPrivate::_q_networkSessionFailed(QNetworkSession::Sess
#endif // QT_NO_BEARERMANAGEMENT
+#if QT_CONFIG(http)
QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart)
{
// copy the request, we probably need to add some headers
@@ -2039,6 +2046,7 @@ QNetworkRequest QNetworkAccessManagerPrivate::prepareMultipart(const QNetworkReq
return newRequest;
}
+#endif // QT_CONFIG(http)
QT_END_NAMESPACE
diff --git a/src/network/access/qnetworkaccessmanager.h b/src/network/access/qnetworkaccessmanager.h
index 9cbf8a48d5..a0ce3eddcd 100644
--- a/src/network/access/qnetworkaccessmanager.h
+++ b/src/network/access/qnetworkaccessmanager.h
@@ -134,14 +134,17 @@ public:
QNetworkReply *get(const QNetworkRequest &request);
QNetworkReply *post(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data);
- QNetworkReply *post(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *put(const QNetworkRequest &request, QIODevice *data);
QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data);
- QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *deleteResource(const QNetworkRequest &request);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QIODevice *data = nullptr);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, const QByteArray &data);
+
+#if QT_CONFIG(http)
+ QNetworkReply *post(const QNetworkRequest &request, QHttpMultiPart *multiPart);
+ QNetworkReply *put(const QNetworkRequest &request, QHttpMultiPart *multiPart);
QNetworkReply *sendCustomRequest(const QNetworkRequest &request, const QByteArray &verb, QHttpMultiPart *multiPart);
+#endif
#ifndef QT_NO_BEARERMANAGEMENT
void setConfiguration(const QNetworkConfiguration &config);
diff --git a/src/network/access/qnetworkaccessmanager_p.h b/src/network/access/qnetworkaccessmanager_p.h
index e5257251a4..428110e8bc 100644
--- a/src/network/access/qnetworkaccessmanager_p.h
+++ b/src/network/access/qnetworkaccessmanager_p.h
@@ -164,7 +164,9 @@ public:
#endif
+#if QT_CONFIG(http)
QNetworkRequest prepareMultipart(const QNetworkRequest &request, QHttpMultiPart *multiPart);
+#endif
// this is the cache for storing downloaded files
QAbstractNetworkCache *networkCache;
diff --git a/src/network/access/qnetworkreplyhttpimpl.cpp b/src/network/access/qnetworkreplyhttpimpl.cpp
index 1ece623061..18d85a27a1 100644
--- a/src/network/access/qnetworkreplyhttpimpl.cpp
+++ b/src/network/access/qnetworkreplyhttpimpl.cpp
@@ -60,8 +60,6 @@
#include "qnetworkcookiejar.h"
-#ifndef QT_NO_HTTP
-
#include <string.h> // for strchr
QT_BEGIN_NAMESPACE
@@ -2385,5 +2383,3 @@ void QNetworkReplyHttpImplPrivate::completeCacheSave()
}
QT_END_NAMESPACE
-
-#endif // QT_NO_HTTP
diff --git a/src/network/access/qnetworkreplyhttpimpl_p.h b/src/network/access/qnetworkreplyhttpimpl_p.h
index 8d2bd132b0..f5f01d0811 100644
--- a/src/network/access/qnetworkreplyhttpimpl_p.h
+++ b/src/network/access/qnetworkreplyhttpimpl_p.h
@@ -72,7 +72,7 @@
#include <QtNetwork/QSslConfiguration>
#endif
-#ifndef QT_NO_HTTP
+QT_REQUIRE_CONFIG(http);
QT_BEGIN_NAMESPACE
@@ -315,6 +315,4 @@ public:
QT_END_NAMESPACE
-#endif // QT_NO_HTTP
-
#endif
diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp
index 445a2a1c29..403c01e974 100644
--- a/src/network/access/qspdyprotocolhandler.cpp
+++ b/src/network/access/qspdyprotocolhandler.cpp
@@ -43,7 +43,7 @@
#include <private/qhttpnetworkconnectionchannel_p.h>
#include <QtCore/QtEndian>
-#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#if !defined(QT_NO_SSL)
QT_BEGIN_NAMESPACE
@@ -1294,4 +1294,4 @@ qint32 QSpdyProtocolHandler::generateNextStreamID()
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#endif // !defined(QT_NO_SSL)
diff --git a/src/network/access/qspdyprotocolhandler_p.h b/src/network/access/qspdyprotocolhandler_p.h
index bfc2390ccc..dd93a9aba2 100644
--- a/src/network/access/qspdyprotocolhandler_p.h
+++ b/src/network/access/qspdyprotocolhandler_p.h
@@ -58,7 +58,9 @@
#include <zlib.h>
-#if !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+QT_REQUIRE_CONFIG(http);
+
+#if !defined(QT_NO_SSL)
QT_BEGIN_NAMESPACE
@@ -223,6 +225,6 @@ Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::SETTINGS_ID_Flags)
QT_END_NAMESPACE
-#endif // !defined(QT_NO_HTTP) && !defined(QT_NO_SSL)
+#endif // !defined(QT_NO_SSL)
#endif // QSPDYPROTOCOLHANDLER_H
diff --git a/src/network/kernel/qnetworkproxy.cpp b/src/network/kernel/qnetworkproxy.cpp
index 6b53b4b58e..3646a9526a 100644
--- a/src/network/kernel/qnetworkproxy.cpp
+++ b/src/network/kernel/qnetworkproxy.cpp
@@ -230,7 +230,11 @@
#if QT_CONFIG(socks5)
#include "private/qsocks5socketengine_p.h"
#endif
+
+#if QT_CONFIG(http)
#include "private/qhttpsocketengine_p.h"
+#endif
+
#include "qauthenticator.h"
#include "qdebug.h"
#include "qmutex.h"
@@ -256,7 +260,7 @@ public:
#if QT_CONFIG(socks5)
, socks5SocketEngineHandler(0)
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
, httpSocketEngineHandler(0)
#endif
#ifdef QT_USE_SYSTEM_PROXIES
@@ -268,7 +272,7 @@ public:
#if QT_CONFIG(socks5)
socks5SocketEngineHandler = new QSocks5SocketEngineHandler();
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
httpSocketEngineHandler = new QHttpSocketEngineHandler();
#endif
}
@@ -280,7 +284,7 @@ public:
#if QT_CONFIG(socks5)
delete socks5SocketEngineHandler;
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
delete httpSocketEngineHandler;
#endif
}
@@ -340,7 +344,7 @@ private:
#if QT_CONFIG(socks5)
QSocks5SocketEngineHandler *socks5SocketEngineHandler;
#endif
-#ifndef QT_NO_HTTP
+#if QT_CONFIG(http)
QHttpSocketEngineHandler *httpSocketEngineHandler;
#endif
bool useSystemProxies;
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp
index 082fb94e0a..b543ea7981 100644
--- a/src/network/socket/qhttpsocketengine.cpp
+++ b/src/network/socket/qhttpsocketengine.cpp
@@ -46,7 +46,7 @@
#include "qelapsedtimer.h"
#include "qnetworkinterface.h"
-#if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP)
+#if !defined(QT_NO_NETWORKPROXY)
#include <qdebug.h>
QT_BEGIN_NAMESPACE
@@ -866,4 +866,4 @@ QAbstractSocketEngine *QHttpSocketEngineHandler::createSocketEngine(qintptr, QOb
QT_END_NAMESPACE
-#endif
+#endif // !QT_NO_NETWORKPROXY
diff --git a/src/network/socket/qhttpsocketengine_p.h b/src/network/socket/qhttpsocketengine_p.h
index c8863f1fb5..cb7798694a 100644
--- a/src/network/socket/qhttpsocketengine_p.h
+++ b/src/network/socket/qhttpsocketengine_p.h
@@ -57,9 +57,11 @@
#include "qnetworkproxy.h"
#include "private/qauthenticator_p.h"
+QT_REQUIRE_CONFIG(http);
+
QT_BEGIN_NAMESPACE
-#if !defined(QT_NO_NETWORKPROXY) && !defined(QT_NO_HTTP)
+#if !defined(QT_NO_NETWORKPROXY)
class QTcpSocket;
class QHttpNetworkReply;
diff --git a/src/network/socket/socket.pri b/src/network/socket/socket.pri
index b2ee1a8054..a8a37492b7 100644
--- a/src/network/socket/socket.pri
+++ b/src/network/socket/socket.pri
@@ -1,7 +1,6 @@
# Qt network socket
HEADERS += socket/qabstractsocketengine_p.h \
- socket/qhttpsocketengine_p.h \
socket/qabstractsocket.h \
socket/qabstractsocket_p.h \
socket/qtcpsocket.h \
@@ -11,7 +10,6 @@ HEADERS += socket/qabstractsocketengine_p.h \
socket/qtcpserver_p.h
SOURCES += socket/qabstractsocketengine.cpp \
- socket/qhttpsocketengine.cpp \
socket/qabstractsocket.cpp \
socket/qtcpsocket.cpp \
socket/qudpsocket.cpp \
@@ -26,6 +24,13 @@ qtConfig(socks5) {
socket/qsocks5socketengine.cpp
}
+qtConfig(http) {
+ HEADERS += \
+ socket/qhttpsocketengine_p.h
+ SOURCES += \
+ socket/qhttpsocketengine.cpp
+}
+
# SCTP support.
qtConfig(sctp) {
diff --git a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
index a365d21d36..f2754de929 100644
--- a/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
+++ b/tests/auto/gui/kernel/qwindow/tst_qwindow.cpp
@@ -106,6 +106,7 @@ private slots:
void flags();
void cleanup();
void testBlockingWindowShownAfterModalDialog();
+ void generatedMouseMove();
private:
QPoint m_availableTopLeft;
@@ -918,6 +919,7 @@ public:
}
}
void mouseMoveEvent(QMouseEvent *event) {
+ buttonStateInGeneratedMove = event->buttons();
if (ignoreMouse) {
event->ignore();
} else {
@@ -999,6 +1001,7 @@ public:
bool ignoreMouse, ignoreTouch;
bool spinLoopWhenPressed;
+ Qt::MouseButtons buttonStateInGeneratedMove;
};
void tst_QWindow::testInputEvents()
@@ -2316,6 +2319,56 @@ void tst_QWindow::testBlockingWindowShownAfterModalDialog()
QVERIFY(normalWindowAfter.gotBlocked);
}
+void tst_QWindow::generatedMouseMove()
+{
+ InputTestWindow w;
+ w.setGeometry(QRect(m_availableTopLeft + QPoint(100, 100), m_testWindowSize));
+ w.show();
+ QVERIFY(QTest::qWaitForWindowActive(&w));
+ QPoint point(10, 10);
+ QPoint step(2, 2);
+
+ QVERIFY(w.mouseMovedCount == 0);
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::NoButton, Qt::NoButton, QEvent::MouseMove);
+ QCoreApplication::processEvents();
+ QVERIFY(w.mouseMovedCount == 1);
+ // Press that does not change position should not generate mouse move
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::LeftButton, Qt::LeftButton, QEvent::MouseButtonPress);
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::LeftButton | Qt::RightButton, Qt::RightButton, QEvent::MouseButtonPress);
+ QCoreApplication::processEvents();
+ QVERIFY(w.mouseMovedCount == 1);
+
+ // Test moves generated for mouse release
+ point += step;
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::RightButton, Qt::LeftButton, QEvent::MouseButtonRelease);
+ QCoreApplication::processEvents();
+ QVERIFY(w.mouseMovedCount == 2);
+ QVERIFY(w.buttonStateInGeneratedMove == (Qt::LeftButton | Qt::RightButton));
+ point += step;
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::NoButton, Qt::RightButton, QEvent::MouseButtonRelease);
+ QCoreApplication::processEvents();
+ QVERIFY(w.mouseMovedCount == 3);
+ QVERIFY(w.buttonStateInGeneratedMove == Qt::RightButton);
+
+ // Test moves generated for mouse press
+ point += step;
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::LeftButton, Qt::LeftButton, QEvent::MouseButtonPress);
+ QCoreApplication::processEvents();
+ QVERIFY(w.mouseMovedCount == 4);
+ QVERIFY(w.buttonStateInGeneratedMove == Qt::NoButton);
+ point += step;
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::LeftButton | Qt::RightButton, Qt::RightButton, QEvent::MouseButtonPress);
+ QCoreApplication::processEvents();
+ QVERIFY(w.mouseMovedCount == 5);
+ QVERIFY(w.buttonStateInGeneratedMove == Qt::LeftButton);
+
+ // Release that does not change position should not generate mouse move
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::LeftButton, Qt::RightButton, QEvent::MouseButtonRelease);
+ QWindowSystemInterface::handleMouseEvent(&w, point, point, Qt::NoButton, Qt::LeftButton, QEvent::MouseButtonRelease);
+ QCoreApplication::processEvents();
+ QVERIFY(w.mouseMovedCount == 5);
+}
+
#include <tst_qwindow.moc>
QTEST_MAIN(tst_QWindow)
diff --git a/tests/manual/qsysinfo/main.cpp b/tests/manual/qsysinfo/main.cpp
index 5b391e5dfd..62d0c51416 100644
--- a/tests/manual/qsysinfo/main.cpp
+++ b/tests/manual/qsysinfo/main.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 Intel Corporation.
+** Copyright (C) 2017 Intel Corporation.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the test suite of the Qt Toolkit.
@@ -133,6 +133,8 @@ int main(int argc, char *argv[])
printf("QSysInfo::productVersion() = %s\n", qPrintable(QSysInfo::productVersion()));
printf("QSysInfo::prettyProductName() = %s\n", qPrintable(QSysInfo::prettyProductName()));
printf("QSysInfo::machineHostName() = %s\n", qPrintable(QSysInfo::machineHostName()));
+ printf("QSysInfo::machineUniqueId() = %s\n", QSysInfo::machineUniqueId().constData());
+ printf("QSysInfo::bootUniqueId() = %s\n", qPrintable(QSysInfo::bootUniqueId()));
const auto osv = QOperatingSystemVersion::current();
printf("QOperatingSystemVersion::current() = %s %d.%d.%d\n",