Make Vello render groups with a blending stack only when necessary (#1905)
Only use group blends when necessary
This commit is contained in:
parent
ed841803ce
commit
5474a22b2e
|
|
@ -328,16 +328,23 @@ impl GraphicElementRendered for GraphicGroup {
|
||||||
|
|
||||||
let Some(bounds) = self.bounding_box(transform) else { return };
|
let Some(bounds) = self.bounding_box(transform) else { return };
|
||||||
let blending = vello::peniko::BlendMode::new(self.alpha_blending.blend_mode.into(), vello::peniko::Compose::SrcOver);
|
let blending = vello::peniko::BlendMode::new(self.alpha_blending.blend_mode.into(), vello::peniko::Compose::SrcOver);
|
||||||
scene.push_layer(
|
let mut layer = false;
|
||||||
blending,
|
|
||||||
self.alpha_blending.opacity,
|
if self.alpha_blending.opacity < 1. || self.alpha_blending.blend_mode != BlendMode::default() {
|
||||||
kurbo::Affine::IDENTITY,
|
layer = true;
|
||||||
&vello::kurbo::Rect::new(bounds[0].x, bounds[0].y, bounds[1].x, bounds[1].y),
|
scene.push_layer(
|
||||||
);
|
blending,
|
||||||
|
self.alpha_blending.opacity,
|
||||||
|
kurbo::Affine::IDENTITY,
|
||||||
|
&vello::kurbo::Rect::new(bounds[0].x, bounds[0].y, bounds[1].x, bounds[1].y),
|
||||||
|
);
|
||||||
|
}
|
||||||
for element in self.iter() {
|
for element in self.iter() {
|
||||||
element.render_to_vello(scene, child_transform);
|
element.render_to_vello(scene, child_transform);
|
||||||
}
|
}
|
||||||
scene.pop_layer();
|
if layer {
|
||||||
|
scene.pop_layer();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn contains_artboard(&self) -> bool {
|
fn contains_artboard(&self) -> bool {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue