gpui: Add SVG rendering to img element and generic asset cache (#9931)

This is a follow up to #9436 . It has a cleaner API and generalized the
image_cache to be a generic asset cache, that all GPUI elements can make
use off. The changes have been discussed with @mikayla-maki on Discord.

---------

Co-authored-by: Mikayla <mikayla@zed.dev>
This commit is contained in:
Matthias Grandl 2024-03-30 01:09:49 +01:00 committed by GitHub
parent ed5bfcdddc
commit f9becbd3d1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 392 additions and 237 deletions

View file

@ -34,6 +34,11 @@ impl AssetSource for () {
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ImageId(usize);
#[derive(PartialEq, Eq, Hash, Clone)]
pub(crate) struct RenderImageParams {
pub(crate) image_id: ImageId,
}
/// A cached and processed image.
pub struct ImageData {
/// The ID associated with this image