Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: be7c8392af688ba6d450a87ceeafbd63a7d70c20
https://github.com/WebKit/WebKit/commit/be7c8392af688ba6d450a87ceeafbd63a7d70c20
Author: Nikolas Zimmermann <[email protected]>
Date: 2026-07-17 (Fri, 17 Jul 2026)
Changed paths:
M Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp
M Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.h
M Source/WebCore/platform/graphics/skia/SkiaDamageRegion.h
M Tools/TestWebKitAPI/Tests/WebCore/glib/SkiaCompositingLayerDamage.cpp
Log Message:
-----------
[Damage][Skia] Limit every content draw to the target's repaint region
https://bugs.webkit.org/show_bug.cgi?id=319615
Reviewed by Alejandro G. Castro.
Take a damage region in paint() and limit the draws to it. No region paints
everything, as before. An empty region paints nothing, because the target
already
holds the frame. Otherwise every content draw limits itself to the region's
rects:
the backing store's tiles and the contents image split by rect and stay batched,
the solid color, the hole punch and the tiled shader draw once per rect, and the
composite of a filtered or masked layer's intermediate surface is limited the
same
way.
The walk deliberately does not clip the canvas to the damage, because a clip of
more
than one rect cannot be a scissor, so Skia would build a mask for it and break
the
batching. Each draw limits itself instead, which is a convention every content
type
added here has to follow. The subtree of a filtered layer keeps painting in
full,
because the filter samples outside the damage, and only the composite of its
result
is limited.
A region that covers the whole surface is dropped for a full repaint. The region
itself decides that, not its bounding box: two rects in opposite corners span a
box
that covers the surface while the rects cover almost none of it.
The compositor still passes no region, so nothing is restricted yet.
Added a new API test to cover damaging + HiDPI.
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.cpp:
(WebCore::SkiaCompositingLayer::paint):
(WebCore::SkiaCompositingLayer::paintContents):
(WebCore::SkiaCompositingLayer::paintWithIntermediateSurface):
* Source/WebCore/platform/graphics/skia/SkiaCompositingLayer.h:
* Source/WebCore/platform/graphics/skia/SkiaDamageRegion.h:
(WebCore::SkiaDamageRegion::create):
(WebCore::SkiaDamageRegion::SkiaDamageRegion):
(WebCore::SkiaDamageRegion::operator=):
(WebCore::SkiaDamageRegion::forEachDamagedSubRect const):
(WebCore::SkiaDamageRegion::restrictDraw const):
(WebCore::drawRectRestricted):
(WebCore::drawImageRectRestricted):
* Tools/TestWebKitAPI/Tests/WebCore/glib/SkiaCompositingLayerDamage.cpp:
(TestWebKitAPI::TEST(SkiaCompositingLayerDamage,
PartialRepaintRegionUnderHiDPIRestrictsToTheDamageRect)):
Canonical link: https://commits.webkit.org/317387@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications