summaryrefslogtreecommitdiffstats
path: root/glow
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-05 03:26:19 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2022-11-05 03:26:19 +0100
commit0a23f518c70d27f2e44af38e5d3be2a0ab1a9bc1 (patch)
tree6fc01728b4141cb70abec59a7340101a9990009c /glow
parentd3b613df446aaf47b62c7c24422026f8872e9448 (diff)
downloadiced-0a23f518c70d27f2e44af38e5d3be2a0ab1a9bc1.tar.gz
iced-0a23f518c70d27f2e44af38e5d3be2a0ab1a9bc1.tar.bz2
iced-0a23f518c70d27f2e44af38e5d3be2a0ab1a9bc1.zip
Remove redundant features in `iced_wgpu` and `iced_glow`
Diffstat (limited to 'glow')
-rw-r--r--glow/Cargo.toml3
-rw-r--r--glow/src/backend.rs14
-rw-r--r--glow/src/image.rs16
-rw-r--r--glow/src/lib.rs2
4 files changed, 17 insertions, 18 deletions
diff --git a/glow/Cargo.toml b/glow/Cargo.toml
index 31a548c8..a50fd375 100644
--- a/glow/Cargo.toml
+++ b/glow/Cargo.toml
@@ -9,8 +9,7 @@ repository = "https://github.com/iced-rs/iced"
[features]
svg = ["iced_graphics/svg"]
-image = ["image_rs", "iced_graphics/image", "png", "jpeg", "jpeg_rayon", "gif", "webp", "bmp"]
-image_rs = ["iced_graphics/image_rs"]
+image = ["iced_graphics/image"]
png = ["iced_graphics/png"]
jpeg = ["iced_graphics/jpeg"]
jpeg_rayon = ["iced_graphics/jpeg_rayon"]
diff --git a/glow/src/backend.rs b/glow/src/backend.rs
index 35a82c0f..1a41d540 100644
--- a/glow/src/backend.rs
+++ b/glow/src/backend.rs
@@ -1,4 +1,4 @@
-#[cfg(any(feature = "image_rs", feature = "svg"))]
+#[cfg(any(feature = "image", feature = "svg"))]
use crate::image;
use crate::quad;
use crate::text;
@@ -17,7 +17,7 @@ use iced_native::{Font, Size};
/// [`iced`]: https://github.com/iced-rs/iced
#[derive(Debug)]
pub struct Backend {
- #[cfg(any(feature = "image_rs", feature = "svg"))]
+ #[cfg(any(feature = "image", feature = "svg"))]
image_pipeline: image::Pipeline,
quad_pipeline: quad::Pipeline,
text_pipeline: text::Pipeline,
@@ -36,13 +36,13 @@ impl Backend {
let shader_version = program::Version::new(gl);
- #[cfg(any(feature = "image_rs", feature = "svg"))]
+ #[cfg(any(feature = "image", feature = "svg"))]
let image_pipeline = image::Pipeline::new(gl, &shader_version);
let quad_pipeline = quad::Pipeline::new(gl, &shader_version);
let triangle_pipeline = triangle::Pipeline::new(gl, &shader_version);
Self {
- #[cfg(any(feature = "image_rs", feature = "svg"))]
+ #[cfg(any(feature = "image", feature = "svg"))]
image_pipeline,
quad_pipeline,
text_pipeline,
@@ -79,7 +79,7 @@ impl Backend {
);
}
- #[cfg(any(feature = "image_rs", feature = "svg"))]
+ #[cfg(any(feature = "image", feature = "svg"))]
self.image_pipeline.trim_cache(gl);
}
@@ -123,7 +123,7 @@ impl Backend {
);
}
- #[cfg(any(feature = "image_rs", feature = "svg"))]
+ #[cfg(any(feature = "image", feature = "svg"))]
if !layer.images.is_empty() {
let scaled = transformation
* Transformation::scale(scale_factor, scale_factor);
@@ -256,7 +256,7 @@ impl backend::Text for Backend {
}
}
-#[cfg(feature = "image_rs")]
+#[cfg(feature = "image")]
impl backend::Image for Backend {
fn dimensions(&self, handle: &iced_native::image::Handle) -> Size<u32> {
self.image_pipeline.dimensions(handle)
diff --git a/glow/src/image.rs b/glow/src/image.rs
index 66620537..f906cd4c 100644
--- a/glow/src/image.rs
+++ b/glow/src/image.rs
@@ -7,7 +7,7 @@ pub use iced_graphics::triangle::{Mesh2D, Vertex2D};
use crate::program::{self, Shader};
use crate::Transformation;
-#[cfg(feature = "image_rs")]
+#[cfg(feature = "image")]
use iced_graphics::image::raster;
#[cfg(feature = "svg")]
@@ -27,7 +27,7 @@ pub(crate) struct Pipeline {
vertex_buffer: <glow::Context as HasContext>::Buffer,
transform_location: <glow::Context as HasContext>::UniformLocation,
storage: Storage,
- #[cfg(feature = "image_rs")]
+ #[cfg(feature = "image")]
raster_cache: RefCell<raster::Cache<Storage>>,
#[cfg(feature = "svg")]
vector_cache: RefCell<vector::Cache<Storage>>,
@@ -115,14 +115,14 @@ impl Pipeline {
vertex_buffer,
transform_location,
storage: Storage::default(),
- #[cfg(feature = "image_rs")]
+ #[cfg(feature = "image")]
raster_cache: RefCell::new(raster::Cache::default()),
#[cfg(feature = "svg")]
vector_cache: RefCell::new(vector::Cache::default()),
}
}
- #[cfg(feature = "image_rs")]
+ #[cfg(feature = "image")]
pub fn dimensions(&self, handle: &iced_native::image::Handle) -> Size<u32> {
self.raster_cache.borrow_mut().load(handle).dimensions()
}
@@ -151,7 +151,7 @@ impl Pipeline {
gl.bind_buffer(glow::ARRAY_BUFFER, Some(self.vertex_buffer));
}
- #[cfg(feature = "image_rs")]
+ #[cfg(feature = "image")]
let mut raster_cache = self.raster_cache.borrow_mut();
#[cfg(feature = "svg")]
@@ -159,12 +159,12 @@ impl Pipeline {
for image in images {
let (entry, bounds) = match &image {
- #[cfg(feature = "image_rs")]
+ #[cfg(feature = "image")]
layer::Image::Raster { handle, bounds } => (
raster_cache.upload(handle, &mut gl, &mut self.storage),
bounds,
),
- #[cfg(not(feature = "image_rs"))]
+ #[cfg(not(feature = "image"))]
layer::Image::Raster { handle: _, bounds } => (None, bounds),
#[cfg(feature = "svg")]
@@ -217,7 +217,7 @@ impl Pipeline {
}
pub fn trim_cache(&mut self, mut gl: &glow::Context) {
- #[cfg(feature = "image_rs")]
+ #[cfg(feature = "image")]
self.raster_cache
.borrow_mut()
.trim(&mut self.storage, &mut gl);
diff --git a/glow/src/lib.rs b/glow/src/lib.rs
index daeb3e32..e3690a69 100644
--- a/glow/src/lib.rs
+++ b/glow/src/lib.rs
@@ -24,7 +24,7 @@
pub use glow;
mod backend;
-#[cfg(any(feature = "image_rs", feature = "svg"))]
+#[cfg(any(feature = "image", feature = "svg"))]
mod image;
mod program;
mod quad;