Execute pixmapChangedCommands only if items have changed

This patch prevents continuous image updates by making sure
to only execute pixmapChangedCommnds if an item is dirty.

Change-Id: Icadc1d8a2a2298d18147b31fbed3fbc4205f0ea8
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Knud Dollereder
2021-07-14 16:12:23 +02:00
parent cc1375baa1
commit 30f6084f0d

View File

@@ -77,8 +77,15 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
DesignerSupport::polishItems(quickWindow());
if (quickWindow() && nodeInstanceClient()->bytesToWrite() < 10000) {
bool windowDirty = false;
foreach (QQuickItem *item, allItems()) {
if (item) {
if (Internal::QuickItemNodeInstance::unifiedRenderPath()) {
if (DesignerSupport::isDirty(item, DesignerSupport::AllMask)) {
windowDirty = true;
break;
}
} else {
if (hasInstanceForObject(item)) {
if (DesignerSupport::isDirty(item, DesignerSupport::ContentUpdateMask))
m_dirtyInstanceSet.insert(instanceForObject(item));
@@ -90,6 +97,7 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
Internal::QuickItemNodeInstance::updateDirtyNode(item);
}
}
}
clearChangedPropertyList();
@@ -97,6 +105,7 @@ void Qt5RenderNodeInstanceServer::collectItemChangesAndSendChangeCommands()
/* QQuickItem::grabToImage render path */
/* TODO implement QQuickItem::grabToImage based rendering */
/* sheduleRootItemRender(); */
if (windowDirty)
nodeInstanceClient()->pixmapChanged(createPixmapChangedCommand({rootNodeInstance()}));
} else {
if (!m_dirtyInstanceSet.isEmpty()) {