Skip to content

Commit

Permalink
Update to new colors
Browse files Browse the repository at this point in the history
  • Loading branch information
AustinMReppert authored and DJMcNab committed Feb 3, 2025
1 parent 770f39a commit e504dac
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions examples/scenes/src/cosmic_text_scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use unicode_segmentation::UnicodeSegmentation;
use std::cmp;
use std::collections::HashMap;
use std::sync::Arc;
use vello::peniko::color::palette;

impl TestScene for CosmicTextScene {
fn render(&mut self, scene: &mut Scene, _scene_params: &mut SceneParams) {
Expand Down Expand Up @@ -153,10 +154,10 @@ impl CosmicTextScene {
vello_fonts,
buffer_glyphs: create_glyphs_for_editor(
&editor,
Color::from_rgba8(255, 255, 255, 255),
Color::from_rgba8(255, 0, 0, 255),
Color::from_rgba8(0, 0, 255, 255),
Color::from_rgba8(255, 255, 255, 255),
palette::css::WHITE,
palette::css::RED,
palette::css::BLUE,
palette::css::WHITE,
),
}
}
Expand Down Expand Up @@ -333,7 +334,7 @@ fn create_glyphs(
};

if let Some(editor_info) = &editor_info {
if text_color.components != editor_info.selected_text_color.components {
if text_color != editor_info.selected_text_color {
if let Some((start, end)) = editor_info.selection_bounds {
if line_i >= start.line
&& line_i <= end.line
Expand All @@ -347,9 +348,7 @@ fn create_glyphs(
}

if let Some((last_font, last_glyph_color)) = last_font {
if last_font != glyph.font_id
|| last_glyph_color.components != glyph_color.components
{
if last_font != glyph.font_id || last_glyph_color != glyph_color {
buffer_line.glyph_runs.push(BufferGlyphRun {
font: last_font,
glyphs: current_glyphs,
Expand Down

0 comments on commit e504dac

Please sign in to comment.