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.

Pick-to: 6.2
Change-Id: Ia229c21c00ad38df9e87f4fc78e341e030ef228d
Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-10-01 14:29:15 +02:00
parent 8c52f8cbf5
commit 90c54b02f8
4 changed files with 15 additions and 13 deletions

View File

@ -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)
{

View File

@ -73,6 +73,8 @@ public:
QSurface *surface() const;
virtual QPlatformScreen *screen() const = 0;
static bool isRasterSurface(QSurface *surface);
private:
explicit QPlatformSurface(QSurface *surface);

View File

@ -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)" : "");

View File

@ -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 &);