initial macos porting work

This commit is contained in:
Will Temple
2026-03-23 15:16:20 -04:00
parent 4193457fc4
commit 861bf63621
40 changed files with 4575 additions and 233 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()