summaryrefslogtreecommitdiffstats
path: root/glow/src/image
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón <hector0193@gmail.com>2023-05-11 16:45:08 +0200
committerLibravatar GitHub <noreply@github.com>2023-05-11 16:45:08 +0200
commit669f7cc74b2e7918e86a8197916f503f2d3d9b93 (patch)
treeacb365358235be6ce115b50db9404d890b6e77a6 /glow/src/image
parentbc62013b6cde52174bf4c4286939cf170bfa7760 (diff)
parent63d3fc6996b848e10e77e6924bfebdf6ba82852e (diff)
downloadiced-669f7cc74b2e7918e86a8197916f503f2d3d9b93.tar.gz
iced-669f7cc74b2e7918e86a8197916f503f2d3d9b93.tar.bz2
iced-669f7cc74b2e7918e86a8197916f503f2d3d9b93.zip
Merge pull request #1830 from iced-rs/advanced-text
Advanced text
Diffstat (limited to 'glow/src/image')
-rw-r--r--glow/src/image/storage.rs78
1 files changed, 0 insertions, 78 deletions
diff --git a/glow/src/image/storage.rs b/glow/src/image/storage.rs
deleted file mode 100644
index 9bc20641..00000000
--- a/glow/src/image/storage.rs
+++ /dev/null
@@ -1,78 +0,0 @@
-use iced_graphics::image;
-use iced_graphics::Size;
-
-use glow::HasContext;
-
-#[derive(Debug, Default)]
-pub struct Storage;
-
-impl image::Storage for Storage {
- type Entry = Entry;
- type State<'a> = &'a glow::Context;
-
- fn upload(
- &mut self,
- width: u32,
- height: u32,
- data: &[u8],
- gl: &mut &glow::Context,
- ) -> Option<Self::Entry> {
- unsafe {
- let texture = gl.create_texture().expect("create texture");
- gl.bind_texture(glow::TEXTURE_2D, Some(texture));
- gl.tex_image_2d(
- glow::TEXTURE_2D,
- 0,
- glow::SRGB8_ALPHA8 as i32,
- width as i32,
- height as i32,
- 0,
- glow::RGBA,
- glow::UNSIGNED_BYTE,
- Some(data),
- );
- gl.tex_parameter_i32(
- glow::TEXTURE_2D,
- glow::TEXTURE_WRAP_S,
- glow::CLAMP_TO_EDGE as _,
- );
- gl.tex_parameter_i32(
- glow::TEXTURE_2D,
- glow::TEXTURE_WRAP_T,
- glow::CLAMP_TO_EDGE as _,
- );
- gl.tex_parameter_i32(
- glow::TEXTURE_2D,
- glow::TEXTURE_MIN_FILTER,
- glow::LINEAR as _,
- );
- gl.tex_parameter_i32(
- glow::TEXTURE_2D,
- glow::TEXTURE_MAG_FILTER,
- glow::LINEAR as _,
- );
- gl.bind_texture(glow::TEXTURE_2D, None);
-
- Some(Entry {
- size: Size::new(width, height),
- texture,
- })
- }
- }
-
- fn remove(&mut self, entry: &Entry, gl: &mut &glow::Context) {
- unsafe { gl.delete_texture(entry.texture) }
- }
-}
-
-#[derive(Debug)]
-pub struct Entry {
- size: Size<u32>,
- pub(super) texture: glow::NativeTexture,
-}
-
-impl image::storage::Entry for Entry {
- fn size(&self) -> Size<u32> {
- self.size
- }
-}