Fix lints, undo broken set_immediate_interval

This commit is contained in:
2026-03-23 10:11:51 -04:00
parent 4193457fc4
commit ad5c233b15
4 changed files with 174 additions and 88 deletions

View File

@@ -990,7 +990,9 @@ fn fs_main(input: VertexOut) -> @location(0) vec4<f32> {
bottom: physical.y - image.placement.top + height,
},
content: image.content,
color: glyph.color_opt.map_or(text.default_color, color_from_cosmic),
color: glyph
.color_opt
.map_or(text.default_color, color_from_cosmic),
data: image.data.clone(),
});
}
@@ -1470,7 +1472,11 @@ fn create_glyph_atlas(
/// Resolve `Color::SENTINEL` to `default_color`; return other colors unchanged.
#[inline]
fn resolve_glyph_color(color: Color, default_color: Color) -> Color {
if color == Color::SENTINEL { default_color } else { color }
if color == Color::SENTINEL {
default_color
} else {
color
}
}
fn color_from_cosmic(color: cosmic_text::Color) -> Color {
@@ -2297,7 +2303,7 @@ fn clip_textured_rect(
/// return only those glyph indices. This turns O(all_glyphs) iteration into
/// O(log(lines) + visible_glyphs) — critical for large text nodes in scroll
/// boxes where only a few lines are on screen at once.
fn clip_visible_glyphs<'a>(text: &'a PreparedText, clip: Option<Rect>) -> &'a [GlyphInstance] {
fn clip_visible_glyphs(text: &PreparedText, clip: Option<Rect>) -> &[GlyphInstance] {
let Some(clip) = clip else {
return &text.glyphs;
};
@@ -2332,7 +2338,12 @@ fn text_texture_key(text: &PreparedText) -> TextTextureKey {
.map(|bounds| (bounds.width.to_bits(), bounds.height.to_bits())),
font_size_bits: text.font_size.to_bits(),
line_height_bits: text.line_height.to_bits(),
color: (text.default_color.r, text.default_color.g, text.default_color.b, text.default_color.a),
color: (
text.default_color.r,
text.default_color.g,
text.default_color.b,
text.default_color.a,
),
glyphs: text
.glyphs
.iter()
@@ -2354,10 +2365,7 @@ mod tests {
ActiveClip, blend_rgba, build_text_vertices, build_vertices, clip_rect_array,
push_clip_state, rounded_clip_arrays, text_texture_key,
};
use ruin_ui::{
ClipRegion, Color, GlyphInstance, Point, PreparedText, Rect, SceneSnapshot,
TextSelectionStyle, UiSize,
};
use ruin_ui::{ClipRegion, Color, Point, PreparedText, Rect, SceneSnapshot, UiSize};
#[test]
fn quad_scenes_expand_to_six_vertices_per_quad() {