widgets: Share more code in appendDirtyOnScreenWidget
Change-Id: I0ed936c7d8b004d498a8956b1ba246ade41ce43d Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
655e8b6eab
commit
ca3b48539d
@ -922,9 +922,6 @@ void QWidgetRepaintManager::paintAndFlush()
|
||||
if (hasPlatformWindow(w) || (npw && npw != tlw)) {
|
||||
if (!hasPlatformWindow(w))
|
||||
w = npw;
|
||||
QWidgetPrivate *wPrivate = w->d_func();
|
||||
if (!wPrivate->needsFlush)
|
||||
wPrivate->needsFlush = new QRegion;
|
||||
appendDirtyOnScreenWidget(w);
|
||||
}
|
||||
}
|
||||
@ -1039,29 +1036,27 @@ void QWidgetRepaintManager::markDirtyOnScreen(const QRegion ®ion, QWidget *wi
|
||||
return;
|
||||
}
|
||||
|
||||
// Alien widgets with native parent != tlw.
|
||||
QWidgetPrivate *nativeParentPrivate = nativeParent->d_func();
|
||||
if (!nativeParentPrivate->needsFlush)
|
||||
nativeParentPrivate->needsFlush = new QRegion;
|
||||
// Alien widgets with native parent != tlw
|
||||
const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint());
|
||||
*nativeParentPrivate->needsFlush += region.translated(nativeParentOffset);
|
||||
appendDirtyOnScreenWidget(nativeParent);
|
||||
appendDirtyOnScreenWidget(nativeParent, region.translated(nativeParentOffset));
|
||||
return;
|
||||
}
|
||||
|
||||
// Native child widgets.
|
||||
QWidgetPrivate *widgetPrivate = widget->d_func();
|
||||
if (!widgetPrivate->needsFlush)
|
||||
widgetPrivate->needsFlush = new QRegion;
|
||||
*widgetPrivate->needsFlush += region;
|
||||
appendDirtyOnScreenWidget(widget);
|
||||
// Native child widgets
|
||||
appendDirtyOnScreenWidget(widget, region);
|
||||
}
|
||||
|
||||
void QWidgetRepaintManager::appendDirtyOnScreenWidget(QWidget *widget)
|
||||
void QWidgetRepaintManager::appendDirtyOnScreenWidget(QWidget *widget, const QRegion ®ion)
|
||||
{
|
||||
if (!widget)
|
||||
return;
|
||||
|
||||
auto *widgetPrivate = qt_widget_private(widget);
|
||||
if (!widgetPrivate->needsFlush)
|
||||
widgetPrivate->needsFlush = new QRegion;
|
||||
|
||||
*widgetPrivate->needsFlush += region;
|
||||
|
||||
if (!dirtyOnScreenWidgets.contains(widget))
|
||||
dirtyOnScreenWidgets.append(widget);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ private:
|
||||
bool syncAllowed();
|
||||
void paintAndFlush();
|
||||
|
||||
void appendDirtyOnScreenWidget(QWidget *widget);
|
||||
void appendDirtyOnScreenWidget(QWidget *widget, const QRegion ®ion = QRegion());
|
||||
|
||||
void flush(QWidget *widget = nullptr);
|
||||
void flush(QWidget *widget, const QRegion ®ion, QPlatformTextureList *widgetTextures);
|
||||
|
Loading…
Reference in New Issue
Block a user