Bug 80593 - Unnecessary discard of image buffer with idempotent canvas size change
Summary: Unnecessary discard of image buffer with idempotent canvas size change
Status: RESOLVED DUPLICATE of bug 80871
Alias: None
Product: WebKit
Classification: Unclassified
Component: Canvas (show other bugs)
Version: 528+ (Nightly build)
Hardware: All Unspecified
: P2 Normal
Assignee: Tom Hudson
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-03-08 07:01 PST by Tom Hudson
Modified: 2022-07-18 14:15 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Hudson 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.
Comment 1 Brent Fulgham 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 ***