OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "GrRRectEffect.h" | 8 #include "GrRRectEffect.h" |
9 | 9 |
10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
651 } | 651 } |
652 cornerFlags = CircularRRectEffect::kAll_CornerFlags; | 652 cornerFlags = CircularRRectEffect::kAll_CornerFlags; |
653 } else { | 653 } else { |
654 if (rrect.getSimpleRadii().fX < EllipticalRRectEffect::kRadiusMin || | 654 if (rrect.getSimpleRadii().fX < EllipticalRRectEffect::kRadiusMin || |
655 rrect.getSimpleRadii().fY < EllipticalRRectEffect::kRadiusMin) { | 655 rrect.getSimpleRadii().fY < EllipticalRRectEffect::kRadiusMin) { |
656 return NULL; | 656 return NULL; |
657 } | 657 } |
658 return EllipticalRRectEffect::Create(edgeType, | 658 return EllipticalRRectEffect::Create(edgeType, |
659 EllipticalRRectEffect::kSimple_
RRectType, rrect); | 659 EllipticalRRectEffect::kSimple_
RRectType, rrect); |
660 } | 660 } |
661 } else if (rrect.isComplex()) { | 661 } else if (rrect.isComplex() || rrect.isNinePatch()) { |
662 // Check for the "tab" cases - two adjacent circular corners and two squ
are corners. | 662 // Check for the "tab" cases - two adjacent circular corners and two squ
are corners. |
663 SkScalar radius = 0; | 663 SkScalar radius = 0; |
664 cornerFlags = 0; | 664 cornerFlags = 0; |
665 for (int c = 0; c < 4; ++c) { | 665 for (int c = 0; c < 4; ++c) { |
666 const SkVector& r = rrect.radii((SkRRect::Corner)c); | 666 const SkVector& r = rrect.radii((SkRRect::Corner)c); |
667 SkASSERT((0 == r.fX) == (0 == r.fY)); | 667 SkASSERT((0 == r.fX) == (0 == r.fY)); |
668 if (0 == r.fX) { | 668 if (0 == r.fX) { |
669 continue; | 669 continue; |
670 } | 670 } |
671 if (r.fX != r.fY) { | 671 if (r.fX != r.fY) { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 rrect); | 712 rrect); |
713 } | 713 } |
714 } | 714 } |
715 return NULL; | 715 return NULL; |
716 } | 716 } |
717 } else { | 717 } else { |
718 return NULL; | 718 return NULL; |
719 } | 719 } |
720 return CircularRRectEffect::Create(edgeType, cornerFlags, rrect); | 720 return CircularRRectEffect::Create(edgeType, cornerFlags, rrect); |
721 } | 721 } |
OLD | NEW |