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

Image decoding in corelib #1408

Merged
merged 15 commits into from Jul 20, 2022
Merged

Image decoding in corelib #1408

merged 15 commits into from Jul 20, 2022

Conversation

tronical
Copy link
Member

@tronical tronical commented Jul 19, 2022

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:

  • WASM
  • Test that it works on Windows
    - [ ] Test that it still works on the MCU
  • Test all demos

internal/backends/gl/glwindow.rs Outdated Show resolved Hide resolved
internal/backends/gl/glwindow.rs Outdated Show resolved Hide resolved
internal/core/Cargo.toml Outdated Show resolved Hide resolved
internal/core/graphics/image.rs Show resolved Hide resolved
internal/core/graphics/image/cache.rs Outdated Show resolved Hide resolved
@tronical tronical marked this pull request as ready for review July 20, 2022 08:29
@@ -13,11 +13,11 @@ use vtable::VRef;

#[repr(C)]
#[cfg(target_pointer_width = "64")]
pub struct ValueOpaque([usize; 7]);
pub struct ValueOpaque([usize; 8]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-(

Copy link
Member Author

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 ;-)

tronical and others added 15 commits July 20, 2022 12:25
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 tronical merged commit 650fd2c into master Jul 20, 2022
@tronical tronical deleted the simon/image-in-corelib branch July 20, 2022 10:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants