From 68463dad1589119a8a39859159ca75ffdaf8b590 Mon Sep 17 00:00:00 2001 From: Nico Burns Date: Wed, 22 May 2024 14:40:56 +0100 Subject: [PATCH] Simplify background fill --- examples/tiny_skia_render/src/main.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/examples/tiny_skia_render/src/main.rs b/examples/tiny_skia_render/src/main.rs index 33d653aa..2d53de9e 100644 --- a/examples/tiny_skia_render/src/main.rs +++ b/examples/tiny_skia_render/src/main.rs @@ -77,20 +77,13 @@ fn main() { let mut img = Pixmap::new(padded_width, padded_height).unwrap(); // Fill background color - let mut bg_paint = Paint::default(); - bg_paint.set_color(to_tiny_skia(background_color)); - img.fill_rect( - Rect::from_xywh(0., 0., padded_width as f32, padded_height as f32).unwrap(), - &bg_paint, - Transform::identity(), - None, - ); + img.fill(to_tiny_skia(background_color)); + // Wrap Pixmap in a type that implements skrifa::OutlinePen let mut pen = TinySkiaPen::new(img.as_mut()); - // Iterate over laid out lines + // Render each glyph run for line in layout.lines() { - // Iterate over GlyphRun's within each line for glyph_run in line.glyph_runs() { render_glyph_run(&glyph_run, &mut pen, padding); }