@@ -485,6 +485,7 @@ pub fn internal_canvas_clear_rect<'gc>(
485485 shadow_offset_x : 0.0 ,
486486 shadow_offset_y : 0.0 ,
487487 composite_operation : CompositeOperation :: default ( ) ,
488+ clip_path : None ,
488489 } ,
489490 ) ;
490491 } else {
@@ -595,6 +596,7 @@ pub fn internal_canvas_fill_rect<'gc>(
595596 shadow_offset_x : data. shadow_offset_x ,
596597 shadow_offset_y : data. shadow_offset_y ,
597598 composite_operation : data. composite_operation ,
599+ clip_path : None ,
598600 } ,
599601 ) ;
600602 } else {
@@ -736,6 +738,7 @@ pub fn internal_canvas_fill<'gc>(
736738 shadow_offset_x : data. shadow_offset_x ,
737739 shadow_offset_y : data. shadow_offset_y ,
738740 composite_operation : data. composite_operation ,
741+ clip_path : None ,
739742 } ,
740743 ) ;
741744 }
@@ -788,6 +791,7 @@ pub fn internal_canvas_stroke<'gc>(
788791 shadow_offset_x : data. shadow_offset_x ,
789792 shadow_offset_y : data. shadow_offset_y ,
790793 composite_operation : data. composite_operation ,
794+ clip_path : None ,
791795 } ,
792796 ) ;
793797 }
@@ -1426,6 +1430,7 @@ pub fn process_all_commands<'gc>(
14261430 shadow_offset_x : ctx. shadow_offset_x ,
14271431 shadow_offset_y : ctx. shadow_offset_y ,
14281432 composite_operation : ctx. composite_operation ,
1433+ clip_path : None ,
14291434 } ,
14301435 ) ;
14311436 }
@@ -1446,6 +1451,7 @@ pub fn process_all_commands<'gc>(
14461451 shadow_offset_x : ctx. shadow_offset_x ,
14471452 shadow_offset_y : ctx. shadow_offset_y ,
14481453 composite_operation : ctx. composite_operation ,
1454+ clip_path : None ,
14491455 } ,
14501456 ctx. line_width ,
14511457 ) ;
@@ -1483,6 +1489,7 @@ pub fn process_all_commands<'gc>(
14831489 shadow_offset_x : ctx. shadow_offset_x ,
14841490 shadow_offset_y : ctx. shadow_offset_y ,
14851491 composite_operation : ctx. composite_operation ,
1492+ clip_path : None ,
14861493 } ,
14871494 ) ;
14881495 }
@@ -1528,6 +1535,7 @@ pub fn process_all_commands<'gc>(
15281535 shadow_offset_x : ctx. shadow_offset_x ,
15291536 shadow_offset_y : ctx. shadow_offset_y ,
15301537 composite_operation : ctx. composite_operation ,
1538+ clip_path : None ,
15311539 } ,
15321540 ctx. line_width ,
15331541 ) ;
@@ -1575,6 +1583,7 @@ pub fn process_all_commands<'gc>(
15751583 shadow_offset_x : 0.0 ,
15761584 shadow_offset_y : 0.0 ,
15771585 composite_operation : CompositeOperation :: default ( ) ,
1586+ clip_path : None ,
15781587 } ,
15791588 ) ; // White background
15801589 }
@@ -1598,10 +1607,9 @@ pub fn process_all_commands<'gc>(
15981607 // Update stroke style
15991608 // Note: The actual style change is handled by the renderer
16001609 }
1601- CanvasCommand :: Clip { path : _ } => {
1602- // Apply clipping to the current renderer state
1603- // TODO: Implement proper clipping in the renderer
1604- // For now, this is a placeholder that stores the clipping path
1610+ CanvasCommand :: Clip { path } => {
1611+ // Apply clipping to the renderer
1612+ renderer. set_clip_path ( Some ( path. clone ( ) ) ) ;
16051613 }
16061614 CanvasCommand :: CreateLinearGradient { .. }
16071615 | CanvasCommand :: CreateRadialGradient { .. }
@@ -1633,6 +1641,7 @@ pub fn process_all_commands<'gc>(
16331641 shadow_offset_x : ctx. shadow_offset_x ,
16341642 shadow_offset_y : ctx. shadow_offset_y ,
16351643 composite_operation : ctx. composite_operation ,
1644+ clip_path : None ,
16361645 } ;
16371646
16381647 // Render the image
0 commit comments