summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-21 00:56:49 +0100
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2020-01-21 00:56:49 +0100
commit8957883a88ce98de3d37cdb1e658db5c6777ff1f (patch)
treef87a8f9113ff02402763ddfbd11415937b87e8d3
parent92af1b1c123983b94e38519943b6ad4fab3db9d7 (diff)
parent1ef7d09ce86cb54de35678ba22517df830660247 (diff)
downloadiced-8957883a88ce98de3d37cdb1e658db5c6777ff1f.tar.gz
iced-8957883a88ce98de3d37cdb1e658db5c6777ff1f.tar.bz2
iced-8957883a88ce98de3d37cdb1e658db5c6777ff1f.zip
Merge branch 'feature/custom-runtime'
Diffstat (limited to '')
-rw-r--r--Cargo.toml6
-rw-r--r--core/src/lib.rs4
-rw-r--r--examples/pokedex/Cargo.toml2
-rw-r--r--examples/tour/Cargo.toml2
-rw-r--r--futures/src/lib.rs4
-rw-r--r--native/src/lib.rs4
-rw-r--r--src/lib.rs4
-rw-r--r--web/src/lib.rs4
-rw-r--r--wgpu/Cargo.toml2
-rw-r--r--wgpu/src/image.rs24
-rw-r--r--wgpu/src/lib.rs4
-rw-r--r--wgpu/src/renderer/widget.rs4
-rw-r--r--winit/src/lib.rs4
13 files changed, 43 insertions, 25 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 28a97af9..7bfce09a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -12,10 +12,12 @@ keywords = ["gui", "ui", "graphics", "interface", "widgets"]
categories = ["gui"]
[features]
+# Enables the Image widget
+image = ["iced_wgpu/image"]
+# Enables the Svg widget
+svg = ["iced_wgpu/svg"]
# Enables a debug view in native platforms (press F12)
debug = ["iced_winit/debug"]
-# Enables support for SVG rendering
-svg = ["iced_wgpu/svg"]
[badges]
maintenance = { status = "actively-developed" }
diff --git a/core/src/lib.rs b/core/src/lib.rs
index 51863327..3cbce743 100644
--- a/core/src/lib.rs
+++ b/core/src/lib.rs
@@ -12,8 +12,8 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
-#![deny(unsafe_code)]
-#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
+#![forbid(rust_2018_idioms)]
mod align;
mod background;
diff --git a/examples/pokedex/Cargo.toml b/examples/pokedex/Cargo.toml
index 2972590f..76a3a82f 100644
--- a/examples/pokedex/Cargo.toml
+++ b/examples/pokedex/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2018"
publish = false
[dependencies]
-iced = { path = "../.." }
+iced = { path = "../..", features = ["image"] }
iced_futures = { path = "../../futures", features = ["async-std"] }
surf = "1.0"
rand = "0.7"
diff --git a/examples/tour/Cargo.toml b/examples/tour/Cargo.toml
index 7772df1b..45105c31 100644
--- a/examples/tour/Cargo.toml
+++ b/examples/tour/Cargo.toml
@@ -6,7 +6,7 @@ edition = "2018"
publish = false
[dependencies]
-iced = { path = "../..", features = ["debug"] }
+iced = { path = "../..", features = ["image", "debug"] }
env_logger = "0.7"
[target.'cfg(target_arch = "wasm32")'.dependencies]
diff --git a/futures/src/lib.rs b/futures/src/lib.rs
index 4872df10..c25c0853 100644
--- a/futures/src/lib.rs
+++ b/futures/src/lib.rs
@@ -2,8 +2,8 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
-#![deny(unsafe_code)]
-#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
+#![forbid(rust_2018_idioms)]
pub use futures;
mod command;
diff --git a/native/src/lib.rs b/native/src/lib.rs
index b5856c00..3b81ef71 100644
--- a/native/src/lib.rs
+++ b/native/src/lib.rs
@@ -37,8 +37,8 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
-#![deny(unsafe_code)]
-#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
+#![forbid(rust_2018_idioms)]
pub mod input;
pub mod layout;
pub mod renderer;
diff --git a/src/lib.rs b/src/lib.rs
index 1da3f549..0e2e0337 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -177,8 +177,8 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
-#![deny(unsafe_code)]
-#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
+#![forbid(rust_2018_idioms)]
mod application;
mod element;
mod sandbox;
diff --git a/web/src/lib.rs b/web/src/lib.rs
index b1bb80e3..1b265bc9 100644
--- a/web/src/lib.rs
+++ b/web/src/lib.rs
@@ -54,8 +54,8 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
-#![deny(unsafe_code)]
-#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
+#![forbid(rust_2018_idioms)]
use dodrio::bumpalo;
use std::{cell::RefCell, rc::Rc};
diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml
index 19d41bba..60b98b40 100644
--- a/wgpu/Cargo.toml
+++ b/wgpu/Cargo.toml
@@ -17,8 +17,8 @@ wgpu = "0.4"
glyph_brush = "0.6"
wgpu_glyph = { version = "0.7", git = "https://github.com/hecrj/wgpu_glyph", branch = "fix/font-load-panic" }
raw-window-handle = "0.3"
-image = "0.22"
glam = "0.8"
font-kit = "0.4"
log = "0.4"
resvg = { version = "0.8", features = ["raqote-backend"], optional = true }
+image = { version = "0.22", optional = true }
diff --git a/wgpu/src/image.rs b/wgpu/src/image.rs
index 4558ffb0..ccc956a9 100644
--- a/wgpu/src/image.rs
+++ b/wgpu/src/image.rs
@@ -1,3 +1,4 @@
+#[cfg(feature = "image")]
mod raster;
#[cfg(feature = "svg")]
mod vector;
@@ -5,10 +6,14 @@ mod vector;
use crate::Transformation;
use iced_native::{image, svg, Rectangle};
-use std::{cell::RefCell, mem};
+use std::mem;
+
+#[cfg(any(feature = "image", feature = "svg"))]
+use std::cell::RefCell;
#[derive(Debug)]
pub struct Pipeline {
+ #[cfg(feature = "image")]
raster_cache: RefCell<raster::Cache>,
#[cfg(feature = "svg")]
vector_cache: RefCell<vector::Cache>,
@@ -191,6 +196,7 @@ impl Pipeline {
});
Pipeline {
+ #[cfg(feature = "image")]
raster_cache: RefCell::new(raster::Cache::new()),
#[cfg(feature = "svg")]
vector_cache: RefCell::new(vector::Cache::new()),
@@ -205,6 +211,7 @@ impl Pipeline {
}
}
+ #[cfg(feature = "image")]
pub fn dimensions(&self, handle: &image::Handle) -> (u32, u32) {
let mut cache = self.raster_cache.borrow_mut();
let memory = cache.load(&handle);
@@ -250,11 +257,17 @@ impl Pipeline {
// [1]: https://github.com/nical/guillotiere
for image in instances {
let uploaded_texture = match &image.handle {
- Handle::Raster(handle) => {
- let mut cache = self.raster_cache.borrow_mut();
- let memory = cache.load(&handle);
+ Handle::Raster(_handle) => {
+ #[cfg(feature = "image")]
+ {
+ let mut cache = self.raster_cache.borrow_mut();
+ let memory = cache.load(&_handle);
- memory.upload(device, encoder, &self.texture_layout)
+ memory.upload(device, encoder, &self.texture_layout)
+ }
+
+ #[cfg(not(feature = "image"))]
+ None
}
Handle::Vector(_handle) => {
#[cfg(feature = "svg")]
@@ -339,6 +352,7 @@ impl Pipeline {
}
pub fn trim_cache(&mut self) {
+ #[cfg(feature = "image")]
self.raster_cache.borrow_mut().trim();
#[cfg(feature = "svg")]
diff --git a/wgpu/src/lib.rs b/wgpu/src/lib.rs
index ab14987c..b8cd3fce 100644
--- a/wgpu/src/lib.rs
+++ b/wgpu/src/lib.rs
@@ -22,8 +22,8 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
-#![deny(unsafe_code)]
-#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
+#![forbid(rust_2018_idioms)]
pub mod defaults;
pub mod triangle;
pub mod widget;
diff --git a/wgpu/src/renderer/widget.rs b/wgpu/src/renderer/widget.rs
index 2c75413f..84f908e7 100644
--- a/wgpu/src/renderer/widget.rs
+++ b/wgpu/src/renderer/widget.rs
@@ -2,7 +2,6 @@ mod button;
mod checkbox;
mod column;
mod container;
-mod image;
mod progress_bar;
mod radio;
mod row;
@@ -14,3 +13,6 @@ mod text_input;
#[cfg(feature = "svg")]
mod svg;
+
+#[cfg(feature = "image")]
+mod image;
diff --git a/winit/src/lib.rs b/winit/src/lib.rs
index 056ae8f0..13824f32 100644
--- a/winit/src/lib.rs
+++ b/winit/src/lib.rs
@@ -18,8 +18,8 @@
#![deny(missing_docs)]
#![deny(missing_debug_implementations)]
#![deny(unused_results)]
-#![deny(unsafe_code)]
-#![deny(rust_2018_idioms)]
+#![forbid(unsafe_code)]
+#![forbid(rust_2018_idioms)]
#[doc(no_inline)]
pub use iced_native::*;