fix: putImageData bypassed deferred rendering PageRecorder#1206
Merged
Brooooooklyn merged 3 commits intomainfrom Feb 12, 2026
Merged
fix: putImageData bypassed deferred rendering PageRecorder#1206Brooooooklyn merged 3 commits intomainfrom
Brooooooklyn merged 3 commits intomainfrom
Conversation
326d59a to
e798305
Compare
putImageData wrote directly to the main surface canvas, but getImageData reads from the PageRecorder's RecordingSurface in deferred mode. This caused putImageData to have no visible effect since v0.1.89. The fix routes putImageData through PageRecorder.put_pixels(), which creates a fresh recording layer with no clip/transform (per HTML spec, putImageData ignores both). Uses write_pixels_dirty (drawImageRect) instead of write_pixels (SkCanvas::writePixels) because the latter is not recordable by SkPictureRecorder. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
e798305 to
bdf086b
Compare
Address review feedback: - Add skiac_canvas_put_image_data C++ function using drawImageRect with kSrc blend mode for correct pixel replacement per HTML spec. The previous write_pixels_dirty used SrcOver which composited with existing content instead of replacing it for semi-transparent pixels. - Extract duplicated state restoration logic (begin_recording + restore save_count/clip/transform) into resume_recording() helper, used by both promote_layer() and put_pixels(). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
92479ad to
c373b94
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
write_pixels_dirty (Rust method, FFI binding, and C++ implementation skiac_canvas_write_pixels_dirty) had zero callers after the previous commit replaced all call sites with put_image_data. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

putImageData wrote directly to the main surface canvas, but getImageData
reads from the PageRecorder's RecordingSurface in deferred mode. This
caused putImageData to have no visible effect since v0.1.89.
The fix routes putImageData through PageRecorder.put_pixels(), which
creates a fresh recording layer with no clip/transform (per HTML spec,
putImageData ignores both). Uses write_pixels_dirty (drawImageRect)
instead of write_pixels (SkCanvas::writePixels) because the latter is
not recordable by SkPictureRecorder.
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
Note
Medium Risk
Touches core pixel-writing/render recording paths (Rust + C++ FFI) and changes how
putImageDatais applied and layered, which could affect compositing behavior across backends. Scope is contained and covered by new regression tests, but still impacts rendering correctness.Overview
Fixes
putImageDatain deferred rendering by routing writes throughPageRecorder.put_pixels()so pixel updates become visible togetImageData.Replaces the previous dirty-rect pixel write path with a new
skiac_canvas_put_image_dataimplementation that draws viadrawImageRectusingkSrcblend mode (pixel replacement) so operations are recordable bySkPictureRecorderand ignore clip/transform as required.Adds regression tests for #1204 covering basic
putImageDataand dirty-rect behavior.Written by Cursor Bugbot for commit f21d664. This will update automatically on new commits. Configure here.