summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-10-01 14:29:15 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-10-01 20:08:28 +0000
commit19792da899988a6b696a2894b6cdc4675e29baeb (patch)
treeeaa7d69cb66cddb3ae365132c2cac4c75af590e3 /src
parent8da92465496fb244b84747ebee14454506e54ecf (diff)
Fix scrolling of QRasterBackingStore when operating on QRasterGLSurface
We were to strict in what surface type we allowed scrolling for. The RasterGLSurface type is an odd one, used by widgets to compose GL and raster content, which means we still have a raster backingstore we can scroll. It's just the flush that's different. Change-Id: Ia229c21c00ad38df9e87f4fc78e341e030ef228d Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit 90c54b02f83961b1c66f10fe57bcfcf4523ebba1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qplatformsurface.cpp11
-rw-r--r--src/gui/kernel/qplatformsurface.h2
-rw-r--r--src/gui/painting/qbackingstore.cpp13
-rw-r--r--src/gui/painting/qrasterbackingstore.cpp2
4 files changed, 15 insertions, 13 deletions
diff --git a/src/gui/kernel/qplatformsurface.cpp b/src/gui/kernel/qplatformsurface.cpp
index fdb2cf567d..772207a7a9 100644
--- a/src/gui/kernel/qplatformsurface.cpp
+++ b/src/gui/kernel/qplatformsurface.cpp
@@ -68,6 +68,17 @@ QPlatformSurface::QPlatformSurface(QSurface *surface) : m_surface(surface)
{
}
+bool QPlatformSurface::isRasterSurface(QSurface *surface)
+{
+ switch (surface->surfaceType()) {
+ case QSurface::RasterSurface:
+ case QSurface::RasterGLSurface:
+ return true;
+ default:
+ return false;
+ };
+}
+
#ifndef QT_NO_DEBUG_STREAM
Q_GUI_EXPORT QDebug operator<<(QDebug debug, const QPlatformSurface *surface)
{
diff --git a/src/gui/kernel/qplatformsurface.h b/src/gui/kernel/qplatformsurface.h
index 475f3ef330..bf0ba81d7f 100644
--- a/src/gui/kernel/qplatformsurface.h
+++ b/src/gui/kernel/qplatformsurface.h
@@ -73,6 +73,8 @@ public:
QSurface *surface() const;
virtual QPlatformScreen *screen() const = 0;
+ static bool isRasterSurface(QSurface *surface);
+
private:
explicit QPlatformSurface(QSurface *surface);
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp
index a2e5f7286e..f76b9864fc 100644
--- a/src/gui/painting/qbackingstore.cpp
+++ b/src/gui/painting/qbackingstore.cpp
@@ -192,17 +192,6 @@ void QBackingStore::endPaint()
handle()->endPaint();
}
-static bool isRasterSurface(QWindow *window)
-{
- switch (window->surfaceType()) {
- case QSurface::RasterSurface:
- case QSurface::RasterGLSurface:
- return true;
- default:
- return false;
- };
-}
-
/*!
Flushes the given \a region from the specified \a window onto the
screen.
@@ -229,7 +218,7 @@ void QBackingStore::flush(const QRegion &region, QWindow *window, const QPoint &
return;
}
- if (!isRasterSurface(window)) {
+ if (!QPlatformSurface::isRasterSurface(window)) {
qWarning() << "Attempted flush to non-raster surface" << window << "of type" << window->surfaceType()
<< (window->inherits("QWidgetWindow") ? "(consider using Qt::WA_PaintOnScreen to exclude "
"from backingstore sync)" : "");
diff --git a/src/gui/painting/qrasterbackingstore.cpp b/src/gui/painting/qrasterbackingstore.cpp
index a3ffe11d19..49dbeae774 100644
--- a/src/gui/painting/qrasterbackingstore.cpp
+++ b/src/gui/painting/qrasterbackingstore.cpp
@@ -82,7 +82,7 @@ QImage QRasterBackingStore::toImage() const
bool QRasterBackingStore::scroll(const QRegion &region, int dx, int dy)
{
- if (window()->surfaceType() != QSurface::RasterSurface)
+ if (!QPlatformSurface::isRasterSurface(window()))
return false;
extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &);