@@ -15,6 +15,7 @@ use util::{lerp, pack_as_float};
1515#[ repr( u8 ) ]
1616#[ derive( Debug , Copy , Clone , PartialEq ) ]
1717pub enum BorderCornerInstance {
18+ None ,
1819 Single , // Single instance needed - corner styles are same or similar.
1920 Double , // Different corner styles. Draw two instances, one per style.
2021}
@@ -128,8 +129,8 @@ impl NormalBorderHelpers for NormalBorder {
128129 corner : BorderCorner ,
129130 border_rect : & LayerRect ,
130131 ) -> BorderCornerKind {
131- // If either width is zero, a corner isn't formed.
132- if width0 == 0.0 || width1 == 0.0 {
132+ // If both widths are zero, a corner isn't formed.
133+ if width0 == 0.0 && width1 == 0.0 {
133134 return BorderCornerKind :: None ;
134135 }
135136
@@ -139,9 +140,13 @@ impl NormalBorderHelpers for NormalBorder {
139140 }
140141
141142 match ( edge0. style , edge1. style ) {
142- // If either edge is none or hidden, no corner is needed.
143- ( BorderStyle :: None , _) | ( _, BorderStyle :: None ) => BorderCornerKind :: None ,
144- ( BorderStyle :: Hidden , _) | ( _, BorderStyle :: Hidden ) => BorderCornerKind :: None ,
143+ // If both edges are none or hidden, no corner is needed.
144+ ( BorderStyle :: None , BorderStyle :: None ) |
145+ ( BorderStyle :: None , BorderStyle :: Hidden ) |
146+ ( BorderStyle :: Hidden , BorderStyle :: None ) |
147+ ( BorderStyle :: Hidden , BorderStyle :: Hidden ) => {
148+ BorderCornerKind :: None
149+ }
145150
146151 // If both borders are solid, we can draw them with a simple rectangle if
147152 // both the colors match and there is no radius.
@@ -429,16 +434,19 @@ impl FrameBuilder {
429434 let mut corner_instances = [ BorderCornerInstance :: Single ; 4 ] ;
430435
431436 for ( i, corner) in corners. iter ( ) . enumerate ( ) {
432- match corner {
433- & BorderCornerKind :: Mask ( corner_data, corner_radius, widths, kind) => {
437+ match * corner {
438+ BorderCornerKind :: Mask ( corner_data, corner_radius, widths, kind) => {
434439 let clip_source =
435440 BorderCornerClipSource :: new ( corner_data, corner_radius, widths, kind) ;
436441 extra_clips. push ( ClipSource :: BorderCorner ( clip_source) ) ;
437442 }
438- & BorderCornerKind :: Clip ( instance_kind) => {
443+ BorderCornerKind :: Clip ( instance_kind) => {
439444 corner_instances[ i] = instance_kind;
440445 }
441- _ => { }
446+ BorderCornerKind :: Solid => { }
447+ BorderCornerKind :: None => {
448+ corner_instances[ i] = BorderCornerInstance :: None ;
449+ }
442450 }
443451 }
444452
0 commit comments