Skip to content

Commit

Permalink
Render fuchsia unit square on error, to work around linebender#291.
Browse files Browse the repository at this point in the history
  • Loading branch information
xorgy committed Mar 21, 2024
1 parent ff53cf7 commit db94a28
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 @@ -8,8 +8,8 @@ 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 @@ -128,8 +128,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 db94a28

Please sign in to comment.