Skip to content

Commit

Permalink
Fix vello renderer box shadow (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
aalhitennf authored Nov 7, 2024
1 parent 4fae397 commit d1e79bc
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions vello/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,18 +202,29 @@ impl Renderer for VelloRenderer {

fn fill<'b>(&mut self, path: &impl Shape, brush: impl Into<BrushRef<'b>>, blur_radius: f64) {
let brush: BrushRef<'b> = brush.into();
if blur_radius > 0. {
if let Some(rounded) = path.as_rounded_rect() {
let BrushRef::Solid(color) = brush else {
return;
};
let rect_radius = rounded.radii().top_left;
let rect = rounded.rect();
self.scene.draw_blurred_rounded_rect(
self.transform.then_scale(self.window_scale),
rect,
color,
rect_radius,
blur_radius,
);
} else if let Some(rect) = path.as_rect() {
let BrushRef::Solid(color) = brush else {
return;
};
let rect = path.as_rounded_rect().unwrap_or_default().rect();

self.scene.draw_blurred_rounded_rect(
self.transform.then_scale(self.window_scale),
rect,
color,
0.,
blur_radius,
3.,
);
} else {
self.scene.fill(
Expand Down

0 comments on commit d1e79bc

Please sign in to comment.