diff options
-rw-r--r-- | src/gui/painting/qbackingstore.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qbackingstore_p.h | 3 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qgraphicssystem_runtime_p.h | 3 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface.cpp | 21 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_p.h | 20 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_raster.cpp | 5 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_raster_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_s60.cpp | 4 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_s60_p.h | 2 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_x11.cpp | 9 | ||||
-rw-r--r-- | src/gui/painting/qwindowsurface_x11_p.h | 3 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl.cpp | 14 | ||||
-rw-r--r-- | src/opengl/qwindowsurface_gl_p.h | 3 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vg.cpp | 7 | ||||
-rw-r--r-- | src/openvg/qwindowsurface_vg_p.h | 2 |
16 files changed, 55 insertions, 58 deletions
diff --git a/src/gui/painting/qbackingstore.cpp b/src/gui/painting/qbackingstore.cpp index a06a121..42c1c35 100644 --- a/src/gui/painting/qbackingstore.cpp +++ b/src/gui/painting/qbackingstore.cpp @@ -588,7 +588,7 @@ void QWidgetBackingStore::markDirty(const QRegion &rgn, QWidget *widget, bool up return; } - if (!windowSurface->hasPartialUpdateSupport()) { + if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) { fullUpdatePending = true; sendUpdateRequest(tlw, updateImmediately); return; @@ -683,7 +683,7 @@ void QWidgetBackingStore::markDirty(const QRect &rect, QWidget *widget, bool upd return; } - if (!windowSurface->hasPartialUpdateSupport()) { + if (!windowSurface->hasFeature(QWindowSurface::PartialUpdates)) { fullUpdatePending = true; sendUpdateRequest(tlw, updateImmediately); return; @@ -1145,7 +1145,7 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg // If there's no preserved contents support we always need // to do a full repaint before flushing - if (!windowSurface->hasPreservedContents()) + if (!windowSurface->hasFeature(QWindowSurface::PreservedContents)) fullUpdatePending = true; // Nothing to repaint. diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index 39bf66c..05f4bfc 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -262,8 +262,7 @@ private: } inline bool hasStaticContents() const - { return !staticWidgets.isEmpty() && windowSurface->hasStaticContentsSupport() - && windowSurface->hasPartialUpdateSupport(); } + { return !staticWidgets.isEmpty() && windowSurface->hasFeature(QWindowSurface::StaticContents); } friend QRegion qt_dirtyRegion(QWidget *); friend class QWidgetPrivate; diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 46a6f81..d1dd7ef 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -319,14 +319,9 @@ QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const return m_windowSurface->offset(widget); } -bool QRuntimeWindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QRuntimeWindowSurface::features() const { - return m_windowSurface->hasStaticContentsSupport(); -} - -bool QRuntimeWindowSurface::hasPartialUpdateSupport() const -{ - return m_windowSurface->hasPartialUpdateSupport(); + return m_windowSurface->features(); } QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index 998fa98..26d3777 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -129,8 +129,7 @@ public: virtual QPoint offset(const QWidget *widget) const; - virtual bool hasStaticContentsSupport() const; - virtual bool hasPartialUpdateSupport() const; + virtual WindowSurfaceFeatures features() const; QScopedPointer<QWindowSurface> m_windowSurface; QScopedPointer<QWindowSurface> m_pendingWindowSurface; diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 050805e..0fb9bf7 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -307,11 +307,6 @@ QPoint QWindowSurface::offset(const QWidget *widget) const window surface. */ -bool QWindowSurface::hasStaticContentsSupport() const -{ - return false; -} - void QWindowSurface::setStaticContents(const QRegion ®ion) { d_ptr->staticContents = region; @@ -324,22 +319,12 @@ QRegion QWindowSurface::staticContents() const bool QWindowSurface::hasStaticContents() const { - return hasStaticContentsSupport() && !d_ptr->staticContents.isEmpty(); + return hasFeature(QWindowSurface::StaticContents) && !d_ptr->staticContents.isEmpty(); } -bool QWindowSurface::hasPartialUpdateSupport() const -{ - return true; -} - -/*! - Says whether the window surface's contents are preserved on flush. - If not, the window surface contents need to be fully repainted before the - next flush. -*/ -bool QWindowSurface::hasPreservedContents() const +QWindowSurface::WindowSurfaceFeatures QWindowSurface::features() const { - return hasPartialUpdateSupport(); + return PartialUpdates | PreservedContents; } #ifdef Q_WS_QPA diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 95b2ee4..a3fea67 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -68,6 +68,14 @@ class QPlatformWindow; class Q_GUI_EXPORT QWindowSurface { public: + enum WindowSurfaceFeature { + PartialUpdates = 0x00000001, // Supports doing partial updates. + PreservedContents = 0x00000002, // Supports doing flush without first doing a repaint. + StaticContents = 0x00000004, // Supports having static content regions when being resized. + AllFeatures = 0xffffffff // For convenience + }; + Q_DECLARE_FLAGS(WindowSurfaceFeatures, WindowSurfaceFeature) + QWindowSurface(QWidget *window, bool setDefaultSurface = true); virtual ~QWindowSurface(); @@ -100,9 +108,8 @@ public: virtual QPoint offset(const QWidget *widget) const; inline QRect rect(const QWidget *widget) const; - virtual bool hasStaticContentsSupport() const; - virtual bool hasPartialUpdateSupport() const; - virtual bool hasPreservedContents() const; + bool hasFeature(WindowSurfaceFeature feature) const; + virtual WindowSurfaceFeatures features() const; void setStaticContents(const QRegion ®ion); QRegion staticContents() const; @@ -114,11 +121,18 @@ private: QWindowSurfacePrivate *d_ptr; }; +Q_DECLARE_OPERATORS_FOR_FLAGS(QWindowSurface::WindowSurfaceFeatures) + inline QRect QWindowSurface::rect(const QWidget *widget) const { return widget->rect().translated(offset(widget)); } +inline bool QWindowSurface::hasFeature(WindowSurfaceFeature feature) const +{ + return (features() & feature) != 0; +} + QT_END_NAMESPACE #endif // QWINDOWSURFACE_P_H diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index a5c45c0..9860841 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -410,12 +410,11 @@ bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy) #endif } -bool QRasterWindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QRasterWindowSurface::features() const { - return true; + return QWindowSurface::AllFeatures; } - void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget) { Q_D(QRasterWindowSurface); diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index 669511d..06abcd3 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -109,7 +109,7 @@ public: void beginPaint(const QRegion &rgn); void setGeometry(const QRect &rect); bool scroll(const QRegion &area, int dx, int dy); - bool hasStaticContentsSupport() const; + WindowSurfaceFeatures features() const; #ifdef QT_MAC_USE_COCOA CGContextRef imageContext(); diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 4fa25cb..9fa01ed 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -239,9 +239,9 @@ void QS60WindowSurface::setGeometry(const QRect& rect) QWindowSurface::setGeometry(rect); } -bool QS60WindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QS60WindowSurface::features() const { - return true; + return QWindowSurface::AllFeatures; } CFbsBitmap* QS60WindowSurface::symbianBitmap() const diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h index f730c87..25018d8 100644 --- a/src/gui/painting/qwindowsurface_s60_p.h +++ b/src/gui/painting/qwindowsurface_s60_p.h @@ -79,7 +79,7 @@ public: void setGeometry(const QRect &rect); - bool hasStaticContentsSupport() const; + WindowSurfaceFeatures features() const; CFbsBitmap *symbianBitmap() const; diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index ab4f53e..deb83b4 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -250,13 +250,16 @@ QPixmap QX11WindowSurface::grabWidget(const QWidget *widget, return px; } -bool QX11WindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QX11WindowSurface::features() const { + WindowSurfaceFeatures features = QWindowSurface::PartialUpdates | QWindowSurface::PreservedContents; #ifndef QT_NO_XRENDER - return !d_ptr->translucentBackground; + if (!d_ptr->translucentBackground) + features |= QWindowSurface::StaticContents; #else - return true; + features |= QWindowSurface::StaticContents; #endif + return features; } QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_x11_p.h b/src/gui/painting/qwindowsurface_x11_p.h index d5179dd..df76f98 100644 --- a/src/gui/painting/qwindowsurface_x11_p.h +++ b/src/gui/painting/qwindowsurface_x11_p.h @@ -80,7 +80,8 @@ public: bool scroll(const QRegion &area, int dx, int dy); QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const; - bool hasStaticContentsSupport() const; + WindowSurfaceFeatures features() const; + private: QX11WindowSurfacePrivate *d_ptr; GC gc; diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 4682d0d..3815f7b 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -1154,14 +1154,14 @@ QImage *QGLWindowSurface::buffer(const QWidget *widget) return &d_ptr->buffers.last(); } -bool QGLWindowSurface::hasPartialUpdateSupport() const +QWindowSurface::WindowSurfaceFeatures QGLWindowSurface::features() const { - return !d_ptr->destructive_swap_buffers || d_ptr->swap_region_support; -} - -bool QGLWindowSurface::hasPreservedContents() const -{ - return !d_ptr->destructive_swap_buffers; + WindowSurfaceFeatures features = 0; + if (!d_ptr->destructive_swap_buffers || d_ptr->swap_region_support) + features |= PartialUpdates; + if (!d_ptr->destructive_swap_buffers) + features |= PreservedContents; + return features; } QT_END_NAMESPACE diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index cabb35a..4ad8339 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -108,8 +108,7 @@ public: QImage *buffer(const QWidget *widget); - bool hasPartialUpdateSupport() const; - bool hasPreservedContents() const; + WindowSurfaceFeatures features() const; QGLContext *context() const; diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 6f99de4..eedfea5 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -119,9 +119,12 @@ QPaintEngine *QVGWindowSurface::paintEngine() const return d_ptr->paintEngine(); } -bool QVGWindowSurface::hasStaticContentsSupport() const +QWindowSurface::WindowSurfaceFeatures QVGWindowSurface::features() const { - d_ptr->supportsStaticContents(); + WindowSurfaceFeatures features = PartialUpdates | PreservedContents; + if (d_ptr->supportsStaticContents()) + features |= StaticContents; + return features; } int QVGWindowSurface::metric(PaintDeviceMetric met) const diff --git a/src/openvg/qwindowsurface_vg_p.h b/src/openvg/qwindowsurface_vg_p.h index 2d6b4f9..d63d077 100644 --- a/src/openvg/qwindowsurface_vg_p.h +++ b/src/openvg/qwindowsurface_vg_p.h @@ -78,7 +78,7 @@ public: QPaintEngine *paintEngine() const; - bool hasStaticContentsSupport() const; + WindowSurfaceFeatures features() const; protected: int metric(PaintDeviceMetric metric) const; |