RESOLVED DUPLICATE of bug 8087180593
Unnecessary discard of image buffer with idempotent canvas size change
https://bugs.webkit.org/show_bug.cgi?id=80593
Summary Unnecessary discard of image buffer with idempotent canvas size change
Tom Hudson
Reported 2012-03-08 07:01:55 PST
canvas.width = canvas.width has become an accepted shorthand for clearing the canvas. WebCore::HTMLCanvasElement::parseAttribute() calls reset() every time the width or height is set from JavaScript. That calls setSurfaceSize(), which forcibly throws away the WebCore::ImageBuffer, even when the width or height isn't actually changing. Most of the calls in reset() check to make sure that size() != oldSize; if we could extend that to being *all* the calls, we ought to be able to avoid destroying and recreating the ImageBuffer, which has a measurable performance impact on Chromium and may be thrashing textures in the driver for hardware-accelerated canvas rendering.
Attachments
Brent Fulgham
Comment 1 2022-07-18 14:15:25 PDT
It looks like this suggestion was done in Bug 80871. *** This bug has been marked as a duplicate of bug 80871 ***
Note You need to log in before you can comment on or make changes to this bug.