summaryrefslogtreecommitdiffstats
path: root/glow/src/image
diff options
context:
space:
mode:
authorLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
committerLibravatar Bingus <shankern@protonmail.com>2023-07-12 12:23:18 -0700
commit633f405f3f78bc7f82d2b2061491b0e011137451 (patch)
tree5ebfc1f45d216a5c14a90492563599e6969eab4d /glow/src/image
parent41836dd80d0534608e7aedfbf2319c540a23de1a (diff)
parent21bd51426d900e271206f314e0c915dd41065521 (diff)
downloadiced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.gz
iced-633f405f3f78bc7f82d2b2061491b0e011137451.tar.bz2
iced-633f405f3f78bc7f82d2b2061491b0e011137451.zip
Merge remote-tracking branch 'origin/master' into feat/multi-window-support
# Conflicts: # Cargo.toml # core/src/window/icon.rs # core/src/window/id.rs # core/src/window/position.rs # core/src/window/settings.rs # examples/integration/src/main.rs # examples/integration_opengl/src/main.rs # glutin/src/application.rs # native/src/subscription.rs # native/src/window.rs # runtime/src/window/action.rs # src/lib.rs # src/window.rs # winit/Cargo.toml # winit/src/application.rs # winit/src/icon.rs # winit/src/settings.rs # winit/src/window.rs
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
- }
-}