summaryrefslogtreecommitdiff
path: root/src/export/render.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2023-03-31 16:31:21 +0200
committerLaurenz <laurmaedje@gmail.com>2023-03-31 16:33:33 +0200
commit5f97e0a77348d4fb1c89a9adf671647f1fa86dc3 (patch)
tree2800a61d06ac7cae8e57cb361804c530b1843bb8 /src/export/render.rs
parent00f11ae56d6d20b92a8c6ad6f2245c3ad3e94d86 (diff)
Make `Paint` not implement `Copy`
Diffstat (limited to 'src/export/render.rs')
-rw-r--r--src/export/render.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/export/render.rs b/src/export/render.rs
index 11ab5447..dc87f447 100644
--- a/src/export/render.rs
+++ b/src/export/render.rs
@@ -223,7 +223,7 @@ fn render_outline_glyph(
builder.0.finish()?
};
- let paint = text.fill.into();
+ let paint = (&text.fill).into();
let rule = sk::FillRule::default();
// Flip vertically because font design coordinate
@@ -302,7 +302,7 @@ fn render_shape(
Geometry::Path(ref path) => convert_path(path)?,
};
- if let Some(fill) = shape.fill {
+ if let Some(fill) = &shape.fill {
let mut paint: sk::Paint = fill.into();
if matches!(shape.geometry, Geometry::Rect(_)) {
paint.anti_alias = false;
@@ -312,7 +312,7 @@ fn render_shape(
canvas.fill_path(&path, &paint, rule, ts, mask);
}
- if let Some(Stroke { paint, thickness }) = shape.stroke {
+ if let Some(Stroke { paint, thickness }) = &shape.stroke {
let paint = paint.into();
let stroke = sk::Stroke { width: thickness.to_f32(), ..Default::default() };
canvas.stroke_path(&path, &paint, &stroke, ts, mask);
@@ -428,10 +428,10 @@ impl From<Transform> for sk::Transform {
}
}
-impl From<Paint> for sk::Paint<'static> {
- fn from(paint: Paint) -> Self {
+impl From<&Paint> for sk::Paint<'static> {
+ fn from(paint: &Paint) -> Self {
let mut sk_paint = sk::Paint::default();
- let Paint::Solid(color) = paint;
+ let Paint::Solid(color) = *paint;
sk_paint.set_color(color.into());
sk_paint.anti_alias = true;
sk_paint