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) || (npw && npw != tlw)) {
|
||||||
if (!hasPlatformWindow(w))
|
if (!hasPlatformWindow(w))
|
||||||
w = npw;
|
w = npw;
|
||||||
QWidgetPrivate *wPrivate = w->d_func();
|
|
||||||
if (!wPrivate->needsFlush)
|
|
||||||
wPrivate->needsFlush = new QRegion;
|
|
||||||
appendDirtyOnScreenWidget(w);
|
appendDirtyOnScreenWidget(w);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1039,29 +1036,27 @@ void QWidgetRepaintManager::markDirtyOnScreen(const QRegion ®ion, QWidget *wi
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Alien widgets with native parent != tlw.
|
// Alien widgets with native parent != tlw
|
||||||
QWidgetPrivate *nativeParentPrivate = nativeParent->d_func();
|
|
||||||
if (!nativeParentPrivate->needsFlush)
|
|
||||||
nativeParentPrivate->needsFlush = new QRegion;
|
|
||||||
const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint());
|
const QPoint nativeParentOffset = widget->mapTo(nativeParent, QPoint());
|
||||||
*nativeParentPrivate->needsFlush += region.translated(nativeParentOffset);
|
appendDirtyOnScreenWidget(nativeParent, region.translated(nativeParentOffset));
|
||||||
appendDirtyOnScreenWidget(nativeParent);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Native child widgets.
|
// Native child widgets
|
||||||
QWidgetPrivate *widgetPrivate = widget->d_func();
|
appendDirtyOnScreenWidget(widget, region);
|
||||||
if (!widgetPrivate->needsFlush)
|
|
||||||
widgetPrivate->needsFlush = new QRegion;
|
|
||||||
*widgetPrivate->needsFlush += region;
|
|
||||||
appendDirtyOnScreenWidget(widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QWidgetRepaintManager::appendDirtyOnScreenWidget(QWidget *widget)
|
void QWidgetRepaintManager::appendDirtyOnScreenWidget(QWidget *widget, const QRegion ®ion)
|
||||||
{
|
{
|
||||||
if (!widget)
|
if (!widget)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
auto *widgetPrivate = qt_widget_private(widget);
|
||||||
|
if (!widgetPrivate->needsFlush)
|
||||||
|
widgetPrivate->needsFlush = new QRegion;
|
||||||
|
|
||||||
|
*widgetPrivate->needsFlush += region;
|
||||||
|
|
||||||
if (!dirtyOnScreenWidgets.contains(widget))
|
if (!dirtyOnScreenWidgets.contains(widget))
|
||||||
dirtyOnScreenWidgets.append(widget);
|
dirtyOnScreenWidgets.append(widget);
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ private:
|
|||||||
bool syncAllowed();
|
bool syncAllowed();
|
||||||
void paintAndFlush();
|
void paintAndFlush();
|
||||||
|
|
||||||
void appendDirtyOnScreenWidget(QWidget *widget);
|
void appendDirtyOnScreenWidget(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);
|
||||||
|
Loading…
Reference in New Issue
Block a user