summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Yusuf Bera Ertan <y.bera003.06@protonmail.com>2021-06-14 18:06:28 +0300
committerLibravatar Yusuf Bera Ertan <y.bera003.06@protonmail.com>2021-06-14 18:06:28 +0300
commit6469e463cd1f99190c6eba4701d4c1059934d3ee (patch)
tree673c7dd0bcd48b93700a00a832ceaa231938fb06
parente68da229b384fbe78514dab0b13c8eb4637f4f5d (diff)
downloadiced-6469e463cd1f99190c6eba4701d4c1059934d3ee.tar.gz
iced-6469e463cd1f99190c6eba4701d4c1059934d3ee.tar.bz2
iced-6469e463cd1f99190c6eba4701d4c1059934d3ee.zip
feat: expose draw_cache_multithread
-rw-r--r--Cargo.toml4
-rw-r--r--glow/Cargo.toml1
-rw-r--r--glow/src/text.rs4
-rw-r--r--wgpu/Cargo.toml1
-rw-r--r--wgpu/src/text.rs4
5 files changed, 12 insertions, 2 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6d894eba..acae878f 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -25,6 +25,8 @@ canvas = ["iced_wgpu/canvas"]
qr_code = ["iced_wgpu/qr_code"]
# Enables using system fonts
default_system_font = ["iced_wgpu/default_system_font"]
+# Enables draw_cache_multithread for glyph drawing
+glyph_draw_cache_multithread = ["iced_wgpu/glyph_draw_cache_multithread"]
# Enables the `iced_glow` renderer. Overrides `iced_wgpu`
glow = ["iced_glow", "iced_glutin"]
# Enables the `Canvas` widget for `iced_glow`
@@ -33,6 +35,8 @@ glow_canvas = ["iced_glow/canvas"]
glow_qr_code = ["iced_glow/qr_code"]
# Enables using system fonts for `iced_glow`
glow_default_system_font = ["iced_glow/default_system_font"]
+# Enables draw_cache_multithread for `iced_glow` glyph drawing
+glow_glyph_draw_cache_multithread = ["iced_glow/glyph_draw_cache_multithread"]
# Enables a debug view in native platforms (press F12)
debug = ["iced_winit/debug"]
# Enables `tokio` as the `executor::Default` on native platforms
diff --git a/glow/Cargo.toml b/glow/Cargo.toml
index e40b8ba8..f5934f8f 100644
--- a/glow/Cargo.toml
+++ b/glow/Cargo.toml
@@ -11,6 +11,7 @@ repository = "https://github.com/hecrj/iced"
canvas = ["iced_graphics/canvas"]
qr_code = ["iced_graphics/qr_code"]
default_system_font = ["iced_graphics/font-source"]
+glyph_draw_cache_multithread = []
# Not supported yet!
image = []
svg = []
diff --git a/glow/src/text.rs b/glow/src/text.rs
index 925c7287..7c9574a2 100644
--- a/glow/src/text.rs
+++ b/glow/src/text.rs
@@ -41,7 +41,9 @@ impl Pipeline {
let draw_brush =
glow_glyph::GlyphBrushBuilder::using_font(font.clone())
.initial_cache_size((2048, 2048))
- .draw_cache_multithread(false) // TODO: Expose as a configuration flag
+ .draw_cache_multithread(cfg!(
+ feature = "glyph_draw_cache_multithread"
+ ))
.build(&gl);
let measure_brush =
diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml
index 3eacdd0f..fc9f7379 100644
--- a/wgpu/Cargo.toml
+++ b/wgpu/Cargo.toml
@@ -24,6 +24,7 @@ farbfeld = ["image_rs/farbfeld"]
canvas = ["iced_graphics/canvas"]
qr_code = ["iced_graphics/qr_code"]
default_system_font = ["iced_graphics/font-source"]
+glyph_draw_cache_multithread = []
[dependencies]
wgpu = "0.8"
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs
index 4d92d9e9..eed5de38 100644
--- a/wgpu/src/text.rs
+++ b/wgpu/src/text.rs
@@ -46,7 +46,9 @@ impl Pipeline {
let draw_brush =
wgpu_glyph::GlyphBrushBuilder::using_font(font.clone())
.initial_cache_size((2048, 2048))
- .draw_cache_multithread(false) // TODO: Expose as a configuration flag
+ .draw_cache_multithread(cfg!(
+ feature = "glyph_draw_cache_multithread"
+ ))
.build(device, format);
let measure_brush =