@@ -32,17 +32,20 @@ struct RoundingRadii {
3232 bottom_right.IsFinite ();
3333 }
3434
35- constexpr bool AreAllEmpty () const {
35+ constexpr bool AreAllCornersEmpty () const {
3636 return top_left.IsEmpty () && //
3737 top_right.IsEmpty () && //
3838 bottom_left.IsEmpty () && //
3939 bottom_right.IsEmpty ();
4040 }
4141
42- constexpr bool AreAllSame () const {
43- return top_left == top_right && //
44- top_left == bottom_left && //
45- top_left == bottom_right;
42+ constexpr bool AreAllCornersSame (Scalar tolerance = kEhCloseEnough ) const {
43+ return ScalarNearlyEqual (top_left.width , top_right.width , tolerance) &&
44+ ScalarNearlyEqual (top_left.width , bottom_right.width , tolerance) &&
45+ ScalarNearlyEqual (top_left.width , bottom_left.width , tolerance) &&
46+ ScalarNearlyEqual (top_left.height , top_right.height , tolerance) &&
47+ ScalarNearlyEqual (top_left.height , bottom_right.height , tolerance) &&
48+ ScalarNearlyEqual (top_left.height , bottom_left.height , tolerance);
4649 }
4750
4851 constexpr inline RoundingRadii operator *(Scalar scale) {
@@ -108,11 +111,11 @@ struct RoundRect {
108111 [[nodiscard]] constexpr bool IsEmpty () const { return bounds_.IsEmpty (); }
109112
110113 [[nodiscard]] constexpr bool IsRect () const {
111- return !bounds_.IsEmpty () && radii_.AreAllEmpty ();
114+ return !bounds_.IsEmpty () && radii_.AreAllCornersEmpty ();
112115 }
113116
114117 [[nodiscard]] constexpr bool IsOval () const {
115- return !bounds_.IsEmpty () && radii_.AreAllSame () &&
118+ return !bounds_.IsEmpty () && radii_.AreAllCornersSame () &&
116119 ScalarNearlyEqual (radii_.top_left .width ,
117120 bounds_.GetWidth () * 0 .5f ) &&
118121 ScalarNearlyEqual (radii_.top_left .height ,
0 commit comments