1 /* 2 * Copyright 2018 Google Inc. 3 * 4 * Use of this source code is governed by a BSD-style license that can be 5 * found in the LICENSE file. 6 */ 7 8 #ifndef SkRRectPriv_DEFINED 9 #define SkRRectPriv_DEFINED 10 11 #include "SkRRect.h" 12 13 class SkRRectPriv { 14 public: 15 static bool IsCircle(const SkRRect& rr) { 16 return rr.isOval() && SkScalarNearlyEqual(rr.fRadii[0].fX, rr.fRadii[0].fY); 17 } 18 19 static SkVector GetSimpleRadii(const SkRRect& rr) { 20 SkASSERT(!rr.isComplex()); 21 return rr.fRadii[0]; 22 } 23 24 static bool IsSimpleCircular(const SkRRect& rr) { 25 return rr.isSimple() && SkScalarNearlyEqual(rr.fRadii[0].fX, rr.fRadii[0].fY); 26 } 27 28 static bool EqualRadii(const SkRRect& rr) { 29 return rr.isRect() || SkRRectPriv::IsCircle(rr) || SkRRectPriv::IsSimpleCircular(rr); 30 } 31 32 static bool AllCornersCircular(const SkRRect& rr, SkScalar tolerance = SK_ScalarNearlyZero); 33 }; 34 35 #endif 36 37