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 "GrConvexPolyEffect.h" | 10 #include "GrConvexPolyEffect.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 // The corner flags are derived from fRRect, so no need to check them. | 103 // The corner flags are derived from fRRect, so no need to check them. |
104 return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect; | 104 return fEdgeType == crre.fEdgeType && fRRect == crre.fRRect; |
105 } | 105 } |
106 | 106 |
107 ////////////////////////////////////////////////////////////////////////////// | 107 ////////////////////////////////////////////////////////////////////////////// |
108 | 108 |
109 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); | 109 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); |
110 | 110 |
111 GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random, | 111 GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random, |
112 GrContext*, | 112 GrContext*, |
113 const GrDrawTargetCaps& cap
s, | 113 const GrCaps& caps, |
114 GrTexture*[]) { | 114 GrTexture*[]) { |
115 SkScalar w = random->nextRangeScalar(20.f, 1000.f); | 115 SkScalar w = random->nextRangeScalar(20.f, 1000.f); |
116 SkScalar h = random->nextRangeScalar(20.f, 1000.f); | 116 SkScalar h = random->nextRangeScalar(20.f, 1000.f); |
117 SkScalar r = random->nextRangeF(kRadiusMin, 9.f); | 117 SkScalar r = random->nextRangeF(kRadiusMin, 9.f); |
118 SkRRect rrect; | 118 SkRRect rrect; |
119 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); | 119 rrect.setRectXY(SkRect::MakeWH(w, h), r, r); |
120 GrFragmentProcessor* fp; | 120 GrFragmentProcessor* fp; |
121 do { | 121 do { |
122 GrPrimitiveEdgeType et = | 122 GrPrimitiveEdgeType et = |
123 (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeC
nt); | 123 (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeC
nt); |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>(); | 440 const EllipticalRRectEffect& erre = other.cast<EllipticalRRectEffect>(); |
441 return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect; | 441 return fEdgeType == erre.fEdgeType && fRRect == erre.fRRect; |
442 } | 442 } |
443 | 443 |
444 ////////////////////////////////////////////////////////////////////////////// | 444 ////////////////////////////////////////////////////////////////////////////// |
445 | 445 |
446 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); | 446 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); |
447 | 447 |
448 GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random, | 448 GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random, |
449 GrContext*, | 449 GrContext*, |
450 const GrDrawTargetCaps& c
aps, | 450 const GrCaps& caps, |
451 GrTexture*[]) { | 451 GrTexture*[]) { |
452 SkScalar w = random->nextRangeScalar(20.f, 1000.f); | 452 SkScalar w = random->nextRangeScalar(20.f, 1000.f); |
453 SkScalar h = random->nextRangeScalar(20.f, 1000.f); | 453 SkScalar h = random->nextRangeScalar(20.f, 1000.f); |
454 SkVector r[4]; | 454 SkVector r[4]; |
455 r[SkRRect::kUpperLeft_Corner].fX = random->nextRangeF(kRadiusMin, 9.f); | 455 r[SkRRect::kUpperLeft_Corner].fX = random->nextRangeF(kRadiusMin, 9.f); |
456 // ensure at least one corner really is elliptical | 456 // ensure at least one corner really is elliptical |
457 do { | 457 do { |
458 r[SkRRect::kUpperLeft_Corner].fY = random->nextRangeF(kRadiusMin, 9.f); | 458 r[SkRRect::kUpperLeft_Corner].fY = random->nextRangeF(kRadiusMin, 9.f); |
459 } while (r[SkRRect::kUpperLeft_Corner].fY == r[SkRRect::kUpperLeft_Corner].f
X); | 459 } while (r[SkRRect::kUpperLeft_Corner].fY == r[SkRRect::kUpperLeft_Corner].f
X); |
460 | 460 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 if (rrect.isNinePatch()) { | 733 if (rrect.isNinePatch()) { |
734 return EllipticalRRectEffect::Create(edgeType, rrect); | 734 return EllipticalRRectEffect::Create(edgeType, rrect); |
735 } | 735 } |
736 return NULL; | 736 return NULL; |
737 } | 737 } |
738 } | 738 } |
739 } | 739 } |
740 | 740 |
741 return NULL; | 741 return NULL; |
742 } | 742 } |
OLD | NEW |