widgets: Simplify QWidgetRepaintManager::flush

Change-Id: Icba88fa068aac2ac5d8bb04e46a3e3f34e279a48
Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
Tor Arne Vestbø 2019-08-26 16:23:46 +02:00
parent 4cc3615b4e
commit 3542fc4958
2 changed files with 5 additions and 10 deletions

View File

@ -1063,17 +1063,15 @@ void QWidgetRepaintManager::markNeedsFlush(QWidget *widget, const QRegion &regio
/*!
Flushes the contents of the backing store into the top-level widget.
If the \a widget is non-zero, the content is flushed to the \a widget.
*/
void QWidgetRepaintManager::flush(QWidget *widget)
void QWidgetRepaintManager::flush()
{
const bool hasNeedsFlushWidgets = !needsFlushWidgets.isEmpty();
bool flushed = false;
// Flush the top level widget
if (!topLevelNeedsFlush.isEmpty()) {
QWidget *target = widget ? widget : tlw;
flush(target, topLevelNeedsFlush, widgetTexturesFor(tlw, tlw));
flush(tlw, topLevelNeedsFlush, widgetTexturesFor(tlw, tlw));
topLevelNeedsFlush = QRegion();
flushed = true;
}
@ -1082,11 +1080,8 @@ void QWidgetRepaintManager::flush(QWidget *widget)
if (!flushed && !hasNeedsFlushWidgets) {
#ifndef QT_NO_OPENGL
if (!tlw->d_func()->topData()->widgetTextures.empty()) {
QPlatformTextureList *widgetTextures = widgetTexturesFor(tlw, tlw);
if (widgetTextures) {
QWidget *target = widget ? widget : tlw;
flush(target, QRegion(), widgetTextures);
}
if (QPlatformTextureList *widgetTextures = widgetTexturesFor(tlw, tlw))
flush(tlw, QRegion(), widgetTextures);
}
#endif
}

View File

@ -115,7 +115,7 @@ private:
void markNeedsFlush(QWidget *widget, const QRegion &region = QRegion());
void flush(QWidget *widget = nullptr);
void flush();
void flush(QWidget *widget, const QRegion &region, QPlatformTextureList *widgetTextures);
bool isDirty() const;