From 119cf2ecd10f70471199439acb1c4f9d96a57ced Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 1 Mar 2023 21:48:27 +0100 Subject: Remove magic boolean in `into_paint` --- tiny_skia/src/canvas.rs | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'tiny_skia/src') diff --git a/tiny_skia/src/canvas.rs b/tiny_skia/src/canvas.rs index 59765f59..958063d2 100644 --- a/tiny_skia/src/canvas.rs +++ b/tiny_skia/src/canvas.rs @@ -44,7 +44,7 @@ impl Frame { self.primitives.push(Primitive::Fill { path, - paint: into_paint(fill.style, true), + paint: into_paint(fill.style), rule: into_fill_rule(fill.rule), transform: self.transform, }); @@ -61,7 +61,10 @@ impl Frame { self.primitives.push(Primitive::Fill { path, - paint: into_paint(fill.style, false), + paint: tiny_skia::Paint { + anti_alias: false, + ..into_paint(fill.style) + }, rule: into_fill_rule(fill.rule), transform: self.transform, }); @@ -74,7 +77,7 @@ impl Frame { self.primitives.push(Primitive::Stroke { path, - paint: into_paint(stroke.style, true), + paint: into_paint(stroke.style), stroke: skia_stroke, transform: self.transform, }); @@ -207,7 +210,7 @@ fn convert_path(path: &Path) -> tiny_skia::Path { .expect("Convert lyon path to tiny_skia path") } -pub fn into_paint(style: Style, anti_alias: bool) -> tiny_skia::Paint<'static> { +pub fn into_paint(style: Style) -> tiny_skia::Paint<'static> { tiny_skia::Paint { shader: match style { Style::Solid(color) => tiny_skia::Shader::SolidColor( @@ -246,7 +249,7 @@ pub fn into_paint(style: Style, anti_alias: bool) -> tiny_skia::Paint<'static> { .expect("Create linear gradient"), }, }, - anti_alias, + anti_alias: true, ..Default::default() } } -- cgit