@@ -305,10 +305,7 @@ impl GraphicElementRendered for GraphicGroupTable {
305
305
306
306
let opacity = instance. alpha_blending . opacity ( render_params. for_mask ) ;
307
307
if opacity < 1. || ( render_params. view_mode != ViewMode :: Outline && alpha_blending. blend_mode != BlendMode :: default ( ) ) {
308
- bounds = self
309
- . instance_ref_iter ( )
310
- . filter_map ( |element| element. instance . bounding_box ( transform, true ) )
311
- . reduce ( Quad :: combine_bounds) ;
308
+ bounds = instance. instance . bounding_box ( transform, true ) ;
312
309
313
310
if let Some ( bounds) = bounds {
314
311
scene. push_layer (
@@ -331,10 +328,7 @@ impl GraphicElementRendered for GraphicGroupTable {
331
328
mask_instance_state = None ;
332
329
}
333
330
if !layer {
334
- bounds = self
335
- . instance_ref_iter ( )
336
- . filter_map ( |element| element. instance . bounding_box ( transform, true ) )
337
- . reduce ( Quad :: combine_bounds) ;
331
+ bounds = instance. instance . bounding_box ( transform, true ) ;
338
332
}
339
333
340
334
if let Some ( bounds) = bounds {
@@ -565,12 +559,9 @@ impl GraphicElementRendered for VectorDataTable {
565
559
let can_draw_aligned_stroke = instance. instance . style . stroke ( ) . is_some_and ( |stroke| stroke. has_renderable_stroke ( ) && stroke. align . is_not_centered ( ) )
566
560
&& instance. instance . stroke_bezier_paths ( ) . all ( |path| path. closed ( ) ) ;
567
561
568
- let reorder_for_outside = instance
569
- . instance
570
- . style
571
- . stroke ( )
572
- . is_some_and ( |stroke| stroke. align == StrokeAlign :: Outside && !instance. instance . style . fill ( ) . is_none ( ) ) ;
573
- if can_draw_aligned_stroke && !reorder_for_outside {
562
+ let reorder_for_outside = instance. instance . style . stroke ( ) . is_some_and ( |stroke| stroke. align == StrokeAlign :: Outside ) && !instance. instance . style . fill ( ) . is_none ( ) ;
563
+ let use_layer = can_draw_aligned_stroke && !reorder_for_outside;
564
+ if use_layer {
574
565
let mut fill_instance = instance. instance . clone ( ) ;
575
566
fill_instance. style . clear_stroke ( ) ;
576
567
fill_instance. style . set_fill ( Fill :: solid ( Color :: BLACK ) ) ;
@@ -582,15 +573,15 @@ impl GraphicElementRendered for VectorDataTable {
582
573
source_node_id : None ,
583
574
} ) ;
584
575
576
+ let bounds = instance. instance . bounding_box_with_transform ( multiplied_transform) . unwrap_or ( layer_bounds) ;
585
577
let weight = instance. instance . style . stroke ( ) . unwrap ( ) . weight ;
586
- let quad = Quad :: from_box ( layer_bounds) . inflate ( weight * element_transform. matrix2 . determinant ( ) ) ;
587
- let rect = kurbo:: Rect :: new ( quad. top_left ( ) . x , quad. top_left ( ) . y , quad. bottom_right ( ) . x , quad. bottom_right ( ) . y ) ;
578
+ let quad = Quad :: from_box ( bounds) . inflate ( weight * element_transform. matrix2 . determinant ( ) ) ;
579
+ let bounds = quad. bounding_box ( ) ;
580
+ let rect = kurbo:: Rect :: new ( bounds[ 0 ] . x , bounds[ 0 ] . y , bounds[ 1 ] . x , bounds[ 1 ] . y ) ;
588
581
589
- let inside = instance. instance . style . stroke ( ) . unwrap ( ) . align == StrokeAlign :: Inside ;
590
- let compose = if inside { peniko:: Compose :: SrcIn } else { peniko:: Compose :: SrcOut } ;
591
582
scene. push_layer ( peniko:: Mix :: Normal , 1. , kurbo:: Affine :: IDENTITY , & rect) ;
592
583
vector_data. render_to_vello ( scene, parent_transform, _context, & render_params. for_alignment ( applied_stroke_transform) ) ;
593
- scene. push_layer ( peniko:: BlendMode :: new ( peniko:: Mix :: Clip , compose ) , 1. , kurbo:: Affine :: IDENTITY , & rect) ;
584
+ scene. push_layer ( peniko:: BlendMode :: new ( peniko:: Mix :: Clip , peniko :: Compose :: SrcIn ) , 1. , kurbo:: Affine :: IDENTITY , & rect) ;
594
585
}
595
586
596
587
// Render the path
@@ -624,6 +615,7 @@ impl GraphicElementRendered for VectorDataTable {
624
615
true => [ Op :: Stroke , Op :: Fill ] ,
625
616
false => [ Op :: Fill , Op :: Stroke ] , // Default
626
617
} ;
618
+
627
619
for operation in order {
628
620
match operation {
629
621
Op :: Fill => {
@@ -723,7 +715,7 @@ impl GraphicElementRendered for VectorDataTable {
723
715
}
724
716
}
725
717
726
- if can_draw_aligned_stroke {
718
+ if use_layer {
727
719
scene. pop_layer ( ) ;
728
720
scene. pop_layer ( ) ;
729
721
}
0 commit comments