Implement Image.willReadFrequently.
#1994
Draft
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.
This improves performance when doing pixel operations, at the expense of rendering speed. But you don't have to render it; you could designate one bitmap as a source, never adding it to the display list. Instead, you'd copy its pixels to other bitmaps that would be rendered.
Currently only implemented for HTML5, but the same logic should apply on other platforms, so I'm keeping this as a draft for now. Unless those other platforms already store a copy of the data for easy reading?
Another reason this is a draft is it's not a pretty implementation. It would be nicer to either take this as a constructor argument, or allow changing it later, but both of those have problems. If it's a constructor argument, then we also have to modify
openfl.display.BitmapData. If you can modify it, then we need to delete the existing canvas and make a new one, and maybe also synchronize some other state (not sure).Closes #1690