Skip to content

Commit

Permalink
refactor: remove empty scene crash prevention
Browse files Browse the repository at this point in the history
  • Loading branch information
Stumblinbear committed Jan 13, 2024
1 parent 586e1d2 commit c5c1b12
Showing 1 changed file with 0 additions and 20 deletions.
20 changes: 0 additions & 20 deletions crates/agui_vello/src/render/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ use agui_core::{
};
use vello::{
kurbo::{Affine, Vec2},
peniko::Fill,
Scene, SceneBuilder,
};

Expand Down Expand Up @@ -107,25 +106,6 @@ impl VelloScene {

let mut builder = SceneBuilder::for_scene(&mut self.scene);

// Vello will crash if we try to draw an empty scene, so just add a transparent rectangle
if self.tree.is_empty() {
builder.fill(
Fill::NonZero,
Affine::translate((0.0_f64, 0.0_f64)),
vello::peniko::Color::TRANSPARENT,
None,
&[
vello::kurbo::PathEl::LineTo((0.0, 0.0).into()),
vello::kurbo::PathEl::LineTo((self.size.width as f64, 0.0).into()),
vello::kurbo::PathEl::LineTo(
(self.size.width as f64, self.size.height as f64).into(),
),
vello::kurbo::PathEl::LineTo((0.0, self.size.height as f64).into()),
vello::kurbo::PathEl::ClosePath,
],
);
}

let mut object_stack = Vec::<(usize, RenderObjectId, Affine)>::new();

for object_id in self.tree.iter_down() {
Expand Down

0 comments on commit c5c1b12

Please sign in to comment.