summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessibleobject.cpp2
-rw-r--r--src/gui/configure.json18
-rw-r--r--src/gui/doc/src/dnd.qdoc4
-rw-r--r--src/gui/kernel/qguiapplication.cpp20
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h2
-rw-r--r--src/gui/kernel/qplatformsystemtrayicon.cpp14
-rw-r--r--src/gui/kernel/qplatformtheme.cpp7
-rw-r--r--src/gui/kernel/qplatformwindow.cpp2
-rw-r--r--src/gui/kernel/qsimpledrag.cpp37
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp7
-rw-r--r--src/gui/opengl/qopengl.cpp22
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp5
-rw-r--r--src/gui/opengl/qopenglversionfunctions.cpp18
-rw-r--r--src/gui/opengl/qopenglvertexarrayobject.cpp94
-rw-r--r--src/gui/painting/qcolor.cpp8
-rw-r--r--src/gui/painting/qcoregraphics.mm2
-rw-r--r--src/gui/painting/qdrawhelper.cpp66
-rw-r--r--src/gui/painting/qdrawhelper_p.h8
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp18
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp2
-rw-r--r--src/gui/text/qfont.cpp2
-rw-r--r--src/gui/text/qtexthtmlparser_p.h6
22 files changed, 213 insertions, 151 deletions
diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp
index b67b8062ba..2ef8502ad5 100644
--- a/src/gui/accessible/qaccessibleobject.cpp
+++ b/src/gui/accessible/qaccessibleobject.cpp
@@ -125,7 +125,7 @@ QAccessibleInterface *QAccessibleObject::childAt(int x, int y) const
for (int i = 0; i < childCount(); ++i) {
QAccessibleInterface *childIface = child(i);
Q_ASSERT(childIface);
- if (childIface->rect().contains(x,y))
+ if (childIface->isValid() && childIface->rect().contains(x,y))
return childIface;
}
return 0;
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 5ab0b98c69..02032dee8f 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -160,8 +160,8 @@
"test": "unix/libpng",
"sources": [
{ "type": "pkgConfig", "args": "libpng" },
- { "libs": "-llibpng", "condition": "config.msvc" },
- { "libs": "-lpng", "condition": "!config.msvc" }
+ { "libs": "-llibpng -lzdll", "condition": "config.msvc" },
+ { "libs": "-lpng -lz", "condition": "!config.msvc" }
]
},
"mirclient": {
@@ -331,7 +331,7 @@
"use": "egl xcb_xlib"
},
"egl-brcm": {
- "label": "Broadcom EGL (Rasberry Pi)",
+ "label": "Broadcom EGL (Raspberry Pi)",
"type": "compile",
"test": "qpa/eglfs-brcm",
"use": "egl bcm_host"
@@ -432,6 +432,7 @@
},
"directfb": {
"label": "DirectFB",
+ "section": "Platform plugins",
"autoDetect": false,
"condition": "libs.directfb",
"output": [ "privateFeature" ]
@@ -450,6 +451,7 @@
},
"direct2d": {
"label": "Direct 2D",
+ "section": "Platform plugins",
"condition": "config.win32 && !config.winrt && libs.direct2d",
"output": [ "privateFeature" ]
},
@@ -502,6 +504,7 @@
},
"integrityfb": {
"label": "INTEGRITY framebuffer",
+ "section": "Platform plugins",
"condition": "config.integrity",
"output": [ "privateFeature" ]
},
@@ -528,11 +531,13 @@
},
"linuxfb": {
"label": "LinuxFB",
+ "section": "Platform plugins",
"condition": "tests.linuxfb",
"output": [ "privateFeature" ]
},
"mirclient": {
"label": "Mir client",
+ "section": "Platform plugins",
"condition": "libs.mirclient",
"output": [ "privateFeature" ]
},
@@ -608,12 +613,13 @@
},
"eglfs": {
"label": "EGLFS",
+ "section": "Platform plugins",
"autoDetect": "!config.android && !config.win32",
"condition": "features.egl",
"output": [ "privateFeature" ]
},
"eglfs_brcm": {
- "label": "EGLFS Rasberry Pi",
+ "label": "EGLFS Raspberry Pi",
"condition": "features.eglfs && tests.egl-brcm",
"output": [ "privateFeature" ]
},
@@ -644,6 +650,7 @@
},
"gif": {
"label": "GIF",
+ "condition": "features.imageformatplugin",
"output": [
"privateFeature",
{ "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_GIF" }
@@ -651,11 +658,13 @@
},
"ico": {
"label": "ICO",
+ "condition": "features.imageformatplugin",
"output": [ "privateFeature", "feature" ]
},
"jpeg": {
"label": "JPEG",
"disable": "input.libjpeg == 'no'",
+ "condition": "features.imageformatplugin",
"output": [
"privateFeature",
{ "type": "define", "negative": true, "name": "QT_NO_IMAGEFORMAT_JPEG" }
@@ -705,6 +714,7 @@
},
"xcb": {
"label": "XCB",
+ "section": "Platform plugins",
"autoDetect": "!config.darwin",
"condition": "libs.xcb",
"output": [ "privateFeature" ]
diff --git a/src/gui/doc/src/dnd.qdoc b/src/gui/doc/src/dnd.qdoc
index 03b3cbfa24..945c485705 100644
--- a/src/gui/doc/src/dnd.qdoc
+++ b/src/gui/doc/src/dnd.qdoc
@@ -343,9 +343,7 @@
Applications can also communicate with each other by putting data on
the clipboard. To access this, you need to obtain a QClipboard object
- from the QApplication object:
-
- \snippet ../widgets/widgets/charactermap/mainwindow.cpp 3
+ from the QApplication object.
The QMimeData class is used to represent data that is transferred to and
from the clipboard. To put data on the clipboard, you can use the
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 3438fc0dcd..2faf970855 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -757,6 +757,14 @@ void QGuiApplicationPrivate::updateBlockedStatus(QWindow *window)
updateBlockedStatusRecursion(window, shouldBeBlocked);
}
+// Return whether the window needs to be notified about window blocked events.
+// As opposed to QGuiApplication::topLevelWindows(), embedded windows are
+// included in this list (QTBUG-18099).
+static inline bool needsWindowBlockedEvent(const QWindow *w)
+{
+ return w->isTopLevel() && w->type() != Qt::Desktop;
+}
+
void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
{
self->modalWindowList.prepend(modal);
@@ -774,10 +782,8 @@ void QGuiApplicationPrivate::showModalWindow(QWindow *modal)
}
}
- QWindowList windows = QGuiApplication::topLevelWindows();
- for (int i = 0; i < windows.count(); ++i) {
- QWindow *window = windows.at(i);
- if (!window->d_func()->blockedByModalWindow)
+ for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
+ if (needsWindowBlockedEvent(window) && !window->d_func()->blockedByModalWindow)
updateBlockedStatus(window);
}
@@ -788,10 +794,8 @@ void QGuiApplicationPrivate::hideModalWindow(QWindow *window)
{
self->modalWindowList.removeAll(window);
- QWindowList windows = QGuiApplication::topLevelWindows();
- for (int i = 0; i < windows.count(); ++i) {
- QWindow *window = windows.at(i);
- if (window->d_func()->blockedByModalWindow)
+ for (QWindow *window : qAsConst(QGuiApplicationPrivate::window_list)) {
+ if (needsWindowBlockedEvent(window) && window->d_func()->blockedByModalWindow)
updateBlockedStatus(window);
}
}
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index 11bbaae592..db9d0596b6 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -79,7 +79,7 @@ public:
void setCursorPos(const QPoint &pos);
signals:
- void deviceListChanged(DeviceType type);
+ void deviceListChanged(QInputDeviceManager::DeviceType type);
void cursorPositionChangeRequested(const QPoint &pos);
};
diff --git a/src/gui/kernel/qplatformsystemtrayicon.cpp b/src/gui/kernel/qplatformsystemtrayicon.cpp
index 30db966df7..973b998059 100644
--- a/src/gui/kernel/qplatformsystemtrayicon.cpp
+++ b/src/gui/kernel/qplatformsystemtrayicon.cpp
@@ -40,6 +40,9 @@
#include "qplatformsystemtrayicon.h"
+#include <QtGui/private/qguiapplication_p.h>
+#include <QtGui/qpa/qplatformtheme.h>
+
#ifndef QT_NO_SYSTEMTRAYICON
QT_BEGIN_NAMESPACE
@@ -158,11 +161,10 @@ QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon()
*/
/*!
- This method is called in case there is no QPlatformMenu available when
- updating the menu. This allows the abstraction to provide a menu for the
- system tray icon even if normally a non-native menu is used.
-
- The default implementation returns a null pointer.
+ This method allows platforms to use a different QPlatformMenu for system
+ tray menus than what would normally be used for e.g. menu bars. The default
+ implementation falls back to a platform menu created by the platform theme,
+ which may be null on platforms without native menus.
\sa updateMenu()
\since 5.3
@@ -170,7 +172,7 @@ QPlatformSystemTrayIcon::~QPlatformSystemTrayIcon()
QPlatformMenu *QPlatformSystemTrayIcon::createMenu() const
{
- return Q_NULLPTR;
+ return QGuiApplicationPrivate::platformTheme()->createPlatformMenu();
}
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp
index 931c784d08..878f656f2e 100644
--- a/src/gui/kernel/qplatformtheme.cpp
+++ b/src/gui/kernel/qplatformtheme.cpp
@@ -80,6 +80,10 @@ QT_BEGIN_NAMESPACE
\value MouseDoubleClickInterval (int) Mouse double click interval in ms,
overriding QPlatformIntegration::styleHint.
+ \value MouseDoubleClickDistance (int) The maximum distance in logical pixels which the mouse can travel
+ between clicks in order for the click sequence to be handled as a double click.
+ The default value is 5 logical pixels.
+
\value MousePressAndHoldInterval (int) Mouse press and hold interval in ms,
overriding QPlatformIntegration::styleHint.
@@ -89,6 +93,9 @@ QT_BEGIN_NAMESPACE
\value StartDragTime (int) Start drag time in ms,
overriding QPlatformIntegration::styleHint.
+ \value WheelScrollLines (int) The number of lines to scroll a widget, when the mouse wheel is rotated.
+ The default value is 3. \sa QApplication::wheelScrollLines()
+
\value KeyboardAutoRepeatRate (int) Keyboard auto repeat rate,
overriding QPlatformIntegration::styleHint.
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index 2f8a678c38..6fd2afb1aa 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -60,7 +60,7 @@ QPlatformWindow::QPlatformWindow(QWindow *window)
, d_ptr(new QPlatformWindowPrivate)
{
Q_D(QPlatformWindow);
- d->rect = window->geometry();
+ d->rect = QHighDpi::toNativePixels(window->geometry(), window);
}
/*!
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index a6ce04dc34..fc62273325 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -53,6 +53,8 @@
#include "qdir.h"
#include "qimagereader.h"
#include "qimagewriter.h"
+#include "qplatformscreen.h"
+#include "qplatformwindow.h"
#include <QtCore/QEventLoop>
#include <QtCore/QDebug>
@@ -316,6 +318,25 @@ void QBasicDrag::updateCursor(Qt::DropAction action)
updateAction(action);
}
+
+static inline QPoint fromNativeGlobalPixels(const QPoint &point)
+{
+#ifndef QT_NO_HIGHDPISCALING
+ QPoint res = point;
+ if (QHighDpiScaling::isActive()) {
+ for (const QScreen *s : qAsConst(QGuiApplicationPrivate::screen_list)) {
+ if (s->handle()->geometry().contains(point)) {
+ res = QHighDpi::fromNativePixels(point, s);
+ break;
+ }
+ }
+ }
+ return res;
+#else
+ return point;
+#endif
+}
+
/*!
\class QSimpleDrag
\brief QSimpleDrag implements QBasicDrag for Drag and Drop operations within the Qt Application itself.
@@ -344,7 +365,7 @@ void QSimpleDrag::startDrag()
QBasicDrag::startDrag();
m_current_window = topLevelAt(QCursor::pos());
if (m_current_window) {
- QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_current_window, drag()->mimeData(), QCursor::pos(), drag()->supportedActions());
+ QPlatformDragQtResponse response = QWindowSystemInterface::handleDrag(m_current_window, drag()->mimeData(), QHighDpi::toNativePixels(QCursor::pos(), m_current_window), drag()->supportedActions());
setCanDrop(response.isAccepted());
updateCursor(response.acceptedAction());
} else {
@@ -363,15 +384,15 @@ void QSimpleDrag::cancel()
}
}
-void QSimpleDrag::move(const QPoint &globalPos)
+void QSimpleDrag::move(const QPoint &nativeGlobalPos)
{
- //### not high-DPI aware
+ QPoint globalPos = fromNativeGlobalPixels(nativeGlobalPos);
moveShapedPixmapWindow(globalPos);
QWindow *window = topLevelAt(globalPos);
if (!window)
return;
- const QPoint pos = globalPos - window->geometry().topLeft();
+ const QPoint pos = nativeGlobalPos - window->handle()->geometry().topLeft();
const QPlatformDragQtResponse qt_response =
QWindowSystemInterface::handleDrag(window, drag()->mimeData(), pos, drag()->supportedActions());
@@ -379,16 +400,16 @@ void QSimpleDrag::move(const QPoint &globalPos)
setCanDrop(qt_response.isAccepted());
}
-void QSimpleDrag::drop(const QPoint &globalPos)
+void QSimpleDrag::drop(const QPoint &nativeGlobalPos)
{
- //### not high-DPI aware
+ QPoint globalPos = fromNativeGlobalPixels(nativeGlobalPos);
- QBasicDrag::drop(globalPos);
+ QBasicDrag::drop(nativeGlobalPos);
QWindow *window = topLevelAt(globalPos);
if (!window)
return;
- const QPoint pos = globalPos - window->geometry().topLeft();
+ const QPoint pos = nativeGlobalPos - window->handle()->geometry().topLeft();
const QPlatformDropQtResponse response =
QWindowSystemInterface::handleDrop(window, drag()->mimeData(),pos, drag()->supportedActions());
if (response.isAccepted()) {
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 813b0f72bb..b273682b97 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -962,6 +962,13 @@ Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *window, const QPointF &local, con
QWindowSystemInterface::handleMouseEvent<QWindowSystemInterface::SynchronousDelivery>(window, timestamp, local * factor, global * factor, b, mods);
}
+// Wrapper for compatibility with Qt < 5.6
+// ### Qt6: Remove
+Q_GUI_EXPORT void qt_handleMouseEvent(QWindow *w, const QPointF &local, const QPointF &global, Qt::MouseButtons b, Qt::KeyboardModifiers mods = Qt::NoModifier)
+{
+ qt_handleMouseEvent(w, local, global, b, mods, QWindowSystemInterfacePrivate::eventTime.elapsed());
+}
+
Q_GUI_EXPORT void qt_handleKeyEvent(QWindow *window, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1)
{
QWindowSystemInterface::handleKeyEvent<QWindowSystemInterface::SynchronousDelivery>(window, t, k, mods, text, autorep, count);
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index e61473cb7b..7e663d48bb 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -65,6 +65,10 @@ typedef const GLubyte * (QOPENGLF_APIENTRYP qt_glGetStringi)(GLenum, GLuint);
QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
{
QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ if (!ctx) {
+ qWarning("QOpenGLExtensionMatcher::QOpenGLExtensionMatcher: No context");
+ return;
+ }
QOpenGLFunctions *funcs = ctx->functions();
const char *extensionStr = 0;
@@ -80,19 +84,17 @@ QOpenGLExtensionMatcher::QOpenGLExtensionMatcher()
// clear error state
while (funcs->glGetError()) {}
- if (ctx) {
- qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");
+ qt_glGetStringi glGetStringi = (qt_glGetStringi)ctx->getProcAddress("glGetStringi");
- if (!glGetStringi)
- return;
+ if (!glGetStringi)
+ return;
- GLint numExtensions = 0;
- funcs->glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
+ GLint numExtensions = 0;
+ funcs->glGetIntegerv(GL_NUM_EXTENSIONS, &numExtensions);
- for (int i = 0; i < numExtensions; ++i) {
- const char *str = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
- m_extensions.insert(str);
- }
+ for (int i = 0; i < numExtensions; ++i) {
+ const char *str = reinterpret_cast<const char *>(glGetStringi(GL_EXTENSIONS, i));
+ m_extensions.insert(str);
}
#endif // QT_OPENGL_3
}
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index e4e7c6d1b5..ad8b19a2bc 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -2196,9 +2196,10 @@ QOpenGLFunctionsPrivate::QOpenGLFunctionsPrivate(QOpenGLContext *c)
#ifndef QT_OPENGL_ES_2
// setup fallbacks in case some methods couldn't get resolved
- if (!f.ClearDepthf)
+ bool es = QOpenGLContext::currentContext()->isOpenGLES();
+ if (!f.ClearDepthf || !es)
f.ClearDepthf = qopenglfSpecialClearDepthf;
- if (!f.DepthRangef)
+ if (!f.DepthRangef || !es)
f.DepthRangef = qopenglfSpecialDepthRangef;
if (!f.GetShaderPrecisionFormat)
f.GetShaderPrecisionFormat = qopenglfSpecialGetShaderPrecisionFormat;
diff --git a/src/gui/opengl/qopenglversionfunctions.cpp b/src/gui/opengl/qopenglversionfunctions.cpp
index 54df2e5734..a3d3bb6bd1 100644
--- a/src/gui/opengl/qopenglversionfunctions.cpp
+++ b/src/gui/opengl/qopenglversionfunctions.cpp
@@ -74,15 +74,21 @@ QOpenGLVersionFunctionsStorage::QOpenGLVersionFunctionsStorage()
QOpenGLVersionFunctionsStorage::~QOpenGLVersionFunctionsStorage()
{
+#ifndef QT_OPENGL_ES
if (backends) {
- for (int i = 0; i < QOpenGLVersionFunctionsBackend::OpenGLVersionBackendCount; ++i) {
- if (backends[i] && !--backends[i]->refs) {
- // deleting the base class is ok, as the derived classes don't have a destructor
- delete backends[i];
- }
- }
+
+ int i = 0;
+
+#define DELETE_BACKEND(X) \
+ if (backends[i] && !--backends[i]->refs) \
+ delete static_cast<QOpenGLFunctions_##X##Backend*>(backends[i]); \
+ ++i;
+
+ QT_OPENGL_VERSIONS(DELETE_BACKEND)
+#undef DELETE_BACKEND
delete[] backends;
}
+#endif
}
QOpenGLVersionFunctionsBackend *QOpenGLVersionFunctionsStorage::backend(QOpenGLContext *context, QOpenGLVersionFunctionsBackend::Version v)
diff --git a/src/gui/opengl/qopenglvertexarrayobject.cpp b/src/gui/opengl/qopenglvertexarrayobject.cpp
index babe52aa83..0262538250 100644
--- a/src/gui/opengl/qopenglvertexarrayobject.cpp
+++ b/src/gui/opengl/qopenglvertexarrayobject.cpp
@@ -197,33 +197,59 @@ void QOpenGLVertexArrayObjectPrivate::destroy()
{
Q_Q(QOpenGLVertexArrayObject);
+ QOpenGLContext *ctx = QOpenGLContext::currentContext();
+ QOpenGLContext *oldContext = 0;
+ QSurface *oldContextSurface = 0;
+ QScopedPointer<QOffscreenSurface> offscreenSurface;
+ if (context && context != ctx) {
+ oldContext = ctx;
+ oldContextSurface = ctx ? ctx->surface() : 0;
+ // Cannot just make the current surface current again with another context.
+ // The format may be incompatible and some platforms (iOS) may impose
+ // restrictions on using a window with different contexts. Create an
+ // offscreen surface (a pbuffer or a hidden window) instead to be safe.
+ offscreenSurface.reset(new QOffscreenSurface);
+ offscreenSurface->setFormat(context->format());
+ offscreenSurface->create();
+ if (context->makeCurrent(offscreenSurface.data())) {
+ ctx = context;
+ } else {
+ qWarning("QOpenGLVertexArrayObject::destroy() failed to make VAO's context current");
+ ctx = 0;
+ }
+ }
+
if (context) {
QObject::disconnect(context, SIGNAL(aboutToBeDestroyed()), q, SLOT(_q_contextAboutToBeDestroyed()));
context = 0;
}
- if (!vao)
- return;
-
- switch (vaoFuncsType) {
+ if (vao) {
+ switch (vaoFuncsType) {
#ifndef QT_OPENGL_ES_2
- case Core_3_2:
- vaoFuncs.core_3_2->glDeleteVertexArrays(1, &vao);
- break;
- case Core_3_0:
- vaoFuncs.core_3_0->glDeleteVertexArrays(1, &vao);
- break;
+ case Core_3_2:
+ vaoFuncs.core_3_2->glDeleteVertexArrays(1, &vao);
+ break;
+ case Core_3_0:
+ vaoFuncs.core_3_0->glDeleteVertexArrays(1, &vao);
+ break;
#endif
- case ARB:
- case APPLE:
- case OES:
- vaoFuncs.helper->glDeleteVertexArrays(1, &vao);
- break;
- default:
- break;
+ case ARB:
+ case APPLE:
+ case OES:
+ vaoFuncs.helper->glDeleteVertexArrays(1, &vao);
+ break;
+ default:
+ break;
+ }
+
+ vao = 0;
}
- vao = 0;
+ if (oldContext && oldContextSurface) {
+ if (!oldContext->makeCurrent(oldContextSurface))
+ qWarning("QOpenGLVertexArrayObject::destroy() failed to restore current context");
+ }
}
/*!
@@ -354,37 +380,7 @@ QOpenGLVertexArrayObject::QOpenGLVertexArrayObject(QOpenGLVertexArrayObjectPriva
*/
QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject()
{
- QOpenGLContext* ctx = QOpenGLContext::currentContext();
-
- Q_D(QOpenGLVertexArrayObject);
- QOpenGLContext *oldContext = 0;
- QSurface *oldContextSurface = 0;
- QScopedPointer<QOffscreenSurface> offscreenSurface;
- if (d->context && ctx && d->context != ctx) {
- oldContext = ctx;
- oldContextSurface = ctx->surface();
- // Cannot just make the current surface current again with another context.
- // The format may be incompatible and some platforms (iOS) may impose
- // restrictions on using a window with different contexts. Create an
- // offscreen surface (a pbuffer or a hidden window) instead to be safe.
- offscreenSurface.reset(new QOffscreenSurface);
- offscreenSurface->setFormat(d->context->format());
- offscreenSurface->create();
- if (d->context->makeCurrent(offscreenSurface.data())) {
- ctx = d->context;
- } else {
- qWarning("QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() failed to make VAO's context current");
- ctx = 0;
- }
- }
-
- if (ctx)
- destroy();
-
- if (oldContext) {
- if (!oldContext->makeCurrent(oldContextSurface))
- qWarning("QOpenGLVertexArrayObject::~QOpenGLVertexArrayObject() failed to restore current context");
- }
+ destroy();
}
/*!
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 6a8091bf8b..9e1785c11d 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -545,12 +545,8 @@ static QStringList get_colornames()
\section1 The HSL Color Model
- HSL is similar to HSV. Instead of value parameter from HSV,
- HSL has the lightness parameter.
- The lightness parameter goes from black to color and from color to white.
- If you go outside at the night its black or dark gray. At day its colorful but
- if you look in a really strong light a things they are going to white and
- wash out.
+ HSL is similar to HSV, however instead of the Value parameter, HSL
+ specifies a Lightness parameter.
\section1 The CMYK Color Model
diff --git a/src/gui/painting/qcoregraphics.mm b/src/gui/painting/qcoregraphics.mm
index 34dfd51204..2f09037cfe 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -473,6 +473,8 @@ QMacCGContext::QMacCGContext(QPaintDevice *paintDevice) : context(0)
context = CGBitmapContextCreate(image->bits(), image->width(), image->height(),
8, image->bytesPerLine(), colorspace, flags);
CGContextTranslateCTM(context, 0, image->height());
+ const qreal devicePixelRatio = paintDevice->devicePixelRatioF();
+ CGContextScaleCTM(context, devicePixelRatio, devicePixelRatio);
CGContextScaleCTM(context, 1, -1);
}
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 8a9f8b8bdc..7cf0dd7f03 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -3004,8 +3004,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint sbuf1[buffer_size];
uint sbuf2[buffer_size];
- QRgba64 buf1[buffer_size];
- QRgba64 buf2[buffer_size];
+ quint64 buf1[buffer_size];
+ quint64 buf2[buffer_size];
QRgba64 *b = buffer;
while (length) {
int len = qMin(length, buffer_size / 2);
@@ -3081,9 +3081,9 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf1, sbuf1, len * 2, clut, 0);
if (disty)
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
@@ -3101,7 +3101,7 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
vt = _mm_add_epi16(vt, _mm_srli_si128(vt, 8));
_mm_storel_epi64((__m128i*)(b+i), vt);
#else
- b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
+ b[i] = interpolate_4_pixels_rgb64((QRgba64 *)buf1 + i*2, (QRgba64 *)buf2 + i*2, distx, disty);
#endif
fracX += fdx;
}
@@ -3112,8 +3112,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint sbuf1[buffer_size];
uint sbuf2[buffer_size];
- QRgba64 buf1[buffer_size];
- QRgba64 buf2[buffer_size];
+ quint64 buf1[buffer_size];
+ quint64 buf2[buffer_size];
QRgba64 *end = buffer + length;
QRgba64 *b = buffer;
@@ -3221,13 +3221,13 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fx += fdx;
fy += fdy;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = (fracX & 0x0000ffff);
int disty = (fracY & 0x0000ffff);
- b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
+ b[i] = interpolate_4_pixels_rgb64((QRgba64 *)buf1 + i*2, (QRgba64 *)buf2 + i*2, distx, disty);
fracX += fdx;
fracY += fdy;
}
@@ -3244,8 +3244,8 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
FetchPixelFunc fetch = qFetchPixel[layout->bpp];
uint sbuf1[buffer_size];
uint sbuf2[buffer_size];
- QRgba64 buf1[buffer_size];
- QRgba64 buf2[buffer_size];
+ quint64 buf1[buffer_size];
+ quint64 buf2[buffer_size];
QRgba64 *b = buffer;
int distxs[buffer_size / 2];
@@ -3293,13 +3293,13 @@ static const QRgba64 *QT_FASTCALL fetchTransformedBilinear64(QRgba64 *buffer, co
fw += fdw;
}
- layout->convertToARGB64PM(buf1, sbuf1, len * 2, clut, 0);
- layout->convertToARGB64PM(buf2, sbuf2, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf1, sbuf1, len * 2, clut, 0);
+ layout->convertToARGB64PM((QRgba64 *)buf2, sbuf2, len * 2, clut, 0);
for (int i = 0; i < len; ++i) {
int distx = distxs[i];
int disty = distys[i];
- b[i] = interpolate_4_pixels_rgb64(buf1 + i*2, buf2 + i*2, distx, disty);
+ b[i] = interpolate_4_pixels_rgb64((QRgba64 *)buf1 + i*2, (QRgba64 *)buf2 + i*2, distx, disty);
}
length -= len;
@@ -3846,7 +3846,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData)
return blend_color_generic(count, spans, userData);
}
- QRgba64 buffer[buffer_size];
+ quint64 buffer[buffer_size];
const QRgba64 color = data->solid.color;
while (count--) {
@@ -3854,7 +3854,7 @@ void blend_color_generic_rgb64(int count, const QSpan *spans, void *userData)
int length = spans->len;
while (length) {
int l = qMin(buffer_size, length);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
+ QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l);
op.funcSolid64(dest, l, color, spans->coverage);
op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
length -= l;
@@ -4035,11 +4035,11 @@ public:
}
};
-class BlendSrcGenericRGB64 : public QBlendBase<QRgba64>
+class BlendSrcGenericRGB64 : public QBlendBase<quint64>
{
public:
BlendSrcGenericRGB64(QSpanData *d, const Operator &o)
- : QBlendBase<QRgba64>(d, o)
+ : QBlendBase<quint64>(d, o)
{
}
@@ -4048,20 +4048,20 @@ public:
return op.func64 && op.destFetch64 && op.destStore64;
}
- const QRgba64 *fetch(int x, int y, int len)
+ const quint64 *fetch(int x, int y, int len)
{
- dest = op.destFetch64(buffer, data->rasterBuffer, x, y, len);
- return op.srcFetch64(src_buffer, &op, data, y, x, len);
+ dest = (quint64 *)op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, y, len);
+ return (const quint64 *)op.srcFetch64((QRgba64 *)src_buffer, &op, data, y, x, len);
}
- void process(int, int, int len, int coverage, const QRgba64 *src, int offset)
+ void process(int, int, int len, int coverage, const quint64 *src, int offset)
{
- op.func64(dest + offset, src + offset, len, coverage);
+ op.func64((QRgba64 *)dest + offset, (const QRgba64 *)src + offset, len, coverage);
}
void store(int x, int y, int len)
{
- op.destStore64(data->rasterBuffer, x, y, dest, len);
+ op.destStore64(data->rasterBuffer, x, y, (QRgba64 *)dest, len);
}
};
@@ -4140,8 +4140,8 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi
qWarning("Unsupported blend");
return blend_untransformed_generic(count, spans, userData);
}
- QRgba64 buffer[buffer_size];
- QRgba64 src_buffer[buffer_size];
+ quint64 buffer[buffer_size];
+ quint64 src_buffer[buffer_size];
const int image_width = data->texture.width;
const int image_height = data->texture.height;
@@ -4165,8 +4165,8 @@ static void blend_untransformed_generic_rgb64(int count, const QSpan *spans, voi
const int coverage = (spans->coverage * data->texture.const_alpha) >> 8;
while (length) {
int l = qMin(buffer_size, length);
- const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
+ const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, l);
+ QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l);
op.func64(dest, src, l, coverage);
op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
x += l;
@@ -4381,8 +4381,8 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD
qDebug("unsupported rgb64 blend");
return blend_tiled_generic(count, spans, userData);
}
- QRgba64 buffer[buffer_size];
- QRgba64 src_buffer[buffer_size];
+ quint64 buffer[buffer_size];
+ quint64 src_buffer[buffer_size];
const int image_width = data->texture.width;
const int image_height = data->texture.height;
@@ -4409,8 +4409,8 @@ static void blend_tiled_generic_rgb64(int count, const QSpan *spans, void *userD
int l = qMin(image_width - sx, length);
if (buffer_size < l)
l = buffer_size;
- const QRgba64 *src = op.srcFetch64(src_buffer, &op, data, sy, sx, l);
- QRgba64 *dest = op.destFetch64(buffer, data->rasterBuffer, x, spans->y, l);
+ const QRgba64 *src = op.srcFetch64((QRgba64 *)src_buffer, &op, data, sy, sx, l);
+ QRgba64 *dest = op.destFetch64((QRgba64 *)buffer, data->rasterBuffer, x, spans->y, l);
op.func64(dest, src, l, coverage);
op.destStore64(data->rasterBuffer, x, spans->y, dest, l);
x += l;
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index 933da56095..e4a1faf25b 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -64,6 +64,8 @@
#include "private/qrasterdefs_p.h"
#include <private/qsimd_p.h>
+#include <QtCore/qsharedpointer.h>
+
QT_BEGIN_NAMESPACE
#if defined(Q_CC_GNU)
@@ -334,7 +336,11 @@ struct QSpanData
QGradientData gradient;
QTextureData texture;
};
- QExplicitlySharedDataPointer<const QSharedData> cachedGradient;
+ class Pinnable {
+ protected:
+ ~Pinnable() {}
+ }; // QSharedPointer<const void> is not supported
+ QSharedPointer<const Pinnable> cachedGradient;
void init(QRasterBuffer *rb, const QRasterPaintEngine *pe);
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 647bd5cb2c..43464d5d2c 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -4182,7 +4182,7 @@ void QRasterBuffer::flushToARGBImage(QImage *target) const
class QGradientCache
{
public:
- struct CacheInfo : public QSharedData
+ struct CacheInfo : QSpanData::Pinnable
{
inline CacheInfo(QGradientStops s, int op, QGradient::InterpolationMode mode) :
stops(qMove(s)), opacity(op), interpolationMode(mode) {}
@@ -4193,9 +4193,9 @@ public:
QGradient::InterpolationMode interpolationMode;
};
- typedef QMultiHash<quint64, QExplicitlySharedDataPointer<const CacheInfo> > QGradientColorTableHash;
+ typedef QMultiHash<quint64, QSharedPointer<const CacheInfo>> QGradientColorTableHash;
- inline QExplicitlySharedDataPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
+ inline QSharedPointer<const CacheInfo> getBuffer(const QGradient &gradient, int opacity) {
quint64 hash_val = 0;
const QGradientStops stops = gradient.stops();
@@ -4209,7 +4209,7 @@ public:
return addCacheElement(hash_val, gradient, opacity);
else {
do {
- const QExplicitlySharedDataPointer<const CacheInfo> &cache_info = it.value();
+ const auto &cache_info = it.value();
if (cache_info->stops == stops && cache_info->opacity == opacity && cache_info->interpolationMode == gradient.interpolationMode())
return cache_info;
++it;
@@ -4225,12 +4225,12 @@ protected:
inline void generateGradientColorTable(const QGradient& g,
QRgba64 *colorTable,
int size, int opacity) const;
- QExplicitlySharedDataPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
+ QSharedPointer<const CacheInfo> addCacheElement(quint64 hash_val, const QGradient &gradient, int opacity) {
if (cache.size() == maxCacheSize()) {
// may remove more than 1, but OK
cache.erase(cache.begin() + (qrand() % maxCacheSize()));
}
- QExplicitlySharedDataPointer<CacheInfo> cache_entry(new CacheInfo (gradient.stops(), opacity, gradient.interpolationMode()));
+ auto cache_entry = QSharedPointer<CacheInfo>::create(gradient.stops(), opacity, gradient.interpolationMode());
generateGradientColorTable(gradient, cache_entry->buffer64, paletteSize(), opacity);
for (int i = 0; i < GRADIENT_STOPTABLE_SIZE; ++i)
cache_entry->buffer32[i] = cache_entry->buffer64[i].toArgb32();
@@ -4470,7 +4470,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QLinearGradient *g = static_cast<const QLinearGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
cachedGradient = cacheInfo;
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
@@ -4492,7 +4492,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QRadialGradient *g = static_cast<const QRadialGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
cachedGradient = cacheInfo;
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
@@ -4518,7 +4518,7 @@ void QSpanData::setup(const QBrush &brush, int alpha, QPainter::CompositionMode
const QConicalGradient *g = static_cast<const QConicalGradient *>(brush.gradient());
gradient.alphaColor = !brush.isOpaque() || alpha != 256;
- QExplicitlySharedDataPointer<const QGradientCache::CacheInfo> cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
cachedGradient = cacheInfo;
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
diff --git a/src/gui/painting/qtriangulatingstroker.cpp b/src/gui/painting/qtriangulatingstroker.cpp
index d9a3231165..6243f1e2a4 100644
--- a/src/gui/painting/qtriangulatingstroker.cpp
+++ b/src/gui/painting/qtriangulatingstroker.cpp
@@ -321,7 +321,7 @@ void QTriangulatingStroker::cubicTo(const qreal *pts)
if (threshold < 4)
threshold = 4;
qreal threshold_minus_1 = threshold - 1;
- float vx, vy;
+ float vx = 0, vy = 0;
float cx = m_cx, cy = m_cy;
float x, y;
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 3b24039ea6..7f3ed3adaa 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -2077,6 +2077,8 @@ bool QFont::fromString(const QString &descrip)
setFixedPitch(l[8].toInt());
if (count == 11)
d->request.styleName = l[10].toString();
+ else
+ d->request.styleName.clear();
}
if (count >= 9 && !d->request.fixedPitch) // assume 'false' fixedPitch equals default
diff --git a/src/gui/text/qtexthtmlparser_p.h b/src/gui/text/qtexthtmlparser_p.h
index e93d46a59f..77bfa685c0 100644
--- a/src/gui/text/qtexthtmlparser_p.h
+++ b/src/gui/text/qtexthtmlparser_p.h
@@ -243,7 +243,7 @@ struct QTextHtmlParserNode {
void parseStyleAttribute(const QString &value, const QTextDocument *resourceProvider);
-#ifndef QT_NO_CSSPARSER
+#if QT_CONFIG(cssparser)
void applyCssDeclarations(const QVector<QCss::Declaration> &declarations, const QTextDocument *resourceProvider);
void setListStyle(const QVector<QCss::Value> &cssValues);
@@ -317,7 +317,7 @@ protected:
bool nodeIsChildOf(int i, QTextHTMLElements id) const;
-#ifndef QT_NO_CSSPARSER
+#if QT_CONFIG(cssparser)
QVector<QCss::Declaration> declarationsForNode(int node) const;
void resolveStyleSheetImports(const QCss::StyleSheet &sheet);
void importStyleSheet(const QString &href);
@@ -337,7 +337,9 @@ protected:
const QTextDocument *resourceProvider;
};
+#if QT_CONFIG(cssparser)
Q_DECLARE_TYPEINFO(QTextHtmlParser::ExternalStyleSheet, Q_MOVABLE_TYPE);
+#endif
QT_END_NAMESPACE