This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Implement frame timing callbacks in Skwasm. #50737
Merged
auto-submit
merged 8 commits into
flutter:main
from
eyebrowsoffire:skwasm_frame_timings
Feb 22, 2024
Merged
Changes from 1 commit
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
98ae006
Implement frame timing callbacks in Skwasm.
eyebrowsoffire 1303811
Fix issue from merge conflict.
eyebrowsoffire 2f4beeb
Merge branch 'main' into skwasm_frame_timings
eyebrowsoffire 890cff3
Don't fail if more than one scene is rendered in a frame.
eyebrowsoffire 7ac88cc
Merge branch 'main' into skwasm_frame_timings
eyebrowsoffire b9e1b1f
Address comments.
eyebrowsoffire 769775e
Don't use late variables to be more lenient in test scenarios.
eyebrowsoffire 698c43d
Update license golden.
eyebrowsoffire File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Address comments.
- Loading branch information
commit b9e1b1f9e1d16eb261bdc15c40f4d8065f15bc92
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -64,7 +64,7 @@ class SkwasmImage extends SkwasmObjectWrapper<RawImage> implements ui.Image { | |
| final DomImageBitmap bitmap = | ||
| (await (renderer as SkwasmRenderer).surface.renderPictures( | ||
| <SkwasmPicture>[recorder.endRecording() as SkwasmPicture], | ||
| )).imageBitmaps.first; | ||
| )).imageBitmaps.single; | ||
| final DomOffscreenCanvas offscreenCanvas = | ||
| createDomOffscreenCanvas(bitmap.width.toDartInt, bitmap.height.toDartInt); | ||
| final DomCanvasRenderingContextBitmapRenderer context = | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (github won't allow me to leave a comment on the line below, so putting it here) The lines below that are zeroing out the contents of the canvas to reclaim resources should be identical to PS: It's also weird that we need a canvas to turn an |
||
|
|
@@ -75,8 +75,7 @@ class SkwasmImage extends SkwasmObjectWrapper<RawImage> implements ui.Image { | |
|
|
||
| // Zero out the contents of the canvas so that resources can be reclaimed | ||
| // by the browser. | ||
| offscreenCanvas.width = 0; | ||
| offscreenCanvas.height = 0; | ||
| context.transferFromImageBitmap(null); | ||
| return ByteData.view(arrayBuffer.toDart); | ||
| } else { | ||
| return (renderer as SkwasmRenderer).surface.rasterizeImage(this, format); | ||
|
|
||
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
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
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I strongly recommend that we keep these files as similar as possible to their
lib/ui/counterparts to keep maintenance of thedart:uiAPI surface easy across platforms.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. We deviated before, which was difficult to maintain.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of makes me sad but okay.