Skip to content

Commit 0308948

Browse files
committed
[CoordinatedGraphics] CoordinatedPlatformLayer should accumulate damage
https://bugs.webkit.org/show_bug.cgi?id=290164 Reviewed by Alejandro G. Castro. We currently replace current damage with the given one, but in case of multiple layer flushes before the composition, the damage should be accumulated. * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.cpp: (WebCore::CoordinatedPlatformLayer::setDamage): (WebCore::CoordinatedPlatformLayer::flushCompositingState): * Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.h: Canonical link: https://commits.webkit.org/292582@main
1 parent ac177a3 commit 0308948

2 files changed

Lines changed: 11 additions & 4 deletions

File tree

Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,11 @@ void CoordinatedPlatformLayer::setDirtyRegion(Vector<IntRect, 1>&& dirtyRegion)
562562
void CoordinatedPlatformLayer::setDamage(Damage&& damage)
563563
{
564564
ASSERT(m_lock.isHeld());
565-
m_damage = WTFMove(damage);
565+
566+
if (!m_damage)
567+
m_damage = WTFMove(damage);
568+
else
569+
m_damage->add(damage);
566570
m_pendingChanges.add(Change::Damage);
567571
}
568572
#endif
@@ -908,8 +912,11 @@ void CoordinatedPlatformLayer::flushCompositingState(TextureMapper& textureMappe
908912
layer.setSolidColor(m_contentsColor);
909913

910914
#if ENABLE(DAMAGE_TRACKING)
911-
if (m_pendingChanges.contains(Change::Damage))
912-
layer.setDamage(WTFMove(m_damage));
915+
if (m_pendingChanges.contains(Change::Damage)) {
916+
ASSERT(m_damage.has_value());
917+
layer.setDamage(WTFMove(*m_damage));
918+
m_damage = std::nullopt;
919+
}
913920
#endif
914921

915922
if (m_pendingChanges.contains(Change::Filters))

Source/WebCore/platform/graphics/texmap/coordinated/CoordinatedPlatformLayer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ class CoordinatedPlatformLayer : public ThreadSafeRefCounted<CoordinatedPlatform
296296
float m_debugBorderWidth WTF_GUARDED_BY_LOCK(m_lock) { 0 };
297297
int m_repaintCount WTF_GUARDED_BY_LOCK(m_lock) { -1 };
298298
#if ENABLE(DAMAGE_TRACKING)
299-
Damage m_damage WTF_GUARDED_BY_LOCK(m_lock);
299+
std::optional<Damage> m_damage WTF_GUARDED_BY_LOCK(m_lock);
300300
#endif
301301
#if ENABLE(SCROLLING_THREAD)
302302
Markable<ScrollingNodeID> m_scrollingNodeID WTF_GUARDED_BY_LOCK(m_lock);

0 commit comments

Comments
 (0)