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/image/qmovie.cpp4
-rw-r--r--src/gui/image/qpixmap_raster.cpp23
-rw-r--r--src/gui/image/qpixmap_raster_p.h2
-rw-r--r--src/gui/kernel/qguiapplication.cpp29
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h2
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.cpp2
-rw-r--r--src/gui/kernel/qplatformintegration.h3
-rw-r--r--src/gui/kernel/qplatformscreen.cpp49
-rw-r--r--src/gui/kernel/qplatformscreen.h10
-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/qstylehints.cpp31
-rw-r--r--src/gui/kernel/qstylehints.h4
-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/qopenglpaintengine.cpp2
-rw-r--r--src/gui/opengl/qopenglshaderprogram.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.mm4
-rw-r--r--src/gui/painting/qdrawhelper.cpp103
-rw-r--r--src/gui/painting/qdrawhelper_avx2.cpp13
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp.cpp5
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp61
-rw-r--r--src/gui/painting/qdrawhelper_p.h8
-rw-r--r--src/gui/painting/qdrawhelper_sse4.cpp55
-rw-r--r--src/gui/painting/qpaintengine_raster.cpp24
-rw-r--r--src/gui/painting/qtriangulatingstroker.cpp2
-rw-r--r--src/gui/text/qfont.cpp2
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/gui/text/qinputcontrol.cpp36
-rw-r--r--src/gui/text/qinputcontrol_p.h30
-rw-r--r--src/gui/text/qtexthtmlparser_p.h6
41 files changed, 504 insertions, 253 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/image/qmovie.cpp b/src/gui/image/qmovie.cpp
index 1fdef4e230..55ddd839b7 100644
--- a/src/gui/image/qmovie.cpp
+++ b/src/gui/image/qmovie.cpp
@@ -170,11 +170,11 @@
\sa QMovie::stop()
*/
-#include "qglobal.h"
+#include "qmovie.h"
#ifndef QT_NO_MOVIE
-#include "qmovie.h"
+#include "qglobal.h"
#include "qimage.h"
#include "qimagereader.h"
#include "qpixmap.h"
diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp
index 741f7713da..54a5b94840 100644
--- a/src/gui/image/qpixmap_raster.cpp
+++ b/src/gui/image/qpixmap_raster.cpp
@@ -51,7 +51,6 @@
#include <QImageReader>
#include <QGuiApplication>
#include <QScreen>
-#include <private/qimage_p.h>
#include <private/qsimd_p.h>
#include <private/qdrawhelper_p.h>
#include <qpa/qplatformscreen.h>
@@ -135,7 +134,7 @@ bool QRasterPlatformPixmap::fromData(const uchar *buffer, uint len, const char *
if (image.isNull())
return false;
- createPixmapForImage(image, flags, /* inplace = */true);
+ createPixmapForImage(std::move(image), flags);
return !isNull();
}
@@ -143,13 +142,13 @@ void QRasterPlatformPixmap::fromImage(const QImage &sourceImage,
Qt::ImageConversionFlags flags)
{
QImage image = sourceImage;
- createPixmapForImage(image, flags, /* inplace = */false);
+ createPixmapForImage(std::move(image), flags);
}
void QRasterPlatformPixmap::fromImageInPlace(QImage &sourceImage,
Qt::ImageConversionFlags flags)
{
- createPixmapForImage(sourceImage, flags, /* inplace = */true);
+ createPixmapForImage(std::move(sourceImage), flags);
}
void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader,
@@ -160,7 +159,7 @@ void QRasterPlatformPixmap::fromImageReader(QImageReader *imageReader,
if (image.isNull())
return;
- createPixmapForImage(image, flags, /* inplace = */true);
+ createPixmapForImage(std::move(image), flags);
}
// from qbackingstore.cpp
@@ -301,7 +300,7 @@ int QRasterPlatformPixmap::metric(QPaintDevice::PaintDeviceMetric metric) const
return 0;
}
-void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace)
+void QRasterPlatformPixmap::createPixmapForImage(QImage sourceImage, Qt::ImageConversionFlags flags)
{
QImage::Format format;
if (flags & Qt::NoFormatConversion)
@@ -335,16 +334,10 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC
if (format == QImage::Format_RGB32 && (sourceImage.format() == QImage::Format_ARGB32
|| sourceImage.format() == QImage::Format_ARGB32_Premultiplied))
{
- inPlace = inPlace && sourceImage.isDetached();
- image = sourceImage;
- if (!inPlace)
- image.detach();
- if (image.d)
- image.d->format = QImage::Format_RGB32;
- } else if (inPlace && sourceImage.d->convertInPlace(format, flags)) {
- image = sourceImage;
+ image = std::move(sourceImage);
+ image.reinterpretAsFormat(QImage::Format_RGB32);
} else {
- image = sourceImage.convertToFormat(format, flags);
+ image = std::move(sourceImage).convertToFormat(format, flags);
}
if (image.d) {
diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h
index 95e018eb35..6ea965a324 100644
--- a/src/gui/image/qpixmap_raster_p.h
+++ b/src/gui/image/qpixmap_raster_p.h
@@ -85,7 +85,7 @@ public:
protected:
int metric(QPaintDevice::PaintDeviceMetric metric) const Q_DECL_OVERRIDE;
- void createPixmapForImage(QImage &sourceImage, Qt::ImageConversionFlags flags, bool inPlace);
+ void createPixmapForImage(QImage sourceImage, Qt::ImageConversionFlags flags);
void setImage(const QImage &image);
QImage image;
static QImage::Format systemOpaqueFormat();
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 3438fc0dcd..e4eabc815e 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);
}
}
@@ -2470,7 +2474,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
QWindow *window = e->window.data();
typedef QPair<Qt::TouchPointStates, QList<QTouchEvent::TouchPoint> > StatesAndTouchPoints;
QHash<QWindow *, StatesAndTouchPoints> windowsNeedingEvents;
- bool velocityOnly = false;
+ bool stationaryTouchPointChangedVelocity = false;
for (int i = 0; i < e->points.count(); ++i) {
QTouchEvent::TouchPoint touchPoint = e->points.at(i);
@@ -2550,7 +2554,7 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
if (touchPoint.state() == Qt::TouchPointStationary) {
if (touchInfo.touchPoint.velocity() != touchPoint.velocity()) {
touchInfo.touchPoint.setVelocity(touchPoint.velocity());
- velocityOnly = true;
+ stationaryTouchPointChangedVelocity = true;
}
} else {
touchInfo.touchPoint = touchPoint;
@@ -2591,10 +2595,9 @@ void QGuiApplicationPrivate::processTouchEvent(QWindowSystemInterfacePrivate::To
break;
case Qt::TouchPointStationary:
// don't send the event if nothing changed
- if (velocityOnly)
- eventType = QEvent::TouchUpdate;
- else
+ if (!stationaryTouchPointChangedVelocity)
continue;
+ Q_FALLTHROUGH();
default:
eventType = QEvent::TouchUpdate;
break;
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/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index 16f31db50d..01cf98c7c9 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -278,7 +278,7 @@ void QColorDialogStaticData::readSettings()
void QColorDialogStaticData::writeSettings() const
{
#ifndef QT_NO_SETTINGS
- if (!customSet) {
+ if (customSet) {
QSettings settings(QSettings::UserScope, QStringLiteral("QtProject"));
for (int i = 0; i < int(CustomColorCount); ++i)
settings.setValue(QLatin1String("Qt/customColors/") + QString::number(i), customRgb[i]);
diff --git a/src/gui/kernel/qplatformintegration.cpp b/src/gui/kernel/qplatformintegration.cpp
index fd7f475bee..fe1861e08b 100644
--- a/src/gui/kernel/qplatformintegration.cpp
+++ b/src/gui/kernel/qplatformintegration.cpp
@@ -409,6 +409,8 @@ QVariant QPlatformIntegration::styleHint(StyleHint hint) const
return QPlatformTheme::defaultThemeHint(QPlatformTheme::ItemViewActivateItemOnSingleClick);
case UiEffects:
return QPlatformTheme::defaultThemeHint(QPlatformTheme::UiEffects);
+ case WheelScrollLines:
+ return QPlatformTheme::defaultThemeHint(QPlatformTheme::WheelScrollLines);
}
return 0;
diff --git a/src/gui/kernel/qplatformintegration.h b/src/gui/kernel/qplatformintegration.h
index 22a834f0e1..466b3348bd 100644
--- a/src/gui/kernel/qplatformintegration.h
+++ b/src/gui/kernel/qplatformintegration.h
@@ -157,7 +157,8 @@ public:
TabFocusBehavior,
ReplayMousePressOutsidePopup,
ItemViewActivateItemOnSingleClick,
- UiEffects
+ UiEffects,
+ WheelScrollLines,
};
virtual QVariant styleHint(StyleHint hint) const;
diff --git a/src/gui/kernel/qplatformscreen.cpp b/src/gui/kernel/qplatformscreen.cpp
index bbe984bebe..e22037c1e9 100644
--- a/src/gui/kernel/qplatformscreen.cpp
+++ b/src/gui/kernel/qplatformscreen.cpp
@@ -533,4 +533,53 @@ void QPlatformScreen::setPowerState(PowerState state)
Q_UNUSED(state);
}
+/*!
+ Reimplement this function in subclass to return the list
+ of modes for this screen.
+
+ The default implementation returns a list with
+ only one mode from the current screen size and refresh rate.
+
+ \sa QPlatformScreen::geometry
+ \sa QPlatformScreen::refreshRate
+
+ \since 5.9
+*/
+QVector<QPlatformScreen::Mode> QPlatformScreen::modes() const
+{
+ QVector<QPlatformScreen::Mode> list;
+ list.append({geometry().size(), refreshRate()});
+ return list;
+}
+
+/*!
+ Reimplement this function in subclass to return the
+ index of the current mode from the modes list.
+
+ The default implementation returns 0.
+
+ \sa QPlatformScreen::modes
+
+ \since 5.9
+*/
+int QPlatformScreen::currentMode() const
+{
+ return 0;
+}
+
+/*!
+ Reimplement this function in subclass to return the preferred
+ mode index from the modes list.
+
+ The default implementation returns 0.
+
+ \sa QPlatformScreen::modes
+
+ \since 5.9
+*/
+int QPlatformScreen::preferredMode() const
+{
+ return 0;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformscreen.h b/src/gui/kernel/qplatformscreen.h
index aa32917b6c..97fe3fed03 100644
--- a/src/gui/kernel/qplatformscreen.h
+++ b/src/gui/kernel/qplatformscreen.h
@@ -95,6 +95,11 @@ public:
PowerStateOff
};
+ struct Mode {
+ QSize size;
+ qreal refreshRate;
+ };
+
QPlatformScreen();
virtual ~QPlatformScreen();
@@ -139,6 +144,11 @@ public:
virtual PowerState powerState() const;
virtual void setPowerState(PowerState state);
+ virtual QVector<Mode> modes() const;
+
+ virtual int currentMode() const;
+ virtual int preferredMode() const;
+
static int angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b);
static QTransform transformBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &target);
static QRect mapBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b, const QRect &rect);
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/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp
index 22c077da41..85c0768e35 100644
--- a/src/gui/kernel/qstylehints.cpp
+++ b/src/gui/kernel/qstylehints.cpp
@@ -78,6 +78,7 @@ public:
, m_cursorFlashTime(-1)
, m_tabFocusBehavior(-1)
, m_uiEffects(-1)
+ , m_wheelScrollLines(-1)
{}
int m_mouseDoubleClickInterval;
@@ -88,6 +89,7 @@ public:
int m_cursorFlashTime;
int m_tabFocusBehavior;
int m_uiEffects;
+ int m_wheelScrollLines;
};
/*!
@@ -495,4 +497,33 @@ void QStyleHints::setUseHoverEffects(bool useHoverEffects)
emit useHoverEffectsChanged(useHoverEffects);
}
+/*!
+ \property QStyleHints::wheelScrollLines
+ \brief Number of lines to scroll by default for each wheel click.
+
+ \since 5.9
+*/
+int QStyleHints::wheelScrollLines() const
+{
+ Q_D(const QStyleHints);
+ if (d->m_wheelScrollLines > 0)
+ return d->m_wheelScrollLines;
+ return themeableHint(QPlatformTheme::WheelScrollLines, QPlatformIntegration::WheelScrollLines).toInt();
+}
+
+/*!
+ Sets the \a wheelScrollLines.
+ \internal
+ \sa wheelScrollLines()
+ \since 5.9
+*/
+void QStyleHints::setWheelScrollLines(int scrollLines)
+{
+ Q_D(QStyleHints);
+ if (d->m_wheelScrollLines == scrollLines)
+ return;
+ d->m_wheelScrollLines = scrollLines;
+ emit wheelScrollLinesChanged(scrollLines);
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qstylehints.h b/src/gui/kernel/qstylehints.h
index fb55cc7ed6..b9bf428edd 100644
--- a/src/gui/kernel/qstylehints.h
+++ b/src/gui/kernel/qstylehints.h
@@ -71,6 +71,7 @@ class Q_GUI_EXPORT QStyleHints : public QObject
Q_PROPERTY(Qt::TabFocusBehavior tabFocusBehavior READ tabFocusBehavior NOTIFY tabFocusBehaviorChanged FINAL)
Q_PROPERTY(bool singleClickActivation READ singleClickActivation STORED false CONSTANT FINAL)
Q_PROPERTY(bool useHoverEffects READ useHoverEffects WRITE setUseHoverEffects NOTIFY useHoverEffectsChanged FINAL)
+ Q_PROPERTY(int wheelScrollLines READ wheelScrollLines NOTIFY wheelScrollLinesChanged FINAL)
public:
void setMouseDoubleClickInterval(int mouseDoubleClickInterval);
@@ -99,6 +100,8 @@ public:
bool singleClickActivation() const;
bool useHoverEffects() const;
void setUseHoverEffects(bool useHoverEffects);
+ int wheelScrollLines() const;
+ void setWheelScrollLines(int scrollLines);
Q_SIGNALS:
void cursorFlashTimeChanged(int cursorFlashTime);
@@ -109,6 +112,7 @@ Q_SIGNALS:
void startDragTimeChanged(int startDragTime);
void tabFocusBehaviorChanged(Qt::TabFocusBehavior tabFocusBehavior);
void useHoverEffectsChanged(bool useHoverEffects);
+ void wheelScrollLinesChanged(int scrollLines);
private:
friend class QGuiApplication;
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/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp
index f6bae32d54..aeb4fc0b7a 100644
--- a/src/gui/opengl/qopenglpaintengine.cpp
+++ b/src/gui/opengl/qopenglpaintengine.cpp
@@ -1676,7 +1676,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngine::GlyphFormat gly
QOpenGL2PaintEngineState *s = q->state();
- void *cacheKey = ctx->shareGroup();
+ void *cacheKey = ctx; // use context, not the shareGroup() -> the GL glyph cache uses FBOs which may not be shareable
bool recreateVertexArrays = false;
QTransform glyphCacheTransform;
diff --git a/src/gui/opengl/qopenglshaderprogram.cpp b/src/gui/opengl/qopenglshaderprogram.cpp
index 0d0f40efee..c9552fd321 100644
--- a/src/gui/opengl/qopenglshaderprogram.cpp
+++ b/src/gui/opengl/qopenglshaderprogram.cpp
@@ -3739,11 +3739,6 @@ QOpenGLProgramBinarySupportCheck::QOpenGLProgramBinarySupportCheck(QOpenGLContex
: QOpenGLSharedResource(context->shareGroup()),
m_supported(false)
{
-// Shader cache is disabled for INTEGRITY as the driver doesn't handle
-// unaligned data.
-#if defined(Q_OS_INTEGRITY)
- return;
-#endif
if (QCoreApplication::testAttribute(Qt::AA_DisableShaderDiskCache)) {
qCDebug(DBG_SHADER_CACHE, "Shader cache disabled via app attribute");
return;
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..a64a184e25 100644
--- a/src/gui/painting/qcoregraphics.mm
+++ b/src/gui/painting/qcoregraphics.mm
@@ -135,6 +135,8 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize)
availableSizes << QSize(defaultSize, defaultSize);
foreach (QSize size, availableSizes) {
QPixmap pm = icon.pixmap(size);
+ if (pm.isNull())
+ continue;
QImage image = pm.toImage();
CGImageRef cgImage = qt_mac_toCGImage(image);
NSBitmapImageRep *imageRep = [[NSBitmapImageRep alloc] initWithCGImage:cgImage];
@@ -473,6 +475,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 6f82ab871c..4ea3b37d5f 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;
@@ -6105,18 +6105,10 @@ void qt_memfill16(quint16 *dest, quint16 color, int count)
qt_memfill_template<quint16>(dest, color, count);
}
#endif
-#if !defined(__SSE2__) && !defined(__ARM_NEON__)
-# ifdef QT_COMPILER_SUPPORTS_MIPS_DSP
-extern "C" void qt_memfill32_asm_mips_dsp(quint32 *, quint32, int);
-# endif
-
+#if !defined(__SSE2__) && !defined(__ARM_NEON__) && !defined(__mips_dsp)
void qt_memfill32(quint32 *dest, quint32 color, int count)
{
-# ifdef QT_COMPILER_SUPPORTS_MIPS_DSP
- qt_memfill32_asm_mips_dsp(dest, color, count);
-# else
qt_memfill_template<quint32>(dest, color, count);
-# endif
}
#endif
@@ -6204,20 +6196,18 @@ static void qInitDrawhelperFunctions()
#if defined(QT_COMPILER_SUPPORTS_SSE4_1)
if (qCpuHasFeature(SSE4_1)) {
-#if !defined(__SSE4_1__)
extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
- qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
- qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4;
-#endif
extern const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBA8888FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
extern const uint *QT_FASTCALL convertRGBXFromARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *);
+ qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_sse4;
+ qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_sse4;
qPixelLayouts[QImage::Format_ARGB32].convertFromARGB32PM = convertARGB32FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBA8888].convertFromARGB32PM = convertRGBA8888FromARGB32PM_sse4;
qPixelLayouts[QImage::Format_RGBX8888].convertFromARGB32PM = convertRGBXFromARGB32PM_sse4;
@@ -6228,14 +6218,6 @@ static void qInitDrawhelperFunctions()
#if defined(QT_COMPILER_SUPPORTS_AVX2)
if (qCpuHasFeature(AVX2)) {
-#if !defined(__AVX2__)
- extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *);
- extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *);
- qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_avx2;
- qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_avx2;
-#endif
extern void qt_blend_rgb32_on_rgb32_avx2(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h, int const_alpha);
@@ -6285,6 +6267,15 @@ static void qInitDrawhelperFunctions()
sourceFetchUntransformed[QImage::Format_RGB888] = qt_fetchUntransformed_888_neon;
+#if defined(Q_PROCESSOR_ARM_64) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+ extern const uint *QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ extern const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *);
+ qPixelLayouts[QImage::Format_ARGB32].convertToARGB32PM = convertARGB32ToARGB32PM_neon;
+ qPixelLayouts[QImage::Format_RGBA8888].convertToARGB32PM = convertRGBA8888ToARGB32PM_neon;
+#endif
+
#if defined(ENABLE_PIXMAN_DRAWHELPERS)
// The RGB16 helpers are using Arm32 assemblythat has not been ported to AArch64
qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon;
@@ -6308,10 +6299,6 @@ static void qInitDrawhelperFunctions()
#endif
-#if defined(Q_PROCESSOR_MIPS_32) && defined(QT_COMPILER_SUPPORTS_MIPS_DSP)
- qt_memfill32 = qt_memfill32_asm_mips_dsp;
-#endif // Q_PROCESSOR_MIPS_32
-
#if defined(QT_COMPILER_SUPPORTS_MIPS_DSP) || defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
if (qCpuHasFeature(DSP) && qCpuHasFeature(DSPR2)) {
// Composition functions are all DSP r1
diff --git a/src/gui/painting/qdrawhelper_avx2.cpp b/src/gui/painting/qdrawhelper_avx2.cpp
index 9c1335298e..5e17e8abec 100644
--- a/src/gui/painting/qdrawhelper_avx2.cpp
+++ b/src/gui/painting/qdrawhelper_avx2.cpp
@@ -44,19 +44,6 @@
QT_BEGIN_NAMESPACE
-// Autovectorized premultiply functions:
-const uint *QT_FASTCALL convertARGB32ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return qt_convertARGB32ToARGB32PM(buffer, src, count);
-}
-
-const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_avx2(uint *buffer, const uint *src, int count,
- const QVector<QRgb> *, QDitherInfo *)
-{
- return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
-}
-
// Vectorized blend functions:
// See BYTE_MUL_SSE2 for details.
diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp
index b72ca3da3d..783e481296 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp.cpp
+++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp
@@ -43,6 +43,11 @@
QT_BEGIN_NAMESPACE
+void qt_memfill32(quint32 *dest, quint32 color, int count)
+{
+ qt_memfill32_asm_mips_dsp(dest, color, count);
+}
+
void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index cdb374f823..643c570f65 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -1069,6 +1069,67 @@ const uint * QT_FASTCALL qt_fetchUntransformed_888_neon(uint *buffer, const Oper
return buffer;
}
+#if defined(Q_PROCESSOR_ARM_64) && Q_BYTE_ORDER == Q_LITTLE_ENDIAN
+template<bool RGBA>
+static inline void convertARGBToARGB32PM_neon(uint *buffer, const uint *src, int count)
+{
+ int i = 0;
+ const uint8x16_t rgbaMask = { 2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15};
+ const uint8x8_t shuffleMask = { 3, 3, 3, 3, 7, 7, 7, 7};
+ const uint32x4_t blendMask = vdupq_n_u32(0xff000000);
+
+ for (; i < count - 3; i += 4) {
+ uint32x4_t srcVector = vld1q_u32(src + i);
+ uint32x4_t alphaVector = vshrq_n_u32(srcVector, 24);
+ uint32_t alphaSum = vaddvq_u32(alphaVector);
+ if (alphaSum) {
+ if (alphaSum != 255 * 4) {
+ if (RGBA)
+ srcVector = vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask));
+ const uint8x8_t s1 = vreinterpret_u8_u32(vget_low_u32(srcVector));
+ const uint8x8_t s2 = vreinterpret_u8_u32(vget_high_u32(srcVector));
+ const uint8x8_t alpha1 = vtbl1_u8(s1, shuffleMask);
+ const uint8x8_t alpha2 = vtbl1_u8(s2, shuffleMask);
+ uint16x8_t src1 = vmull_u8(s1, alpha1);
+ uint16x8_t src2 = vmull_u8(s2, alpha2);
+ src1 = vsraq_n_u16(src1, src1, 8);
+ src2 = vsraq_n_u16(src2, src2, 8);
+ const uint8x8_t d1 = vrshrn_n_u16(src1, 8);
+ const uint8x8_t d2 = vrshrn_n_u16(src2, 8);
+ const uint32x4_t d = vbslq_u32(blendMask, srcVector, vreinterpretq_u32_u8(vcombine_u8(d1, d2)));
+ vst1q_u32(buffer + i, d);
+ } else {
+ if (RGBA)
+ vst1q_u32(buffer + i, vreinterpretq_u32_u8(vqtbl1q_u8(vreinterpretq_u8_u32(srcVector), rgbaMask)));
+ else if (buffer != src)
+ vst1q_u32(buffer + i, srcVector);
+ }
+ } else {
+ vst1q_u32(buffer + i, vdupq_n_u32(0));
+ }
+ }
+
+ SIMD_EPILOGUE(i, count, 3) {
+ uint v = qPremultiply(src[i]);
+ buffer[i] = RGBA ? RGBA2ARGB(v) : v;
+ }
+}
+
+const uint *QT_FASTCALL convertARGB32ToARGB32PM_neon(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *)
+{
+ convertARGBToARGB32PM_neon<false>(buffer, src, count);
+ return buffer;
+}
+
+const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_neon(uint *buffer, const uint *src, int count,
+ const QVector<QRgb> *, QDitherInfo *)
+{
+ convertARGBToARGB32PM_neon<true>(buffer, src, count);
+ return buffer;
+}
+#endif
+
QT_END_NAMESPACE
#endif // __ARM_NEON__
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index f35b763f93..cf2213042d 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/qdrawhelper_sse4.cpp b/src/gui/painting/qdrawhelper_sse4.cpp
index 257bad9eca..14bfaabf09 100644
--- a/src/gui/painting/qdrawhelper_sse4.cpp
+++ b/src/gui/painting/qdrawhelper_sse4.cpp
@@ -44,16 +44,67 @@
QT_BEGIN_NAMESPACE
+template<bool RGBA>
+static inline void convertARGBToARGB32PM_sse4(uint *buffer, const uint *src, int count)
+{
+ int i = 0;
+ const __m128i alphaMask = _mm_set1_epi32(0xff000000);
+ const __m128i rgbaMask = _mm_setr_epi8(2, 1, 0, 3, 6, 5, 4, 7, 10, 9, 8, 11, 14, 13, 12, 15);
+ const __m128i shuffleMask = _mm_setr_epi8(6, 7, 6, 7, 6, 7, 6, 7, 14, 15, 14, 15, 14, 15, 14, 15);
+ const __m128i half = _mm_set1_epi16(0x0080);
+ const __m128i zero = _mm_setzero_si128();
+
+ for (; i < count - 3; i += 4) {
+ __m128i srcVector = _mm_loadu_si128((const __m128i *)&src[i]);
+ if (!_mm_testz_si128(srcVector, alphaMask)) {
+ if (!_mm_testc_si128(srcVector, alphaMask)) {
+ if (RGBA)
+ srcVector = _mm_shuffle_epi8(srcVector, rgbaMask);
+ __m128i src1 = _mm_unpacklo_epi8(srcVector, zero);
+ __m128i src2 = _mm_unpackhi_epi8(srcVector, zero);
+ __m128i alpha1 = _mm_shuffle_epi8(src1, shuffleMask);
+ __m128i alpha2 = _mm_shuffle_epi8(src2, shuffleMask);
+ src1 = _mm_mullo_epi16(src1, alpha1);
+ src2 = _mm_mullo_epi16(src2, alpha2);
+ src1 = _mm_add_epi16(src1, _mm_srli_epi16(src1, 8));
+ src2 = _mm_add_epi16(src2, _mm_srli_epi16(src2, 8));
+ src1 = _mm_add_epi16(src1, half);
+ src2 = _mm_add_epi16(src2, half);
+ src1 = _mm_srli_epi16(src1, 8);
+ src2 = _mm_srli_epi16(src2, 8);
+ src1 = _mm_blend_epi16(src1, alpha1, 0x88);
+ src2 = _mm_blend_epi16(src2, alpha2, 0x88);
+ srcVector = _mm_packus_epi16(src1, src2);
+ _mm_storeu_si128((__m128i *)&buffer[i], srcVector);
+ } else {
+ if (RGBA)
+ _mm_storeu_si128((__m128i *)&buffer[i], _mm_shuffle_epi8(srcVector, rgbaMask));
+ else if (buffer != src)
+ _mm_storeu_si128((__m128i *)&buffer[i], srcVector);
+ }
+ } else {
+ _mm_storeu_si128((__m128i *)&buffer[i], _mm_setzero_si128());
+ }
+ }
+
+ SIMD_EPILOGUE(i, count, 3) {
+ uint v = qPremultiply(src[i]);
+ buffer[i] = RGBA ? RGBA2ARGB(v) : v;
+ }
+}
+
const uint *QT_FASTCALL convertARGB32ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *)
{
- return qt_convertARGB32ToARGB32PM(buffer, src, count);
+ convertARGBToARGB32PM_sse4<false>(buffer, src, count);
+ return buffer;
}
const uint *QT_FASTCALL convertRGBA8888ToARGB32PM_sse4(uint *buffer, const uint *src, int count,
const QVector<QRgb> *, QDitherInfo *)
{
- return qt_convertRGBA8888ToARGB32PM(buffer, src, count);
+ convertARGBToARGB32PM_sse4<true>(buffer, src, count);
+ return buffer;
}
const uint *QT_FASTCALL convertARGB32FromARGB32PM_sse4(uint *buffer, const uint *src, int count,
diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp
index 68b8d78ac6..fc4f2a9944 100644
--- a/src/gui/painting/qpaintengine_raster.cpp
+++ b/src/gui/painting/qpaintengine_raster.cpp
@@ -4183,7 +4183,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) {}
@@ -4194,9 +4194,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();
@@ -4210,7 +4210,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;
@@ -4226,12 +4226,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();
@@ -4471,10 +4471,10 @@ 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);
- cachedGradient = cacheInfo;
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
+ cachedGradient = std::move(cacheInfo);
gradient.spread = g->spread();
@@ -4493,10 +4493,10 @@ 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);
- cachedGradient = cacheInfo;
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
+ cachedGradient = std::move(cacheInfo);
gradient.spread = g->spread();
@@ -4519,10 +4519,10 @@ 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);
- cachedGradient = cacheInfo;
+ auto cacheInfo = qt_gradient_cache()->getBuffer(*g, alpha);
gradient.colorTable32 = cacheInfo->buffer32;
gradient.colorTable64 = cacheInfo->buffer64;
+ cachedGradient = std::move(cacheInfo);
gradient.spread = QGradient::RepeatSpread;
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/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 8d8ca1ba2c..596c79fd05 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1273,7 +1273,7 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
if (!qSafeFromBigEndian(maps + 8 * n, endPtr, &platformId))
return 0;
- quint16 platformSpecificId;
+ quint16 platformSpecificId = 0;
if (!qSafeFromBigEndian(maps + 8 * n + 2, endPtr, &platformSpecificId))
return 0;
diff --git a/src/gui/text/qinputcontrol.cpp b/src/gui/text/qinputcontrol.cpp
index c2c198866a..2f7dcfcd2b 100644
--- a/src/gui/text/qinputcontrol.cpp
+++ b/src/gui/text/qinputcontrol.cpp
@@ -5,27 +5,33 @@
**
** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
@@ -56,9 +62,9 @@ bool QInputControl::isAcceptableInput(const QKeyEvent *event) const
const QChar c = text.at(0);
- // ZWNJ and ZWJ. This needs to go before the next test, since CTRL+SHIFT is
- // used to input it on Windows.
- if (c == QChar(0x200C) || c == QChar(0x200D))
+ // Formatting characters such as ZWNJ, ZWJ, RLM, etc. This needs to go before the
+ // next test, since CTRL+SHIFT is sometimes used to input it on Windows.
+ if (c.category() == QChar::Other_Format)
return true;
// QTBUG-35734: ignore Ctrl/Ctrl+Shift; accept only AltGr (Alt+Ctrl) on German keyboards
diff --git a/src/gui/text/qinputcontrol_p.h b/src/gui/text/qinputcontrol_p.h
index 3b46067ba9..e5709b5e54 100644
--- a/src/gui/text/qinputcontrol_p.h
+++ b/src/gui/text/qinputcontrol_p.h
@@ -5,27 +5,33 @@
**
** This file is part of the QtGui module of the Qt Toolkit.
**
-** $QT_BEGIN_LICENSE:LGPL21$
+** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see http://www.qt.io/terms-conditions. For further
-** information use the contact form at http://www.qt.io/contact-us.
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
-** General Public License version 2.1 or version 3 as published by the Free
-** Software Foundation and appearing in the file LICENSE.LGPLv21 and
-** LICENSE.LGPLv3 included in the packaging of this file. Please review the
-** following information to ensure the GNU Lesser General Public License
-** requirements will be met: https://www.gnu.org/licenses/lgpl.html and
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
-** As a special exception, The Qt Company gives you certain additional
-** rights. These rights are described in The Qt Company LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
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