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
Image decoding in corelib #1408
Merged
Merged
Conversation
This file contains 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
ogoffart
force-pushed
the
simon/image-in-corelib
branch
from
July 19, 2022 13:16
d1062aa
to
99e6fb0
Compare
ogoffart
reviewed
Jul 19, 2022
ogoffart
approved these changes
Jul 20, 2022
@@ -13,11 +13,11 @@ use vtable::VRef; | |||
|
|||
#[repr(C)] | |||
#[cfg(target_pointer_width = "64")] | |||
pub struct ValueOpaque([usize; 7]); | |||
pub struct ValueOpaque([usize; 8]); |
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.
:-(
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.
One could argue that this is just filling padding to 64 bytes ;-)
This includes the cache of decoded images, the HTMLImage element support and the SVG rendering adapter. The objective is that Image holds an ImageInner, which is not a path anymore that the backend has to process, but instead always either decoded image data, a pointer to a static texture or an SVG tree that can be rendered to the desired size.
Make the image cache return Image, instead of ImageInner
For embedded images the path is empty but we unconditionally used it to create a TextureCacheKey, which clashes. Instead, preserve and store the ImageCacheKey in the ImageInner variants.
That way it'll be eaiser to deal with the code with image-decoders disabled
Since image rendering is now done in core
This defaults to 5 MB right now and SVGs aren't counted properly.
Since there is only one call site now, we can also return the correct type without inconveniencing any other code.
tronical
force-pushed
the
simon/image-in-corelib
branch
from
July 20, 2022 10:30
c90243b
to
6a8e117
Compare
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.
This is a merge request to bring the image decoding into the core library and leave the backends with just the rendering part. This means using image-rs in the corelib, as well as usvg for svg rendering.
There are a few things left to do:
- [ ] Test that it still works on the MCU