@@ -6,7 +6,7 @@ use core_types::bounds::BoundingBox;
66use core_types:: bounds:: RenderBoundingBox ;
77use core_types:: color:: Color ;
88use core_types:: color:: SRGBA8 ;
9- use core_types:: list:: { ATTR_FILL_GRAPHIC , ATTR_STROKE_PAINT_GRAPHIC , Item , List } ;
9+ use core_types:: list:: { ATTR_FILL_GRAPHIC , ATTR_STROKE_GRAPHIC , Item , List } ;
1010use core_types:: math:: quad:: Quad ;
1111use core_types:: render_complexity:: RenderComplexity ;
1212use core_types:: transform:: Footprint ;
@@ -18,7 +18,7 @@ use core_types::{
1818use dyn_any:: DynAny ;
1919use glam:: { DAffine2 , DVec2 } ;
2020use graphene_hash:: CacheHashWrapper ;
21- use graphic_types:: graphic:: { fill_graphic_list_at, is_stroke_fully_transparent_at, stroke_paint_graphic_list_at } ;
21+ use graphic_types:: graphic:: { fill_graphic_list_at, is_stroke_fully_transparent_at, stroke_graphic_list_at } ;
2222use graphic_types:: raster_types:: { BitmapMut , CPU , GPU , Image , Raster } ;
2323use graphic_types:: vector_types:: gradient:: { GradientStops , GradientType } ;
2424use graphic_types:: vector_types:: subpath:: Subpath ;
@@ -454,10 +454,10 @@ pub struct RenderMetadata {
454454 /// information that lives on the list rather than on `PathStyle.fill`.
455455 #[ cfg_attr( feature = "serde" , serde( skip) ) ]
456456 pub fill_attributes : HashMap < NodeId , Arc < List < Graphic > > > ,
457- /// Per-layer `ATTR_STROKE_PAINT_GRAPHIC ` row attribute, exposed so message handlers can read
457+ /// Per-layer `ATTR_STROKE_GRAPHIC ` row attribute, exposed so message handlers can read
458458 /// stroke paint information that lives on the list rather than on `Stroke.color`.
459459 #[ cfg_attr( feature = "serde" , serde( skip) ) ]
460- pub stroke_paint_attributes : HashMap < NodeId , Arc < List < Graphic > > > ,
460+ pub stroke_attributes : HashMap < NodeId , Arc < List < Graphic > > > ,
461461 pub backgrounds : Vec < Background > ,
462462}
463463
@@ -482,7 +482,7 @@ impl RenderMetadata {
482482 clip_targets,
483483 vector_data,
484484 fill_attributes,
485- stroke_paint_attributes ,
485+ stroke_attributes ,
486486 backgrounds,
487487 } = self ;
488488 upstream_footprints. extend ( other. upstream_footprints . iter ( ) ) ;
@@ -494,7 +494,7 @@ impl RenderMetadata {
494494 clip_targets. extend ( other. clip_targets . iter ( ) ) ;
495495 vector_data. extend ( other. vector_data . iter ( ) . map ( |( id, data) | ( * id, data. clone ( ) ) ) ) ;
496496 fill_attributes. extend ( other. fill_attributes . iter ( ) . map ( |( id, data) | ( * id, data. clone ( ) ) ) ) ;
497- stroke_paint_attributes . extend ( other. stroke_paint_attributes . iter ( ) . map ( |( id, data) | ( * id, data. clone ( ) ) ) ) ;
497+ stroke_attributes . extend ( other. stroke_attributes . iter ( ) . map ( |( id, data) | ( * id, data. clone ( ) ) ) ) ;
498498
499499 // TODO: Find a better non O(n^2) way to merge backgrounds
500500 for background in & other. backgrounds {
@@ -1073,13 +1073,13 @@ impl Render for List<Vector> {
10731073 let fill_graphic_list = fill_graphic_list_at ( self , index) ;
10741074 let fill_graphic = fill_graphic_list. as_ref ( ) . and_then ( |l| l. element ( 0 ) ) ;
10751075
1076- let stroke_paint_graphic_list = stroke_paint_graphic_list_at ( self , index) ;
1077- let stroke_paint_graphic = stroke_paint_graphic_list . as_ref ( ) . and_then ( |l| l. element ( 0 ) ) ;
1076+ let stroke_graphic_list = stroke_graphic_list_at ( self , index) ;
1077+ let stroke_graphic = stroke_graphic_list . as_ref ( ) . and_then ( |l| l. element ( 0 ) ) ;
10781078
10791079 let path_is_closed = vector. stroke_bezier_paths ( ) . all ( |path| path. closed ( ) ) ;
10801080 let can_draw_aligned_stroke = path_is_closed
10811081 && vector. style . stroke ( ) . is_some_and ( |stroke| stroke. has_renderable_stroke ( ) && stroke. align . is_not_centered ( ) )
1082- && stroke_paint_graphic . is_some_and ( |graphic| !graphic. is_fully_transparent ( ) ) ;
1082+ && stroke_graphic . is_some_and ( |graphic| !graphic. is_fully_transparent ( ) ) ;
10831083 let can_use_paint_order = !( fill_graphic. is_none_or ( |graphic| !graphic. is_opaque ( ) ) || mask_type == MaskType :: Clip ) ;
10841084
10851085 let needs_separate_alignment_fill = can_draw_aligned_stroke && !can_use_paint_order;
@@ -1176,7 +1176,7 @@ impl Render for List<Vector> {
11761176 . style
11771177 . stroke ( )
11781178 . map ( |stroke| {
1179- if stroke_paint_graphic_list . as_ref ( ) . and_then ( |l| l. element ( 0 ) ) . is_some ( ) {
1179+ if stroke_graphic_list . as_ref ( ) . and_then ( |l| l. element ( 0 ) ) . is_some ( ) {
11801180 stroke. render (
11811181 defs,
11821182 item_transform,
@@ -1194,9 +1194,9 @@ impl Render for List<Vector> {
11941194 . unwrap_or_default ( ) ;
11951195
11961196 // Need to avoid generating only paint attribute, otherwise SVG uses 1px width stroke as a fallback
1197- let stroke_paint_visible = vector. style . stroke ( ) . is_some_and ( |stroke| stroke. has_renderable_stroke ( ) ) && stroke_paint_graphic . is_some_and ( |g| !g. is_fully_transparent ( ) ) ;
1198- let stroke_paint_attribute = if stroke_paint_visible {
1199- stroke_paint_graphic_list
1197+ let stroke_visible = vector. style . stroke ( ) . is_some_and ( |stroke| stroke. has_renderable_stroke ( ) ) && stroke_graphic . is_some_and ( |g| !g. is_fully_transparent ( ) ) ;
1198+ let stroke_attribute = if stroke_visible {
1199+ stroke_graphic_list
12001200 . as_deref ( )
12011201 . map ( |list| {
12021202 // Gradient should align with the fill path bbox so that a shared gradient lines up across fill and stroke.
@@ -1247,7 +1247,7 @@ impl Render for List<Vector> {
12471247 }
12481248 attributes. push_val ( fill_attribute) ;
12491249 attributes. push_val ( stroke_shape_attribute) ;
1250- attributes. push_val ( stroke_paint_attribute ) ;
1250+ attributes. push_val ( stroke_attribute ) ;
12511251
12521252 if vector. is_branching ( ) && !use_face_fill {
12531253 attributes. push ( "fill-rule" , "evenodd" ) ;
@@ -1317,7 +1317,7 @@ impl Render for List<Vector> {
13171317 }
13181318
13191319 let fill_graphic_list = fill_graphic_list_at ( self , index) ;
1320- let stroke_paint_graphic_list = stroke_paint_graphic_list_at ( self , index) ;
1320+ let stroke_graphic_list = stroke_graphic_list_at ( self , index) ;
13211321
13221322 // If we're using opacity or a blend mode, we need to push a layer
13231323 let blend_mode = match render_params. render_mode {
@@ -1410,11 +1410,11 @@ impl Render for List<Vector> {
14101410 } ;
14111411
14121412 let do_stroke = |scene : & mut Scene , width_scale : f64 , context : & mut RenderContext | {
1413- let Some ( stroke_paint_graphic_list ) = stroke_paint_graphic_list . as_deref ( ) else { return } ;
1413+ let Some ( stroke_graphic_list ) = stroke_graphic_list . as_deref ( ) else { return } ;
14141414 let Some ( stroke) = element. style . stroke ( ) else { return } ;
14151415
1416- for paint_idx in 0 ..stroke_paint_graphic_list . len ( ) {
1417- let Some ( stroke_paint_graphic ) = stroke_paint_graphic_list . element ( paint_idx) else {
1416+ for paint_idx in 0 ..stroke_graphic_list . len ( ) {
1417+ let Some ( stroke_graphic ) = stroke_graphic_list . element ( paint_idx) else {
14181418 continue ;
14191419 } ;
14201420
@@ -1443,7 +1443,7 @@ impl Render for List<Vector> {
14431443 continue ;
14441444 } ;
14451445
1446- match stroke_paint_graphic {
1446+ match stroke_graphic {
14471447 Graphic :: Color ( list) => {
14481448 let Some ( color) = list. element ( 0 ) else { continue } ;
14491449 let brush = peniko:: Brush :: Solid ( SRGBA8 :: from ( * color) . to_peniko_color ( ) ) ;
@@ -1467,7 +1467,7 @@ impl Render for List<Vector> {
14671467 let stroked = peniko:: kurbo:: stroke ( path. iter ( ) , & stroke, & StrokeOpts :: default ( ) , 0.01 ) ;
14681468
14691469 scene. push_clip_layer ( peniko:: Fill :: NonZero , kurbo:: Affine :: new ( element_transform. to_cols_array ( ) ) , & stroked) ;
1470- stroke_paint_graphic . render_to_vello ( scene, multiplied_transform, context, render_params) ;
1470+ stroke_graphic . render_to_vello ( scene, multiplied_transform, context, render_params) ;
14711471 scene. pop_layer ( ) ;
14721472 }
14731473 } ;
@@ -1609,12 +1609,12 @@ impl Render for List<Vector> {
16091609 metadata. vector_data . entry ( element_id) . or_insert_with ( || Arc :: new ( source. clone ( ) ) ) ;
16101610
16111611 // Surface row attribute paint sources (only for item 0) so message handlers can read
1612- // `ATTR_FILL_GRAPHIC` / `ATTR_STROKE_PAINT_GRAPHIC ` without rebuilding the list.
1613- if let Some ( fill_paint ) = self . attribute :: < List < Graphic > > ( ATTR_FILL_GRAPHIC , index) . cloned ( ) {
1614- metadata. fill_attributes . entry ( element_id) . or_insert_with ( || Arc :: new ( fill_paint ) ) ;
1612+ // `ATTR_FILL_GRAPHIC` / `ATTR_STROKE_GRAPHIC ` without rebuilding the list.
1613+ if let Some ( fill_graphic ) = self . attribute :: < List < Graphic > > ( ATTR_FILL_GRAPHIC , index) . cloned ( ) {
1614+ metadata. fill_attributes . entry ( element_id) . or_insert_with ( || Arc :: new ( fill_graphic ) ) ;
16151615 }
1616- if let Some ( stroke_paint ) = self . attribute :: < List < Graphic > > ( ATTR_STROKE_PAINT_GRAPHIC , index) . cloned ( ) {
1617- metadata. stroke_paint_attributes . entry ( element_id) . or_insert_with ( || Arc :: new ( stroke_paint ) ) ;
1616+ if let Some ( stroke_graphic ) = self . attribute :: < List < Graphic > > ( ATTR_STROKE_GRAPHIC , index) . cloned ( ) {
1617+ metadata. stroke_attributes . entry ( element_id) . or_insert_with ( || Arc :: new ( stroke_graphic ) ) ;
16181618 }
16191619
16201620 // Surface `editor:text_frame` for the Text tool's drag cage
0 commit comments