Skip to content

Commit

Permalink
Render fuchsia unit square on error, to work around #291.
Browse files Browse the repository at this point in the history
  • Loading branch information
xorgy committed Mar 12, 2024
1 parent 4916da7 commit cf5c03e
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions examples/scenes/src/svg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ use std::{
use anyhow::{Ok, Result};
use instant::Instant;
use vello::{
kurbo::{Affine, Stroke, Vec2},
peniko::Fill,
kurbo::{Affine, Rect, Stroke, Vec2},
peniko::{Color, Fill},
Scene,
};

Expand Down Expand Up @@ -129,8 +129,16 @@ pub fn svg_function_of<R: AsRef<str>>(
(new_scene, size.to_vec2())
}
std::result::Result::Err(e) => {
eprintln!("{:?}", e);
(Scene::new(), Vec2::ZERO)
eprintln!("Failed to load svg, with Err({e:?})");
let mut error_scene = Scene::new();
error_scene.fill(
Fill::NonZero,
Affine::IDENTITY,
Color::FUCHSIA,
None,
&Rect::new(0.0, 0.0, 1.0, 1.0),
);
(error_scene, Vec2::new(1.0, 1.0))
}
}
}
Expand Down

0 comments on commit cf5c03e

Please sign in to comment.