@@ -1629,7 +1629,7 @@ fn add_rounded_rectangle<Builder: PathBuilder>(
1629
1629
builder. cubic_bezier_to ( points[ 1 ] , points[ 2 ] , points[ 3 ] , attributes) ;
1630
1630
}
1631
1631
builder. line_to ( points[ 4 ] , attributes) ;
1632
- if tl > 0.0 {
1632
+ if tr > 0.0 {
1633
1633
builder. cubic_bezier_to ( points[ 5 ] , points[ 6 ] , points[ 7 ] , attributes) ;
1634
1634
}
1635
1635
builder. line_to ( points[ 8 ] , attributes) ;
@@ -1650,7 +1650,7 @@ fn add_rounded_rectangle<Builder: PathBuilder>(
1650
1650
builder. cubic_bezier_to ( points[ 10 ] , points[ 9 ] , points[ 8 ] , attributes) ;
1651
1651
}
1652
1652
builder. line_to ( points[ 7 ] , attributes) ;
1653
- if tl > 0.0 {
1653
+ if tr > 0.0 {
1654
1654
builder. cubic_bezier_to ( points[ 6 ] , points[ 5 ] , points[ 4 ] , attributes) ;
1655
1655
}
1656
1656
builder. line_to ( points[ 3 ] , attributes) ;
@@ -1803,3 +1803,21 @@ fn straight_line_arc() {
1803
1803
point ( 100.0 , 0.0 ) ,
1804
1804
) ;
1805
1805
}
1806
+
1807
+ #[ test]
1808
+ fn top_right_rounded_rect ( ) {
1809
+ use crate :: { math:: * , Path } ;
1810
+ let mut builder = Path :: builder ( ) ;
1811
+ builder. add_rounded_rectangle (
1812
+ & Box2D :: new ( point ( 0. , 0. ) , point ( 100. , 100. ) ) ,
1813
+ & BorderRadii {
1814
+ top_right : 2. ,
1815
+ ..Default :: default ( )
1816
+ } ,
1817
+ Winding :: Positive ,
1818
+ ) ;
1819
+ let path = builder. build ( ) ;
1820
+ let tr = path. iter ( ) . skip ( 2 ) . next ( ) . unwrap ( ) ;
1821
+ assert_eq ! ( tr. from( ) , point( 98. , 0. ) ) ;
1822
+ assert_eq ! ( tr. to( ) , point( 100. , 2. ) ) ;
1823
+ }
0 commit comments