Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

REGRESSION(267824@main): Changing HTMLCanvasElement width, height causes intermediate buffer allocations #23861

Merged

Conversation

kkinnunen-apple
Copy link
Contributor

@kkinnunen-apple kkinnunen-apple commented Feb 5, 2024

26aaa25

REGRESSION(267824@main): Changing HTMLCanvasElement width, height causes intermediate buffer allocations
https://bugs.webkit.org/show_bug.cgi?id=268745
rdar://122309325

Reviewed by Simon Fraser.

Resizing is intended to leave the buffer unallocated, so that
sequential width, height assignments will not allocate multiple times.

This intention was nullified by CanvasRenderingContext2DBase::reset().
Calling resetTransform redundantly would recreate the buffer
immediately from width, height attribute setters.

The transform reset is redundant, the context transform is reset when
the context state saver is restored and re-saved.

Clearing the canvas doesn't need to use public
CanvasRenderingContext2DBase::clearCanvas() that will mutate the context
state. The state is in known state with initial transform, and thus it
doesn't need transform mutation.

* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::reset):

Canonical link: https://commits.webkit.org/274135@main

c4bdacb

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe βœ… πŸ›  wincairo
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-AS-debug βœ… πŸ§ͺ wpe-wk2
βœ… πŸ§ͺ webkitperl βœ… πŸ§ͺ ios-wk2 βœ… πŸ§ͺ api-mac βœ… πŸ§ͺ api-wpe
βœ… πŸ§ͺ webkitpy βœ… πŸ§ͺ ios-wk2-wpt βœ… πŸ§ͺ mac-wk1 βœ… πŸ›  gtk
βœ… πŸ›  πŸ§ͺ jsc βœ… πŸ§ͺ api-ios   πŸ§ͺ mac-wk2 βœ… πŸ§ͺ gtk-wk2
βœ… πŸ›  πŸ§ͺ jsc-arm64 βœ… πŸ›  tv βœ… πŸ§ͺ mac-AS-debug-wk2 βœ… πŸ§ͺ api-gtk
βœ… πŸ§ͺ services βœ… πŸ›  tv-sim βœ… πŸ§ͺ mac-wk2-stress βœ… πŸ›  jsc-armv7
βœ… πŸ›  πŸ§ͺ merge βœ… πŸ›  watch
βœ… πŸ›  watch-sim

@kkinnunen-apple kkinnunen-apple self-assigned this Feb 5, 2024
@kkinnunen-apple kkinnunen-apple added the Canvas Bugs related to the canvas element. label Feb 5, 2024
@kkinnunen-apple kkinnunen-apple requested review from smfr, tuankiet65 and shallawa and removed request for rniwa and cdumez February 5, 2024 17:14
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Feb 5, 2024
@kkinnunen-apple kkinnunen-apple removed the merging-blocked Applied to prevent a change from being merged label Feb 5, 2024
@kkinnunen-apple kkinnunen-apple added the merge-queue Applied to send a pull request to merge-queue label Feb 6, 2024
…ses intermediate buffer allocations

https://bugs.webkit.org/show_bug.cgi?id=268745
rdar://122309325

Reviewed by Simon Fraser.

Resizing is intended to leave the buffer unallocated, so that
sequential width, height assignments will not allocate multiple times.

This intention was nullified by CanvasRenderingContext2DBase::reset().
Calling resetTransform redundantly would recreate the buffer
immediately from width, height attribute setters.

The transform reset is redundant, the context transform is reset when
the context state saver is restored and re-saved.

Clearing the canvas doesn't need to use public
CanvasRenderingContext2DBase::clearCanvas() that will mutate the context
state. The state is in known state with initial transform, and thus it
doesn't need transform mutation.

* Source/WebCore/html/canvas/CanvasRenderingContext2DBase.cpp:
(WebCore::CanvasRenderingContext2DBase::reset):

Canonical link: https://commits.webkit.org/274135@main
@webkit-commit-queue
Copy link
Collaborator

Committed 274135@main (26aaa25): https://commits.webkit.org/274135@main

Reviewed commits have been landed. Closing PR #23861 and removing active labels.

@webkit-commit-queue webkit-commit-queue merged commit 26aaa25 into WebKit:main Feb 6, 2024
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Canvas Bugs related to the canvas element.
Projects
None yet
5 participants