Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c39e0c34e9e712b7b075cdc427b1c7a411dadf67
https://github.com/WebKit/WebKit/commit/c39e0c34e9e712b7b075cdc427b1c7a411dadf67
Author: Charlie Wolfe <[email protected]>
Date: 2026-09-08 (Tue, 08 Sep 2026)
Changed paths:
M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
Log Message:
-----------
Avoid computing canvas path bounds when the whole backing store is already
dirty
https://bugs.webkit.org/show_bug.cgi?id=323688
rdar://186946552
Reviewed by Simon Fraser.
fillInternal() and strokeInternal() always computed a dirty rect, only for
willUpdateContents() to
discard it and invalidate with std::nullopt whenever m_dirtyRect already
contained it. Take that
path directly instead. In an animation loop that starts each frame with a
full-canvas clearRect(),
every following fill and stroke was paying for a bounding box nobody read.
This is limited to !USE(COORDINATED_GRAPHICS), where m_dirtyRect is replaced
per draw rather than
united, so the real rect is still needed there.
This also requires fixing isEntireBackingStoreDirty(), which tested m_dirtyRect
against
backingStoreBounds() for equality. Accumulated rects are inflated by 1 to cover
antialiasing, which
is on by default, so the equality never held. Use contains() on the
accumulating ports. No
observable change for the existing caller, willUpdateEntireContents(), which
already ended up at the
same invalidation.
~6-7% MotionMark Canvas Lines improvement.
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::fillInternal):
(WebCore::CanvasRenderingContext2DBase::strokeInternal):
(WebCore::CanvasRenderingContext2DBase::isEntireBackingStoreDirty const):
Canonical link: https://commits.webkit.org/320709@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications