diff options
author | 2023-03-04 05:51:05 +0100 | |
---|---|---|
committer | 2023-03-04 05:51:05 +0100 | |
commit | bacbaeed9981199fa834733efcc72bd80cff3f16 (patch) | |
tree | e1d2799e5ee997d7acd28888750abfb2a44657be /wgpu/src/text.rs | |
parent | 3a0d34c0240f4421737a6a08761f99d6f8140d02 (diff) | |
parent | 11b2c3bbe31a43e73a61b9bd9f022233f302ae27 (diff) | |
download | iced-bacbaeed9981199fa834733efcc72bd80cff3f16.tar.gz iced-bacbaeed9981199fa834733efcc72bd80cff3f16.tar.bz2 iced-bacbaeed9981199fa834733efcc72bd80cff3f16.zip |
Merge branch 'advanced-text' into feature/software-renderer
Diffstat (limited to 'wgpu/src/text.rs')
-rw-r--r-- | wgpu/src/text.rs | 28 |
1 files changed, 11 insertions, 17 deletions
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index d7a27f3a..e99844e6 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -1,6 +1,6 @@ use crate::core::alignment; use crate::core::text::Hit; -use crate::core::{Color, Font, Point, Rectangle, Size}; +use crate::core::{Font, Point, Rectangle, Size}; use crate::layer::Text; use rustc_hash::{FxHashMap, FxHashSet}; @@ -109,7 +109,6 @@ impl Pipeline { height: (section.bounds.height * scale_factor) .ceil(), }, - color: section.color, }, ); @@ -161,6 +160,16 @@ impl Pipeline { left: left as i32, top: top as i32, bounds, + default_color: { + let [r, g, b, a] = section.color.into_linear(); + + glyphon::Color::rgba( + (r * 255.0) as u8, + (g * 255.0) as u8, + (b * 255.0) as u8, + (a * 255.0) as u8, + ) + }, } }); @@ -173,7 +182,6 @@ impl Pipeline { height: target_size.height, }, text_areas, - glyphon::Color::rgb(0, 0, 0), &mut glyphon::SwashCache::new(fields.fonts), ); @@ -248,7 +256,6 @@ impl Pipeline { size, font, bounds, - color: Color::BLACK, }, ); @@ -282,7 +289,6 @@ impl Pipeline { size, font, bounds, - color: Color::BLACK, }, ); @@ -353,7 +359,6 @@ impl<'a> Cache<'a> { key.font.hash(&mut hasher); key.bounds.width.to_bits().hash(&mut hasher); key.bounds.height.to_bits().hash(&mut hasher); - key.color.into_rgba8().hash(&mut hasher); hasher.finish() }; @@ -370,16 +375,6 @@ impl<'a> Cache<'a> { key.content, glyphon::Attrs::new() .family(to_family(key.font)) - .color({ - let [r, g, b, a] = key.color.into_linear(); - - glyphon::Color::rgba( - (r * 255.0) as u8, - (g * 255.0) as u8, - (b * 255.0) as u8, - (a * 255.0) as u8, - ) - }) .monospaced(matches!(key.font, Font::Monospace)), ); @@ -411,7 +406,6 @@ struct Key<'a> { size: f32, font: Font, bounds: Size, - color: Color, } type KeyHash = u64; |