diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/kernel/kernel.pri | 4 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.cpp | 97 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget.h | 2 | ||||
-rw-r--r-- | src/widgets/kernel/qwidget_p.h | 20 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetrepaintmanager.cpp (renamed from src/widgets/kernel/qwidgetbackingstore.cpp) | 98 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetrepaintmanager_p.h (renamed from src/widgets/kernel/qwidgetbackingstore_p.h) | 30 | ||||
-rw-r--r-- | src/widgets/kernel/qwidgetwindow.cpp | 6 |
7 files changed, 128 insertions, 129 deletions
diff --git a/src/widgets/kernel/kernel.pri b/src/widgets/kernel/kernel.pri index a4b81335c5..693af7eb80 100644 --- a/src/widgets/kernel/kernel.pri +++ b/src/widgets/kernel/kernel.pri @@ -12,7 +12,7 @@ HEADERS += \ kernel/qactiongroup.h \ kernel/qapplication.h \ kernel/qapplication_p.h \ - kernel/qwidgetbackingstore_p.h \ + kernel/qwidgetrepaintmanager_p.h \ kernel/qboxlayout.h \ kernel/qdesktopwidget.h \ kernel/qgridlayout.h \ @@ -41,7 +41,7 @@ SOURCES += \ kernel/qaction.cpp \ kernel/qactiongroup.cpp \ kernel/qapplication.cpp \ - kernel/qwidgetbackingstore.cpp \ + kernel/qwidgetrepaintmanager.cpp \ kernel/qboxlayout.cpp \ kernel/qgridlayout.cpp \ kernel/qlayout.cpp \ diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index 066dfaa183..d1ad0c0a01 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -90,7 +90,7 @@ #include <private/qgraphicseffect_p.h> #endif #include <qbackingstore.h> -#include <private/qwidgetbackingstore_p.h> +#include <private/qwidgetrepaintmanager_p.h> #if 0 // Used to be included in Qt4 for Q_WS_MAC # include <private/qpaintengine_mac_p.h> #endif @@ -869,11 +869,11 @@ QRegion qt_dirtyRegion(QWidget *widget) if (!widget) return QRegion(); - QWidgetBackingStore *bs = qt_widget_private(widget)->maybeBackingStore(); - if (!bs) + QWidgetRepaintManager *repaintManager = qt_widget_private(widget)->maybeRepaintManager(); + if (!repaintManager) return QRegion(); - return bs->dirtyRegion(widget); + return repaintManager->dirtyRegion(widget); } /***************************************************************************** @@ -1278,9 +1278,9 @@ void QWidget::create(WId window, bool initializeWindow, bool destroyOldWindow) setAttribute(Qt::WA_WState_Created); // set created flag d->create(); - // a real toplevel window needs a backing store + // A real toplevel window needs a paint manager if (isWindow() && windowType() != Qt::Desktop) - d->topData()->widgetBackingStore.reset(new QWidgetBackingStore(this)); + d->topData()->repaintManager.reset(new QWidgetRepaintManager(this)); d->setModal_sys(); @@ -1585,10 +1585,10 @@ QWidget::~QWidget() qApp->d_func()->sendSyntheticEnterLeave(this); } - if (QWidgetBackingStore *bs = d->maybeBackingStore()) { - bs->removeDirtyWidget(this); + if (QWidgetRepaintManager *repaintManager = d->maybeRepaintManager()) { + repaintManager->removeDirtyWidget(this); if (testAttribute(Qt::WA_StaticContents)) - bs->removeStaticWidget(this); + repaintManager->removeStaticWidget(this); } delete d->needsFlush; @@ -1804,7 +1804,7 @@ void QWidgetPrivate::deleteTLSysExtra() //the qplatformbackingstore may hold a reference to the window, so the backingstore //needs to be deleted first. - extra->topextra->widgetBackingStore.reset(nullptr); + extra->topextra->repaintManager.reset(nullptr); deleteBackingStore(this); #ifndef QT_NO_OPENGL extra->topextra->widgetTextures.clear(); @@ -1875,8 +1875,8 @@ void QWidgetPrivate::syncBackingStore() if (paintOnScreen()) { repaint_sys(dirty); dirty = QRegion(); - } else if (QWidgetBackingStore *bs = maybeBackingStore()) { - bs->sync(); + } else if (QWidgetRepaintManager *repaintManager = maybeRepaintManager()) { + repaintManager->sync(); } } @@ -1884,8 +1884,8 @@ void QWidgetPrivate::syncBackingStore(const QRegion ®ion) { if (paintOnScreen()) repaint_sys(region); - else if (QWidgetBackingStore *bs = maybeBackingStore()) { - bs->sync(q_func(), region); + else if (QWidgetRepaintManager *repaintManager = maybeRepaintManager()) { + repaintManager->sync(q_func(), region); } } @@ -5411,7 +5411,7 @@ void QWidgetPrivate::render_helper(QPainter *painter, const QPoint &targetOffset } void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, - QPainter *sharedPainter, QWidgetBackingStore *backingStore) + QPainter *sharedPainter, QWidgetRepaintManager *repaintManager) { if (rgn.isEmpty()) return; @@ -5426,7 +5426,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP QWidgetEffectSourcePrivate *sourced = static_cast<QWidgetEffectSourcePrivate *> (source->d_func()); if (!sourced->context) { - QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, backingStore); + QWidgetPaintContext context(pdev, rgn, offset, flags, sharedPainter, repaintManager); sourced->context = &context; if (!sharedPainter) { setSystemClip(pdev->paintEngine(), pdev->devicePixelRatioF(), rgn.translated(offset)); @@ -5452,8 +5452,8 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP // Native widgets need to be marked dirty on screen so painting will be done in correct context // Same check as in the no effects case below. - if (backingStore && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) - backingStore->markDirtyOnScreen(rgn, q, offset); + if (repaintManager && !onScreen && !asRoot && (q->internalWinId() || !q->nativeParentWidget()->isWindow())) + repaintManager->markDirtyOnScreen(rgn, q, offset); return; } @@ -5481,7 +5481,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP //clip away the new area #ifndef QT_NO_PAINT_DEBUG - bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); + bool flushed = QWidgetRepaintManager::flushPaint(q, toBePainted); #endif QPaintEngine *paintEngine = pdev->paintEngine(); if (paintEngine) { @@ -5543,11 +5543,11 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP // This widget renders into a texture which is composed later. We just need to // punch a hole in the backingstore, so the texture will be visible. beginBackingStorePainting(); - if (!q->testAttribute(Qt::WA_AlwaysStackOnTop) && backingStore) { + if (!q->testAttribute(Qt::WA_AlwaysStackOnTop) && repaintManager) { QPainter p(q); p.setCompositionMode(QPainter::CompositionMode_Source); p.fillRect(q->rect(), Qt::transparent); - } else if (!backingStore) { + } else if (!repaintManager) { // We are not drawing to a backingstore: fall back to QImage QImage img = grabFramebuffer(); // grabFramebuffer() always sets the format to RGB32 @@ -5572,8 +5572,8 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } // Native widgets need to be marked dirty on screen so painting will be done in correct context - if (backingStore && !onScreen && !asRoot && (q->internalWinId() || (q->nativeParentWidget() && !q->nativeParentWidget()->isWindow()))) - backingStore->markDirtyOnScreen(toBePainted, q, offset); + if (repaintManager && !onScreen && !asRoot && (q->internalWinId() || (q->nativeParentWidget() && !q->nativeParentWidget()->isWindow()))) + repaintManager->markDirtyOnScreen(toBePainted, q, offset); //restore if (paintEngine) { @@ -5599,7 +5599,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP #ifndef QT_NO_PAINT_DEBUG if (flushed) - QWidgetBackingStore::unflushPaint(q, toBePainted); + QWidgetRepaintManager::unflushPaint(q, toBePainted); #endif } else if (q->isWindow()) { QPaintEngine *engine = pdev->paintEngine(); @@ -5619,8 +5619,8 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP } if (recursive && !children.isEmpty()) { - paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot - , sharedPainter, backingStore); + paintSiblingsRecursive(pdev, children, children.size() - 1, rgn, offset, flags & ~DrawAsRoot, + sharedPainter, repaintManager); } } @@ -5712,7 +5712,7 @@ void QWidgetPrivate::render(QPaintDevice *target, const QPoint &targetOffset, void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& siblings, int index, const QRegion &rgn, const QPoint &offset, int flags - , QPainter *sharedPainter, QWidgetBackingStore *backingStore) + , QPainter *sharedPainter, QWidgetRepaintManager *repaintManager) { QWidget *w = 0; QRect boundingRect; @@ -5747,8 +5747,8 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis QRegion wr(rgn); if (wd->isOpaque) wr -= hasMask ? wd->extra->mask.translated(widgetPos) : w->data->crect; - paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags - , sharedPainter, backingStore); + paintSiblingsRecursive(pdev, siblings, --index, wr, offset, flags, + sharedPainter, repaintManager); } if (w->updatesEnabled() @@ -5761,7 +5761,7 @@ void QWidgetPrivate::paintSiblingsRecursive(QPaintDevice *pdev, const QObjectLis wRegion.translate(-widgetPos); if (hasMask) wRegion &= wd->extra->mask; - wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, backingStore); + wd->drawWidget(pdev, wRegion, offset + widgetPos, flags, sharedPainter, repaintManager); } } @@ -5796,7 +5796,7 @@ void QWidgetEffectSourcePrivate::draw(QPainter *painter) toBePainted &= wd->extra->mask; wd->drawWidget(context->pdev, toBePainted, context->offset, context->flags, - context->sharedPainter, context->backingStore); + context->sharedPainter, context->repaintManager); } QPixmap QWidgetEffectSourcePrivate::pixmap(Qt::CoordinateSystem system, QPoint *offset, @@ -8173,8 +8173,8 @@ void QWidgetPrivate::hide_helper() } } - if (QWidgetBackingStore *bs = maybeBackingStore()) - bs->removeDirtyWidget(q); + if (QWidgetRepaintManager *repaintManager = maybeRepaintManager()) + repaintManager->removeDirtyWidget(q); #ifndef QT_NO_ACCESSIBILITY if (wasVisible) { @@ -10680,12 +10680,12 @@ void QWidget::setParent(QWidget *parent, Qt::WindowFlags f) } #endif - if (QWidgetBackingStore *oldBs = oldtlw->d_func()->maybeBackingStore()) { + if (QWidgetRepaintManager *oldPaintManager = oldtlw->d_func()->maybeRepaintManager()) { if (newParent) - oldBs->removeDirtyWidget(this); + oldPaintManager->removeDirtyWidget(this); // Move the widget and all its static children from // the old backing store to the new one. - oldBs->moveStaticWidgets(this); + oldPaintManager->moveStaticWidgets(this); } // ### fixme: Qt 6: Remove AA_ImmediateWidgetCreation. @@ -11039,7 +11039,7 @@ void QWidgetPrivate::repaint(T r) QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) - tlwExtra->widgetBackingStore->markDirty(r, q, QWidgetBackingStore::UpdateNow); + tlwExtra->repaintManager->markDirty(r, q, QWidgetRepaintManager::UpdateNow); } /*! @@ -11114,7 +11114,7 @@ void QWidgetPrivate::update(T r) QTLWExtra *tlwExtra = q->window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) - tlwExtra->widgetBackingStore->markDirty(clipped, q); + tlwExtra->repaintManager->markDirty(clipped, q); } /*! @@ -11395,11 +11395,11 @@ void QWidget::setAttribute(Qt::WidgetAttribute attribute, bool on) break; case Qt::WA_StaticContents: - if (QWidgetBackingStore *bs = d->maybeBackingStore()) { + if (QWidgetRepaintManager *repaintManager = d->maybeRepaintManager()) { if (on) - bs->addStaticWidget(this); + repaintManager->addStaticWidget(this); else - bs->removeStaticWidget(this); + repaintManager->removeStaticWidget(this); } break; case Qt::WA_TranslucentBackground: @@ -12204,14 +12204,14 @@ void QWidget::setBackingStore(QBackingStore *store) deleteBackingStore(d); topData->backingStore = store; - QWidgetBackingStore *bs = d->maybeBackingStore(); - if (!bs) + QWidgetRepaintManager *repaintManager = d->maybeRepaintManager(); + if (!repaintManager) return; if (isTopLevel()) { - if (bs->store != oldStore && bs->store != store) - delete bs->store; - bs->store = store; + if (repaintManager->store != oldStore && repaintManager->store != store) + delete repaintManager->store; + repaintManager->store = store; } } @@ -12227,9 +12227,8 @@ QBackingStore *QWidget::backingStore() const if (extra && extra->backingStore) return extra->backingStore; - QWidgetBackingStore *bs = d->maybeBackingStore(); - - return bs ? bs->store : 0; + QWidgetRepaintManager *repaintManager = d->maybeRepaintManager(); + return repaintManager ? repaintManager->store : nullptr; } void QWidgetPrivate::getLayoutItemMargins(int *left, int *top, int *right, int *bottom) const diff --git a/src/widgets/kernel/qwidget.h b/src/widgets/kernel/qwidget.h index 0777bed65c..f7ec7f9cf1 100644 --- a/src/widgets/kernel/qwidget.h +++ b/src/widgets/kernel/qwidget.h @@ -697,7 +697,7 @@ private: QLayout *takeLayout(); friend class QBackingStoreDevice; - friend class QWidgetBackingStore; + friend class QWidgetRepaintManager; friend class QApplication; friend class QApplicationPrivate; friend class QGuiApplication; diff --git a/src/widgets/kernel/qwidget_p.h b/src/widgets/kernel/qwidget_p.h index b4a9d283db..c3b3a2ed93 100644 --- a/src/widgets/kernel/qwidget_p.h +++ b/src/widgets/kernel/qwidget_p.h @@ -86,7 +86,7 @@ QT_BEGIN_NAMESPACE class QWidgetWindow; class QPaintEngine; class QPixmap; -class QWidgetBackingStore; +class QWidgetRepaintManager; class QGraphicsProxyWidget; class QWidgetItemV2; class QOpenGLContext; @@ -121,7 +121,7 @@ struct QTLWExtra { // Regular pointers (keep them together to avoid gaps on 64 bits architectures). std::unique_ptr<QIcon> icon; // widget icon - std::unique_ptr<QWidgetBackingStore> widgetBackingStore; + std::unique_ptr<QWidgetRepaintManager> repaintManager; QBackingStore *backingStore; QPainter *sharedPainter; QWidgetWindow *window; @@ -305,7 +305,7 @@ public: QTLWExtra *maybeTopData() const; QPainter *sharedPainter() const; void setSharedPainter(QPainter *painter); - QWidgetBackingStore *maybeBackingStore() const; + QWidgetRepaintManager *maybeRepaintManager() const; enum class WindowHandleMode { Direct, @@ -384,13 +384,13 @@ public: void render(QPaintDevice *target, const QPoint &targetOffset, const QRegion &sourceRegion, QWidget::RenderFlags renderFlags); void drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QPoint &offset, int flags, - QPainter *sharedPainter = nullptr, QWidgetBackingStore *backingStore = nullptr); + QPainter *sharedPainter = nullptr, QWidgetRepaintManager *repaintManager = nullptr); void sendPaintEvent(const QRegion &toBePainted); void paintSiblingsRecursive(QPaintDevice *pdev, const QObjectList& children, int index, const QRegion &rgn, const QPoint &offset, int flags, - QPainter *sharedPainter, QWidgetBackingStore *backingStore); + QPainter *sharedPainter, QWidgetRepaintManager *repaintManager); #if QT_CONFIG(graphicsview) static QGraphicsProxyWidget * nearestGraphicsProxyWidget(const QWidget *origin); @@ -876,15 +876,15 @@ public: struct QWidgetPaintContext { inline QWidgetPaintContext(QPaintDevice *d, const QRegion &r, const QPoint &o, int f, - QPainter *p, QWidgetBackingStore *b) - : pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), backingStore(b), painter(nullptr) {} + QPainter *p, QWidgetRepaintManager *rpm) + : pdev(d), rgn(r), offset(o), flags(f), sharedPainter(p), repaintManager(rpm), painter(nullptr) {} QPaintDevice *pdev; QRegion rgn; QPoint offset; int flags; QPainter *sharedPainter; - QWidgetBackingStore *backingStore; + QWidgetRepaintManager *repaintManager; QPainter *painter; }; @@ -980,11 +980,11 @@ inline bool QWidgetPrivate::pointInsideRectAndMask(const QPoint &p) const || extra->mask.contains(p)); } -inline QWidgetBackingStore *QWidgetPrivate::maybeBackingStore() const +inline QWidgetRepaintManager *QWidgetPrivate::maybeRepaintManager() const { Q_Q(const QWidget); QTLWExtra *x = q->window()->d_func()->maybeTopData(); - return x ? x->widgetBackingStore.get() : nullptr; + return x ? x->repaintManager.get() : nullptr; } QT_END_NAMESPACE diff --git a/src/widgets/kernel/qwidgetbackingstore.cpp b/src/widgets/kernel/qwidgetrepaintmanager.cpp index 1b963010d1..30d92551f7 100644 --- a/src/widgets/kernel/qwidgetbackingstore.cpp +++ b/src/widgets/kernel/qwidgetrepaintmanager.cpp @@ -40,7 +40,7 @@ #include "qplatformdefs.h" -#include "qwidgetbackingstore_p.h" +#include "qwidgetrepaintmanager_p.h" #include <QtCore/qglobal.h> #include <QtCore/qdebug.h> @@ -87,9 +87,9 @@ static bool hasPlatformWindow(QWidget *widget) * Flushes the contents of the \a backingStore into the screen area of \a widget. * \a region is the region to be updated in \a widget coordinates. */ -void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, +void QWidgetRepaintManager::qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, QWidget *tlw, QPlatformTextureList *widgetTextures, - QWidgetBackingStore *widgetBackingStore) + QWidgetRepaintManager *repaintManager) { #ifdef QT_NO_OPENGL Q_UNUSED(widgetTextures); @@ -103,7 +103,7 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBack #if !defined(QT_NO_PAINT_DEBUG) static int flushUpdate = qEnvironmentVariableIntValue("QT_FLUSH_UPDATE"); if (flushUpdate > 0) - QWidgetBackingStore::showYellowThing(widget, region, flushUpdate * 10, false); + QWidgetRepaintManager::showYellowThing(widget, region, flushUpdate * 10, false); #endif if (tlw->testAttribute(Qt::WA_DontShowOnScreen) || widget->testAttribute(Qt::WA_DontShowOnScreen)) @@ -117,12 +117,12 @@ void QWidgetBackingStore::qt_flush(QWidget *widget, const QRegion ®ion, QBack static bool fpsDebug = qEnvironmentVariableIntValue("QT_DEBUG_FPS"); if (fpsDebug) { - if (!widgetBackingStore->perfFrames++) - widgetBackingStore->perfTime.start(); - if (widgetBackingStore->perfTime.elapsed() > 5000) { - double fps = double(widgetBackingStore->perfFrames * 1000) / widgetBackingStore->perfTime.restart(); + if (!repaintManager->perfFrames++) + repaintManager->perfTime.start(); + if (repaintManager->perfTime.elapsed() > 5000) { + double fps = double(repaintManager->perfFrames * 1000) / repaintManager->perfTime.restart(); qDebug("FPS: %.1f\n", fps); - widgetBackingStore->perfFrames = 0; + repaintManager->perfFrames = 0; } } @@ -197,7 +197,7 @@ static void showYellowThing_win(QWidget *widget, const QRegion ®ion, int msec } #endif // defined(Q_OS_WIN) && !defined(Q_OS_WINRT) -void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) +void QWidgetRepaintManager::showYellowThing(QWidget *widget, const QRegion &toBePainted, int msec, bool unclipped) { #ifdef Q_OS_WINRT Q_UNUSED(msec) @@ -268,7 +268,7 @@ void QWidgetBackingStore::showYellowThing(QWidget *widget, const QRegion &toBePa #endif // !Q_OS_WIN } -bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) +bool QWidgetRepaintManager::flushPaint(QWidget *widget, const QRegion &rgn) { if (!widget) return false; @@ -286,11 +286,11 @@ bool QWidgetBackingStore::flushPaint(QWidget *widget, const QRegion &rgn) delay = flushPaint; } - QWidgetBackingStore::showYellowThing(widget, rgn, delay * 10, true); + QWidgetRepaintManager::showYellowThing(widget, rgn, delay * 10, true); return true; } -void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) +void QWidgetRepaintManager::unflushPaint(QWidget *widget, const QRegion &rgn) { if (widget->d_func()->paintOnScreen() || rgn.isEmpty()) return; @@ -300,7 +300,7 @@ void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) if (!tlwExtra) return; - qt_flush(widget, rgn, tlwExtra->widgetBackingStore->store, tlw, 0, tlw->d_func()->maybeBackingStore()); + qt_flush(widget, rgn, tlwExtra->repaintManager->store, tlw, 0, tlw->d_func()->maybeRepaintManager()); } #endif // QT_NO_PAINT_DEBUG @@ -308,7 +308,7 @@ void QWidgetBackingStore::unflushPaint(QWidget *widget, const QRegion &rgn) Moves the whole rect by (dx, dy) in widget's coordinate system. Doesn't generate any updates. */ -bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *widget) +bool QWidgetRepaintManager::bltRect(const QRect &rect, int dx, int dy, QWidget *widget) { const QPoint pos(widget->mapTo(tlw, rect.topLeft())); const QRect tlwRect(QRect(pos, rect.size())); @@ -323,7 +323,7 @@ bool QWidgetBackingStore::bltRect(const QRect &rect, int dx, int dy, QWidget *wi The \a toClean region might be clipped by the window surface. */ -void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QBackingStore *backingStore, +void QWidgetRepaintManager::beginPaint(QRegion &toClean, QWidget *widget, QBackingStore *backingStore, BeginPaintInfo *returnInfo, bool toCleanIsInTopLevelCoordinates) { Q_UNUSED(widget); @@ -335,7 +335,7 @@ void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QBacking #ifdef QT_NO_PAINT_DEBUG backingStore->beginPaint(toClean); #else - returnInfo->wasFlushed = QWidgetBackingStore::flushPaint(tlw, toClean); + returnInfo->wasFlushed = QWidgetRepaintManager::flushPaint(tlw, toClean); // Avoid deadlock with QT_FLUSH_PAINT: the server will wait for // the BackingStore lock, so if we hold that, the server will // never release the Communication lock that we are waiting for in @@ -347,14 +347,14 @@ void QWidgetBackingStore::beginPaint(QRegion &toClean, QWidget *widget, QBacking Q_UNUSED(returnInfo); } -void QWidgetBackingStore::endPaint(const QRegion &cleaned, QBackingStore *backingStore, +void QWidgetRepaintManager::endPaint(const QRegion &cleaned, QBackingStore *backingStore, BeginPaintInfo *beginPaintInfo) { #ifndef QT_NO_PAINT_DEBUG if (!beginPaintInfo->wasFlushed) backingStore->endPaint(); else - QWidgetBackingStore::unflushPaint(tlw, cleaned); + QWidgetRepaintManager::unflushPaint(tlw, cleaned); #else Q_UNUSED(beginPaintInfo); Q_UNUSED(cleaned); @@ -370,7 +370,7 @@ void QWidgetBackingStore::endPaint(const QRegion &cleaned, QBackingStore *backin If the widget is non-zero, only the dirty region for the widget is returned and the region will be in widget coordinates. */ -QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const +QRegion QWidgetRepaintManager::dirtyRegion(QWidget *widget) const { const bool widgetDirty = widget && widget != tlw; const QRect tlwRect(topLevelRect()); @@ -419,7 +419,7 @@ QRegion QWidgetBackingStore::dirtyRegion(QWidget *widget) const for the entire backing store is returned. The content will be clipped to \a withinClipRect if non-empty. */ -QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &withinClipRect) const +QRegion QWidgetRepaintManager::staticContents(QWidget *parent, const QRect &withinClipRect) const { if (!parent && tlw->testAttribute(Qt::WA_StaticContents)) { const QSize surfaceGeometry(store->size()); @@ -467,7 +467,7 @@ QRegion QWidgetBackingStore::staticContents(QWidget *parent, const QRect &within return region; } -void QWidgetBackingStore::sendUpdateRequest(QWidget *widget, UpdateTime updateTime) +void QWidgetRepaintManager::sendUpdateRequest(QWidget *widget, UpdateTime updateTime) { if (!widget) return; @@ -520,7 +520,7 @@ static inline QRect widgetRectFor(QWidget *widget, const QRegion &) { return wid instead of the top-level widget, and bufferState is completely ignored. */ template <class T> -void QWidgetBackingStore::markDirty(const T &r, QWidget *widget, UpdateTime updateTime, BufferState bufferState) +void QWidgetRepaintManager::markDirty(const T &r, QWidget *widget, UpdateTime updateTime, BufferState bufferState) { Q_ASSERT(tlw->d_func()->extra); Q_ASSERT(tlw->d_func()->extra->topextra); @@ -624,8 +624,8 @@ void QWidgetBackingStore::markDirty(const T &r, QWidget *widget, UpdateTime upda if (updateTime == UpdateNow) sendUpdateRequest(tlw, updateTime); } -template void QWidgetBackingStore::markDirty<QRect>(const QRect &, QWidget *, UpdateTime, BufferState); -template void QWidgetBackingStore::markDirty<QRegion>(const QRegion &, QWidget *, UpdateTime, BufferState); +template void QWidgetRepaintManager::markDirty<QRect>(const QRect &, QWidget *, UpdateTime, BufferState); +template void QWidgetRepaintManager::markDirty<QRegion>(const QRegion &, QWidget *, UpdateTime, BufferState); /*! Marks the \a region of the \a widget as dirty on screen. The \a region will be copied from @@ -633,7 +633,7 @@ template void QWidgetBackingStore::markDirty<QRegion>(const QRegion &, QWidget * Paint on screen widgets are ignored. */ -void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widget, const QPoint &topLevelOffset) +void QWidgetRepaintManager::markDirtyOnScreen(const QRegion ®ion, QWidget *widget, const QPoint &topLevelOffset) { if (!widget || widget->d_func()->paintOnScreen() || region.isEmpty()) return; @@ -678,7 +678,7 @@ void QWidgetBackingStore::markDirtyOnScreen(const QRegion ®ion, QWidget *widg appendDirtyOnScreenWidget(widget); } -void QWidgetBackingStore::removeDirtyWidget(QWidget *w) +void QWidgetRepaintManager::removeDirtyWidget(QWidget *w) { if (!w) return; @@ -696,7 +696,7 @@ void QWidgetBackingStore::removeDirtyWidget(QWidget *w) } } -void QWidgetBackingStore::updateLists(QWidget *cur) +void QWidgetRepaintManager::updateLists(QWidget *cur) { if (!cur) return; @@ -714,7 +714,7 @@ void QWidgetBackingStore::updateLists(QWidget *cur) addStaticWidget(cur); } -QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) +QWidgetRepaintManager::QWidgetRepaintManager(QWidget *topLevel) : tlw(topLevel), updateRequestSent(0), textureListWatcher(0), @@ -727,7 +727,7 @@ QWidgetBackingStore::QWidgetBackingStore(QWidget *topLevel) updateLists(topLevel); } -QWidgetBackingStore::~QWidgetBackingStore() +QWidgetRepaintManager::~QWidgetRepaintManager() { for (int c = 0; c < dirtyWidgets.size(); ++c) resetWidget(dirtyWidgets.at(c)); @@ -800,7 +800,7 @@ void QWidgetPrivate::moveRect(const QRect &rect, int dx, int dy) invalidateBackingStore((newRect & clipR).translated(-data.crect.topLeft())); } else { - QWidgetBackingStore *wbs = x->widgetBackingStore.get(); + QWidgetRepaintManager *wbs = x->repaintManager.get(); QRegion childExpose(newRect & clipR); QRegion overlappedExpose; @@ -864,7 +864,7 @@ void QWidgetPrivate::scrollRect(const QRect &rect, int dx, int dy) if (x->inTopLevelResize) return; - QWidgetBackingStore *wbs = x->widgetBackingStore.get(); + QWidgetRepaintManager *wbs = x->repaintManager.get(); if (!wbs) return; @@ -1006,8 +1006,8 @@ static QPlatformTextureList *widgetTexturesFor(QWidget *tlw, QWidget *widget) // unlocked state. This is essential when a custom composeAndFlush() // implementation in a platform plugin is not synchronous and keeps // holding on to the textures for some time even after returning from there. -QPlatformTextureListWatcher::QPlatformTextureListWatcher(QWidgetBackingStore *backingStore) - : m_backingStore(backingStore) +QPlatformTextureListWatcher::QPlatformTextureListWatcher(QWidgetRepaintManager *paintManager) + : m_repaintManager(paintManager) { } @@ -1031,7 +1031,7 @@ void QPlatformTextureListWatcher::onLockStatusChanged(bool locked) QPlatformTextureList *tl = static_cast<QPlatformTextureList *>(sender()); m_locked[tl] = locked; if (!isLocked()) - m_backingStore->sync(); + m_repaintManager->sync(); } #else @@ -1053,7 +1053,7 @@ static inline bool discardSyncRequest(QWidget *tlw, QTLWExtra *tlwExtra) return false; } -bool QWidgetBackingStore::syncAllowed() +bool QWidgetRepaintManager::syncAllowed() { #ifndef QT_NO_OPENGL QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); @@ -1085,7 +1085,7 @@ bool QWidgetBackingStore::syncAllowed() otherwise the area is marked as dirty on screen and will be flushed right after we are done with all painting. */ -void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedRegion) +void QWidgetRepaintManager::sync(QWidget *exposedWidget, const QRegion &exposedRegion) { QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); if (!tlw->isVisible() || !tlwExtra || tlwExtra->inTopLevelResize) @@ -1116,7 +1116,7 @@ void QWidgetBackingStore::sync(QWidget *exposedWidget, const QRegion &exposedReg /*! Synchronizes the backing store, i.e. dirty areas are repainted and flushed. */ -void QWidgetBackingStore::sync() +void QWidgetRepaintManager::sync() { updateRequestSent = false; QTLWExtra *tlwExtra = tlw->d_func()->maybeTopData(); @@ -1139,7 +1139,7 @@ void QWidgetBackingStore::sync() doSync(); } -void QWidgetBackingStore::doSync() +void QWidgetRepaintManager::doSync() { const bool updatesDisabled = !tlw->updatesEnabled(); bool repaintAllWidgets = false; @@ -1365,7 +1365,7 @@ void QWidgetBackingStore::doSync() If the \a widget is non-zero, the content is flushed to the \a widget. If the \a surface is non-zero, the content of the \a surface is flushed. */ -void QWidgetBackingStore::flush(QWidget *widget) +void QWidgetRepaintManager::flush(QWidget *widget) { const bool hasDirtyOnScreenWidgets = !dirtyOnScreenWidgets.isEmpty(); bool flushed = false; @@ -1424,8 +1424,8 @@ void QWidgetPrivate::invalidateBackingStore_resizeHelper(const QPoint &oldPos, c if (!staticContents || graphicsEffect) { QRegion staticChildren; - QWidgetBackingStore *bs = 0; - if (offset.isNull() && (bs = maybeBackingStore())) + QWidgetRepaintManager *bs = 0; + if (offset.isNull() && (bs = maybeRepaintManager())) staticChildren = bs->staticContents(q, oldWidgetRect); const bool hasStaticChildren = !staticChildren.isEmpty(); @@ -1528,11 +1528,11 @@ void QWidgetPrivate::invalidateBackingStore(const T &r) if (masked.isEmpty()) return; - tlwExtra->widgetBackingStore->markDirty(masked, q, - QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); + tlwExtra->repaintManager->markDirty(masked, q, + QWidgetRepaintManager::UpdateLater, QWidgetRepaintManager::BufferInvalid); } else { - tlwExtra->widgetBackingStore->markDirty(clipped, q, - QWidgetBackingStore::UpdateLater, QWidgetBackingStore::BufferInvalid); + tlwExtra->repaintManager->markDirty(clipped, q, + QWidgetRepaintManager::UpdateLater, QWidgetRepaintManager::BufferInvalid); } } // Needed by tst_QWidget @@ -1575,14 +1575,14 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) return; // Nothing to repaint. #ifndef QT_NO_PAINT_DEBUG - bool flushed = QWidgetBackingStore::flushPaint(q, toBePainted); + bool flushed = QWidgetRepaintManager::flushPaint(q, toBePainted); #endif drawWidget(q, toBePainted, QPoint(), QWidgetPrivate::DrawAsRoot | QWidgetPrivate::DrawPaintOnScreen, 0); #ifndef QT_NO_PAINT_DEBUG if (flushed) - QWidgetBackingStore::unflushPaint(q, toBePainted); + QWidgetRepaintManager::unflushPaint(q, toBePainted); #endif if (Q_UNLIKELY(q->paintingActive())) @@ -1592,4 +1592,4 @@ void QWidgetPrivate::repaint_sys(const QRegion &rgn) QT_END_NAMESPACE -#include "moc_qwidgetbackingstore_p.cpp" +#include "moc_qwidgetrepaintmanager_p.cpp" diff --git a/src/widgets/kernel/qwidgetbackingstore_p.h b/src/widgets/kernel/qwidgetrepaintmanager_p.h index 08042445bf..36f42b7e1a 100644 --- a/src/widgets/kernel/qwidgetbackingstore_p.h +++ b/src/widgets/kernel/qwidgetrepaintmanager_p.h @@ -37,8 +37,8 @@ ** ****************************************************************************/ -#ifndef QWIDGETBACKINGSTORE_P_H -#define QWIDGETBACKINGSTORE_P_H +#ifndef QWIDGETREPAINTMANAGER_P_H +#define QWIDGETREPAINTMANAGER_P_H // // W A R N I N G @@ -61,7 +61,7 @@ QT_BEGIN_NAMESPACE class QPlatformTextureList; class QPlatformTextureListWatcher; -class QWidgetBackingStore; +class QWidgetRepaintManager; struct BeginPaintInfo { inline BeginPaintInfo() : wasFlushed(0), nothingToPaint(0), backingStoreRecreated(0) {} @@ -76,7 +76,7 @@ class QPlatformTextureListWatcher : public QObject Q_OBJECT public: - QPlatformTextureListWatcher(QWidgetBackingStore *backingStore); + QPlatformTextureListWatcher(QWidgetRepaintManager *repaintManager); void watch(QPlatformTextureList *textureList); bool isLocked() const; @@ -85,11 +85,11 @@ private slots: private: QHash<QPlatformTextureList *, bool> m_locked; - QWidgetBackingStore *m_backingStore; + QWidgetRepaintManager *m_repaintManager; }; #endif -class Q_AUTOTEST_EXPORT QWidgetBackingStore +class Q_AUTOTEST_EXPORT QWidgetRepaintManager { public: enum UpdateTime { @@ -102,8 +102,8 @@ public: BufferInvalid }; - QWidgetBackingStore(QWidget *t); - ~QWidgetBackingStore(); + QWidgetRepaintManager(QWidget *t); + ~QWidgetRepaintManager(); static void showYellowThing(QWidget *widget, const QRegion &rgn, int msec, bool); @@ -145,7 +145,7 @@ private: static void qt_flush(QWidget *widget, const QRegion ®ion, QBackingStore *backingStore, QWidget *tlw, QPlatformTextureList *widgetTextures, - QWidgetBackingStore *widgetBackingStore); + QWidgetRepaintManager *repaintManager); void doSync(); bool bltRect(const QRect &rect, int dx, int dy, QWidget *widget); @@ -208,8 +208,8 @@ private: inline void moveStaticWidgets(QWidget *reparented) { Q_ASSERT(reparented); - QWidgetBackingStore *newBs = reparented->d_func()->maybeBackingStore(); - if (newBs == this) + QWidgetRepaintManager *newPaintManager = reparented->d_func()->maybeRepaintManager(); + if (newPaintManager == this) return; int i = 0; @@ -217,8 +217,8 @@ private: QWidget *w = staticWidgets.at(i); if (reparented == w || reparented->isAncestorOf(w)) { staticWidgets.removeAt(i); - if (newBs) - newBs->addStaticWidget(w); + if (newPaintManager) + newPaintManager->addStaticWidget(w); } else { ++i; } @@ -273,9 +273,9 @@ private: friend class QWidget; friend class QBackingStore; - Q_DISABLE_COPY_MOVE(QWidgetBackingStore) + Q_DISABLE_COPY_MOVE(QWidgetRepaintManager) }; QT_END_NAMESPACE -#endif // QBACKINGSTORE_P_H +#endif // QWIDGETREPAINTMANAGER_P_H diff --git a/src/widgets/kernel/qwidgetwindow.cpp b/src/widgets/kernel/qwidgetwindow.cpp index a01a377956..3a824371f3 100644 --- a/src/widgets/kernel/qwidgetwindow.cpp +++ b/src/widgets/kernel/qwidgetwindow.cpp @@ -46,7 +46,7 @@ #ifndef QT_NO_ACCESSIBILITY #include <QtGui/qaccessible.h> #endif -#include <private/qwidgetbackingstore_p.h> +#include <private/qwidgetrepaintmanager_p.h> #include <qpa/qwindowsysteminterface_p.h> #include <qpa/qplatformtheme.h> #include <qpa/qplatformwindow.h> @@ -770,8 +770,8 @@ void QWidgetWindow::repaintWindow() QTLWExtra *tlwExtra = m_widget->window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) - tlwExtra->widgetBackingStore->markDirty(m_widget->rect(), m_widget, - QWidgetBackingStore::UpdateNow, QWidgetBackingStore::BufferInvalid); + tlwExtra->repaintManager->markDirty(m_widget->rect(), m_widget, + QWidgetRepaintManager::UpdateNow, QWidgetRepaintManager::BufferInvalid); } // Store normal geometry used for saving application settings. |