Move image/svg handling into iced_graphics

The `TextureStore` trait is implemented by the atlas, and can also be
implemented in the glow renderer or in a software renderer.

The API here may be improved in the future, but API stability is
presumably not a huge issue since these types will only be used by
renderer backends.
This commit is contained in:
Ian Douglas Scott 2022-10-31 13:37:56 -07:00 committed by Héctor Ramón Jiménez
parent 7b12991728
commit 2c7c42ee93
No known key found for this signature in database
GPG key ID: 140CC052C94F138E
10 changed files with 281 additions and 191 deletions

View file

@ -1,4 +1,5 @@
use crate::image::atlas;
use iced_graphics::image::TextureStoreEntry;
#[derive(Debug)]
pub enum Entry {
@ -9,9 +10,8 @@ pub enum Entry {
},
}
impl Entry {
#[cfg(feature = "image_rs")]
pub fn size(&self) -> (u32, u32) {
impl TextureStoreEntry for Entry {
fn size(&self) -> (u32, u32) {
match self {
Entry::Contiguous(allocation) => allocation.size(),
Entry::Fragmented { size, .. } => *size,