widgets: Clarify how widgets needing flush is tracked
Change-Id: Ia2c2c4b830e4441e50c66dd3fef5bc060f76551e Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
787314c230
commit
74be54684c
@ -332,10 +332,11 @@ void QWidgetRepaintManager::removeDirtyWidget(QWidget *w)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
dirtyWidgets.removeAll(w);
|
dirtyWidgets.removeAll(w);
|
||||||
dirtyOnScreenWidgets.removeAll(w);
|
|
||||||
dirtyRenderToTextureWidgets.removeAll(w);
|
dirtyRenderToTextureWidgets.removeAll(w);
|
||||||
resetWidget(w);
|
resetWidget(w);
|
||||||
|
|
||||||
|
needsFlushWidgets.removeAll(w);
|
||||||
|
|
||||||
QWidgetPrivate *wd = w->d_func();
|
QWidgetPrivate *wd = w->d_func();
|
||||||
const int n = wd->children.count();
|
const int n = wd->children.count();
|
||||||
for (int i = 0; i < n; ++i) {
|
for (int i = 0; i < n; ++i) {
|
||||||
@ -920,7 +921,7 @@ void QWidgetRepaintManager::paintAndFlush()
|
|||||||
if (hasPlatformWindow(w) || (npw && npw != tlw)) {
|
if (hasPlatformWindow(w) || (npw && npw != tlw)) {
|
||||||
if (!hasPlatformWindow(w))
|
if (!hasPlatformWindow(w))
|
||||||
w = npw;
|
w = npw;
|
||||||
appendDirtyOnScreenWidget(w);
|
markNeedsFlush(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1031,15 +1032,15 @@ void QWidgetRepaintManager::markNeedsFlush(QWidget *widget, const QRegion ®io
|
|||||||
} else {
|
} else {
|
||||||
// Alien widgets with native parent != tlw
|
// Alien widgets with native parent != tlw
|
||||||
const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint());
|
const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint());
|
||||||
appendDirtyOnScreenWidget(nativeParent, region.translated(nativeParentOffset));
|
markNeedsFlush(nativeParent, region.translated(nativeParentOffset));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Native child widgets
|
// Native child widgets
|
||||||
appendDirtyOnScreenWidget(widget, region);
|
markNeedsFlush(widget, region);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWidgetRepaintManager::appendDirtyOnScreenWidget(QWidget *widget, const QRegion ®ion)
|
void QWidgetRepaintManager::markNeedsFlush(QWidget *widget, const QRegion ®ion)
|
||||||
{
|
{
|
||||||
if (!widget)
|
if (!widget)
|
||||||
return;
|
return;
|
||||||
@ -1050,8 +1051,8 @@ void QWidgetRepaintManager::appendDirtyOnScreenWidget(QWidget *widget, const QRe
|
|||||||
|
|
||||||
*widgetPrivate->needsFlush += region;
|
*widgetPrivate->needsFlush += region;
|
||||||
|
|
||||||
if (!dirtyOnScreenWidgets.contains(widget))
|
if (!needsFlushWidgets.contains(widget))
|
||||||
dirtyOnScreenWidgets.append(widget);
|
needsFlushWidgets.append(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -1060,7 +1061,7 @@ void QWidgetRepaintManager::appendDirtyOnScreenWidget(QWidget *widget, const QRe
|
|||||||
*/
|
*/
|
||||||
void QWidgetRepaintManager::flush(QWidget *widget)
|
void QWidgetRepaintManager::flush(QWidget *widget)
|
||||||
{
|
{
|
||||||
const bool hasDirtyOnScreenWidgets = !dirtyOnScreenWidgets.isEmpty();
|
const bool hasNeedsFlushWidgets = !needsFlushWidgets.isEmpty();
|
||||||
bool flushed = false;
|
bool flushed = false;
|
||||||
|
|
||||||
// Flush the top level widget
|
// Flush the top level widget
|
||||||
@ -1071,8 +1072,8 @@ void QWidgetRepaintManager::flush(QWidget *widget)
|
|||||||
flushed = true;
|
flushed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Render-to-texture widgets are not in needsFlush so flush if we have not done it above.
|
// Render-to-texture widgets are not in topLevelNeedsFlush so flush if we have not done it above.
|
||||||
if (!flushed && !hasDirtyOnScreenWidgets) {
|
if (!flushed && !hasNeedsFlushWidgets) {
|
||||||
#ifndef QT_NO_OPENGL
|
#ifndef QT_NO_OPENGL
|
||||||
if (!tlw->d_func()->topData()->widgetTextures.empty()) {
|
if (!tlw->d_func()->topData()->widgetTextures.empty()) {
|
||||||
QPlatformTextureList *widgetTextures = widgetTexturesFor(tlw, tlw);
|
QPlatformTextureList *widgetTextures = widgetTexturesFor(tlw, tlw);
|
||||||
@ -1084,10 +1085,10 @@ void QWidgetRepaintManager::flush(QWidget *widget)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasDirtyOnScreenWidgets)
|
if (!hasNeedsFlushWidgets)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (QWidget *w : qExchange(dirtyOnScreenWidgets, {})) {
|
for (QWidget *w : qExchange(needsFlushWidgets, {})) {
|
||||||
QWidgetPrivate *wd = w->d_func();
|
QWidgetPrivate *wd = w->d_func();
|
||||||
Q_ASSERT(wd->needsFlush);
|
Q_ASSERT(wd->needsFlush);
|
||||||
QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : 0;
|
QPlatformTextureList *widgetTexturesForNative = wd->textureChildSeen ? widgetTexturesFor(tlw, w) : 0;
|
||||||
@ -1323,7 +1324,7 @@ QRegion QWidgetRepaintManager::dirtyRegion(QWidget *widget) const
|
|||||||
// Append the region that needs flush.
|
// Append the region that needs flush.
|
||||||
r += topLevelNeedsFlush;
|
r += topLevelNeedsFlush;
|
||||||
|
|
||||||
for (QWidget *w : dirtyOnScreenWidgets) {
|
for (QWidget *w : needsFlushWidgets) {
|
||||||
if (widgetDirty && w != widget && !widget->isAncestorOf(w))
|
if (widgetDirty && w != widget && !widget->isAncestorOf(w))
|
||||||
continue;
|
continue;
|
||||||
QWidgetPrivate *wd = w->d_func();
|
QWidgetPrivate *wd = w->d_func();
|
||||||
|
@ -113,7 +113,7 @@ private:
|
|||||||
bool syncAllowed();
|
bool syncAllowed();
|
||||||
void paintAndFlush();
|
void paintAndFlush();
|
||||||
|
|
||||||
void appendDirtyOnScreenWidget(QWidget *widget, const QRegion ®ion = QRegion());
|
void markNeedsFlush(QWidget *widget, const QRegion ®ion = QRegion());
|
||||||
|
|
||||||
void flush(QWidget *widget = nullptr);
|
void flush(QWidget *widget = nullptr);
|
||||||
void flush(QWidget *widget, const QRegion ®ion, QPlatformTextureList *widgetTextures);
|
void flush(QWidget *widget, const QRegion ®ion, QPlatformTextureList *widgetTextures);
|
||||||
@ -134,7 +134,7 @@ private:
|
|||||||
QVector<QWidget *> dirtyRenderToTextureWidgets;
|
QVector<QWidget *> dirtyRenderToTextureWidgets;
|
||||||
|
|
||||||
QRegion topLevelNeedsFlush;
|
QRegion topLevelNeedsFlush;
|
||||||
QVector<QWidget *> dirtyOnScreenWidgets;
|
QVector<QWidget *> needsFlushWidgets;
|
||||||
|
|
||||||
QList<QWidget *> staticWidgets;
|
QList<QWidget *> staticWidgets;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user