Skip to content

Commit

Permalink
Spell color consistently as color (#748)
Browse files Browse the repository at this point in the history
  • Loading branch information
waywardmonkeys authored Nov 28, 2024
1 parent e6ead09 commit 7592355
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
4 changes: 2 additions & 2 deletions examples/scenes/src/test_scenes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1095,14 +1095,14 @@ mod impls {
(100., Color::WHITE),
];
let mut depth = 0;
for (width, colour) in &options[..params.complexity.min(options.len() - 1)] {
for (width, color) in &options[..params.complexity.min(options.len() - 1)] {
scene.push_layer(
Mix::Normal,
0.9,
Affine::IDENTITY,
&Rect::from_origin_size((10., 10.), (*width, *width)),
);
scene.fill(Fill::EvenOdd, Affine::IDENTITY, colour, None, &main_rect);
scene.fill(Fill::EvenOdd, Affine::IDENTITY, color, None, &main_rect);
depth += 1;
}
for _ in 0..depth {
Expand Down
10 changes: 5 additions & 5 deletions vello/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ impl<'a> DrawGlyphs<'a> {
/// This supports emoji fonts in COLR and bitmap formats.
/// `style` is ignored for these fonts.
///
/// For these glyphs, the given [brush](Self::brush) is used as the "foreground colour", and should
/// For these glyphs, the given [brush](Self::brush) is used as the "foreground color", and should
/// be [`Solid`](Brush::Solid) for maximum compatibility.
pub fn draw(mut self, style: impl Into<StyleRef<'a>>, glyphs: impl Iterator<Item = Glyph>) {
let font_index = self.run.font.index;
Expand Down Expand Up @@ -495,7 +495,7 @@ impl<'a> DrawGlyphs<'a> {
(-self.run.font_size / upem).into(),
);

let colour_collection = font.color_glyphs();
let color_collection = font.color_glyphs();
let bitmaps = bitmap::BitmapStrikes::new(&font);
let mut final_glyph = None;
let mut outline_count = 0;
Expand All @@ -508,7 +508,7 @@ impl<'a> DrawGlyphs<'a> {
let ppem = self.run.font_size;
let outline_glyphs = (&mut glyphs).take_while(|glyph| {
let glyph_id = GlyphId::new(glyph.id);
match colour_collection.get(glyph_id) {
match color_collection.get(glyph_id) {
Some(color) => {
final_glyph = Some((EmojiLikeGlyph::Colr(color), *glyph));
false
Expand Down Expand Up @@ -979,7 +979,7 @@ fn conv_brush(
}

fn color_index(cpal: &'_ Cpal<'_>, palette_index: u16) -> Option<Color> {
// The "application determined" foreground colour should be used
// The "application determined" foreground color should be used
// This will be handled by the caller
if palette_index == 0xFFFF {
return None;
Expand Down Expand Up @@ -1017,7 +1017,7 @@ impl ColorStopsSource for ColorStopsConverter<'_> {
let color = color_index(self.1, item.palette_index);
let color = match color {
Some(color) => color,
// If we should use the "application defined fallback colour",
// If we should use the "application defined fallback color",
// then *try* and determine that from the existing brush
None => match self.2 {
BrushRef::Solid(c) => c,
Expand Down
10 changes: 5 additions & 5 deletions vello_tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub use snapshot::{
pub struct TestParams {
pub width: u32,
pub height: u32,
pub base_colour: Option<Color>,
pub base_color: Option<Color>,
pub use_cpu: bool,
pub name: String,
pub anti_aliasing: AaConfig,
Expand All @@ -71,7 +71,7 @@ impl TestParams {
TestParams {
width,
height,
base_colour: None,
base_color: None,
use_cpu: false,
name: name.into(),
anti_aliasing: AaConfig::Area,
Expand Down Expand Up @@ -127,7 +127,7 @@ pub async fn get_scene_image(params: &TestParams, scene: &Scene) -> Result<Image
let width = params.width;
let height = params.height;
let render_params = vello::RenderParams {
base_color: params.base_colour.unwrap_or(Color::BLACK),
base_color: params.base_color.unwrap_or(Color::BLACK),
width,
height,
antialiasing_method: params.anti_aliasing,
Expand Down Expand Up @@ -270,8 +270,8 @@ pub fn encode_test_scene(mut test_scene: ExampleScene, test_params: &mut TestPar
test_scene
.function
.render(&mut inner_scene, &mut scene_params);
if test_params.base_colour.is_none() {
test_params.base_colour = scene_params.base_color;
if test_params.base_color.is_none() {
test_params.base_color = scene_params.base_color;
}
if let Some(resolution) = scene_params.resolution {
// Automatically scale the rendering to fill as much of the window as possible
Expand Down
6 changes: 3 additions & 3 deletions vello_tests/tests/property.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ fn simple_square(use_cpu: bool) {
fn empty_scene(use_cpu: bool) {
let scene = Scene::new();

// Adding an alpha factor here changes the resulting colour *slightly*,
// Adding an alpha factor here changes the resulting color *slightly*,
// presumably due to pre-multiplied alpha.
// We just assume that alpha scenarios work fine
let color = Color::PLUM;
let params = TestParams {
use_cpu,
base_colour: Some(color),
base_color: Some(color),
..TestParams::new("simple_square", 150, 150)
};
let image = vello_tests::render_then_debug_sync(&scene, &params).unwrap();
Expand All @@ -67,7 +67,7 @@ fn empty_scene(use_cpu: bool) {
let &[r, g, b, a] = pixel else { unreachable!() };
let image_color = Color::rgba8(r, g, b, a);
if image_color != color {
panic!("Got {image_color:?}, expected clear colour {color:?}");
panic!("Got {image_color:?}, expected clear color {color:?}");
}
}
}
Expand Down

0 comments on commit 7592355

Please sign in to comment.