mirror of
https://github.com/GraphiteEditor/Graphite.git
synced 2025-07-07 15:55:00 +00:00
Only compute bounding box for layers being rendered by Vello when actually used (#2771)
Only compute bounding box for vello when it is actually used Co-authored-by: Keavon Chambers <keavon@keavon.com>
This commit is contained in:
parent
cf8496b5a0
commit
357e77077d
1 changed files with 20 additions and 12 deletions
|
@ -289,19 +289,21 @@ impl GraphicElementRendered for GraphicGroupTable {
|
|||
|
||||
let mut layer = false;
|
||||
|
||||
let bounds = self
|
||||
.instance_ref_iter()
|
||||
.filter_map(|element| element.instance.bounding_box(transform, true))
|
||||
.reduce(Quad::combine_bounds);
|
||||
if let Some(bounds) = bounds {
|
||||
let blend_mode = match render_params.view_mode {
|
||||
ViewMode::Outline => peniko::Mix::Normal,
|
||||
_ => alpha_blending.blend_mode.to_peniko(),
|
||||
};
|
||||
let blend_mode = match render_params.view_mode {
|
||||
ViewMode::Outline => peniko::Mix::Normal,
|
||||
_ => alpha_blending.blend_mode.to_peniko(),
|
||||
};
|
||||
let mut bounds = None;
|
||||
|
||||
let factor = if render_params.for_mask { 1. } else { alpha_blending.fill };
|
||||
let opacity = alpha_blending.opacity * factor;
|
||||
if opacity < 1. || (render_params.view_mode != ViewMode::Outline && alpha_blending.blend_mode != BlendMode::default()) {
|
||||
let factor = if render_params.for_mask { 1. } else { alpha_blending.fill };
|
||||
let opacity = alpha_blending.opacity * factor;
|
||||
if opacity < 1. || (render_params.view_mode != ViewMode::Outline && alpha_blending.blend_mode != BlendMode::default()) {
|
||||
bounds = self
|
||||
.instance_ref_iter()
|
||||
.filter_map(|element| element.instance.bounding_box(transform, true))
|
||||
.reduce(Quad::combine_bounds);
|
||||
|
||||
if let Some(bounds) = bounds {
|
||||
scene.push_layer(
|
||||
peniko::BlendMode::new(blend_mode, peniko::Compose::SrcOver),
|
||||
opacity,
|
||||
|
@ -321,6 +323,12 @@ impl GraphicElementRendered for GraphicGroupTable {
|
|||
if !next_clips {
|
||||
mask_instance_state = None;
|
||||
}
|
||||
if !layer {
|
||||
bounds = self
|
||||
.instance_ref_iter()
|
||||
.filter_map(|element| element.instance.bounding_box(transform, true))
|
||||
.reduce(Quad::combine_bounds);
|
||||
}
|
||||
|
||||
if let Some(bounds) = bounds {
|
||||
let rect = kurbo::Rect::new(bounds[0].x, bounds[0].y, bounds[1].x, bounds[1].y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue