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 ®ion, 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 ®ion, int dx, int dy) { - if (window()->surfaceType() != QSurface::RasterSurface) + if (!QPlatformSurface::isRasterSurface(window())) return false; extern void qt_scrollRectInImage(QImage &, const QRect &, const QPoint &);