[webkit-changes] [WebKit/WebKit] 5d3de5: Optimize effectiveDrawingContext()
Simon Fraser
noreply at github.com
Fri Jul 12 21:12:27 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5d3de50d060a1d50ca797c91a6b7d198a0d994e2
https://github.com/WebKit/WebKit/commit/5d3de50d060a1d50ca797c91a6b7d198a0d994e2
Author: Simon Fraser <simon.fraser at apple.com>
Date: 2024-07-12 (Fri, 12 Jul 2024)
Changed paths:
M Source/WebCore/html/CanvasBase.h
M Source/WebCore/html/HTMLCanvasElement.cpp
M Source/WebCore/html/HTMLCanvasElement.h
M Source/WebCore/html/OffscreenCanvas.cpp
M Source/WebCore/html/OffscreenCanvas.h
M Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp
Log Message:
-----------
Optimize effectiveDrawingContext()
https://bugs.webkit.org/show_bug.cgi?id=276556
rdar://131636489
Reviewed by Cameron McCormack.
`effectiveDrawingContext()` is called three times per canvas draw; once before drawing, and possibly twice
in `didDraw()`. Both `drawingContext()` and `hasCreatedImageBuffer()` were virtual calls.
Improve this by moving `m_hasCreatedImageBuffer` into CanvasBase so call to read it doesn't need to be
virtual. OffscreenCanvas and HTMLCanvasElement set this.
Also reduce the number of calls in `CanvasRenderingContext2DBase::didDraw()` from two to one.
* Source/WebCore/html/CanvasBase.h:
(WebCore::CanvasBase::setHasCreatedImageBuffer):
(WebCore::CanvasBase::hasCreatedImageBuffer const):
* Source/WebCore/html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::reset):
(WebCore::HTMLCanvasElement::setSurfaceSize):
(WebCore::HTMLCanvasElement::createImageBuffer const):
(WebCore::HTMLCanvasElement::setImageBufferAndMarkDirty):
(WebCore::HTMLCanvasElement::clearImageBuffer const):
* Source/WebCore/html/HTMLCanvasElement.h:
* Source/WebCore/html/OffscreenCanvas.cpp:
(WebCore::OffscreenCanvas::createImageBuffer const):
(WebCore::OffscreenCanvas::setImageBufferAndMarkDirty):
(WebCore::OffscreenCanvas::reset):
* Source/WebCore/html/OffscreenCanvas.h:
* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::didDraw):
Canonical link: https://commits.webkit.org/280935@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list