Set default_color
per TextArea
This commit is contained in:
parent
1dcb1735b4
commit
1f31586c55
3 changed files with 6 additions and 7 deletions
|
@ -117,8 +117,8 @@ async fn run() {
|
|||
right: 600,
|
||||
bottom: 160,
|
||||
},
|
||||
default_color: Color::rgb(255, 255, 255),
|
||||
}],
|
||||
Color::rgb(255, 255, 255),
|
||||
&mut cache,
|
||||
)
|
||||
.unwrap();
|
||||
|
|
|
@ -100,4 +100,6 @@ pub struct TextArea<'a, 'b: 'a> {
|
|||
/// The visible bounds of the text area. This is used to clip the text and doesn't have to
|
||||
/// match the `left` and `top` values.
|
||||
pub bounds: TextBounds,
|
||||
// The default color of the text area.
|
||||
pub default_color: Color,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::{
|
||||
CacheKey, Color, GlyphDetails, GlyphToRender, GpuCacheStatus, Params, PrepareError,
|
||||
RenderError, Resolution, SwashCache, SwashContent, TextArea, TextAtlas,
|
||||
CacheKey, GlyphDetails, GlyphToRender, GpuCacheStatus, Params, PrepareError, RenderError,
|
||||
Resolution, SwashCache, SwashContent, TextArea, TextAtlas,
|
||||
};
|
||||
use std::{collections::HashSet, iter, mem::size_of, num::NonZeroU32, slice, sync::Arc};
|
||||
use wgpu::{
|
||||
|
@ -70,7 +70,6 @@ impl TextRenderer {
|
|||
atlas: &mut TextAtlas,
|
||||
screen_resolution: Resolution,
|
||||
text_areas: &[TextArea<'a, 'b>],
|
||||
default_color: Color,
|
||||
cache: &mut SwashCache,
|
||||
mut metadata_to_depth: impl FnMut(usize) -> f32,
|
||||
) -> Result<(), PrepareError> {
|
||||
|
@ -319,7 +318,7 @@ impl TextRenderer {
|
|||
|
||||
let color = match glyph.color_opt {
|
||||
Some(some) => some,
|
||||
None => default_color,
|
||||
None => text_area.default_color,
|
||||
};
|
||||
|
||||
let depth = metadata_to_depth(glyph.metadata);
|
||||
|
@ -417,7 +416,6 @@ impl TextRenderer {
|
|||
atlas: &mut TextAtlas,
|
||||
screen_resolution: Resolution,
|
||||
text_areas: &[TextArea<'a, 'b>],
|
||||
default_color: Color,
|
||||
cache: &mut SwashCache,
|
||||
) -> Result<(), PrepareError> {
|
||||
self.prepare_with_depth(
|
||||
|
@ -426,7 +424,6 @@ impl TextRenderer {
|
|||
atlas,
|
||||
screen_resolution,
|
||||
text_areas,
|
||||
default_color,
|
||||
cache,
|
||||
zero_depth,
|
||||
)
|
||||
|
|
Loading…
Reference in a new issue