diff options
author | 2022-11-05 03:13:04 +0100 | |
---|---|---|
committer | 2022-11-05 03:19:38 +0100 | |
commit | 8ce8d374b1e8d1d394a42a5ee2bca8af790f0b71 (patch) | |
tree | 40cf3587e2a08f845c9a8d89108b1b3d8cd86213 /glow/src/image | |
parent | 5575e6ea0897e406674e7e4239808fbf9daa07c3 (diff) | |
download | iced-8ce8d374b1e8d1d394a42a5ee2bca8af790f0b71.tar.gz iced-8ce8d374b1e8d1d394a42a5ee2bca8af790f0b71.tar.bz2 iced-8ce8d374b1e8d1d394a42a5ee2bca8af790f0b71.zip |
Refactor some `image` traits a bit
- Use `Size<u32>` were applicable.
- Rename `TextureStore` to `image::Storage`.
- Rename `TextureStoreEntry` to `image::storage::Entry`.
- Wire up `viewport_dimensions` to `iced_glow` for `Svg`.
Diffstat (limited to 'glow/src/image')
-rw-r--r-- | glow/src/image/storage.rs (renamed from glow/src/image/textures.rs) | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/glow/src/image/textures.rs b/glow/src/image/storage.rs index f43cae1c..e2171fb5 100644 --- a/glow/src/image/textures.rs +++ b/glow/src/image/storage.rs @@ -1,16 +1,12 @@ -use glow::HasContext; -use iced_graphics::image::{TextureStore, TextureStoreEntry}; +use iced_graphics::image; +use iced_graphics::Size; -#[derive(Debug)] -pub struct Textures; +use glow::HasContext; -impl Textures { - pub fn new() -> Self { - Self - } -} +#[derive(Debug, Default)] +pub struct Storage; -impl TextureStore for Textures { +impl image::Storage for Storage { type Entry = Entry; type State<'a> = &'a glow::Context; @@ -58,7 +54,7 @@ impl TextureStore for Textures { gl.bind_texture(glow::TEXTURE_2D, None); Some(Entry { - size: (width, height), + size: Size::new(width, height), texture, }) } @@ -71,12 +67,12 @@ impl TextureStore for Textures { #[derive(Debug)] pub struct Entry { - size: (u32, u32), - pub texture: glow::NativeTexture, + size: Size<u32>, + pub(super) texture: glow::NativeTexture, } -impl TextureStoreEntry for Entry { - fn size(&self) -> (u32, u32) { +impl image::storage::Entry for Entry { + fn size(&self) -> Size<u32> { self.size } } |