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 "GrOvalEffect.h" | 8 #include "GrOvalEffect.h" |
9 | 9 |
10 #include "GrFragmentProcessor.h" | 10 #include "GrFragmentProcessor.h" |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 const CircleEffect& ce = other.cast<CircleEffect>(); | 71 const CircleEffect& ce = other.cast<CircleEffect>(); |
72 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f
Radius; | 72 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f
Radius; |
73 } | 73 } |
74 | 74 |
75 ////////////////////////////////////////////////////////////////////////////// | 75 ////////////////////////////////////////////////////////////////////////////// |
76 | 76 |
77 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); | 77 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); |
78 | 78 |
79 GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random, | 79 GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random, |
80 GrContext*, | 80 GrContext*, |
81 const GrDrawTargetCaps& caps, | 81 const GrCaps& caps, |
82 GrTexture*[]) { | 82 GrTexture*[]) { |
83 SkPoint center; | 83 SkPoint center; |
84 center.fX = random->nextRangeScalar(0.f, 1000.f); | 84 center.fX = random->nextRangeScalar(0.f, 1000.f); |
85 center.fY = random->nextRangeScalar(0.f, 1000.f); | 85 center.fY = random->nextRangeScalar(0.f, 1000.f); |
86 SkScalar radius = random->nextRangeF(0.f, 1000.f); | 86 SkScalar radius = random->nextRangeF(0.f, 1000.f); |
87 GrPrimitiveEdgeType et; | 87 GrPrimitiveEdgeType et; |
88 do { | 88 do { |
89 et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt)
; | 89 et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt)
; |
90 } while (kHairlineAA_GrProcessorEdgeType == et); | 90 } while (kHairlineAA_GrProcessorEdgeType == et); |
91 return CircleEffect::Create(et, center, radius); | 91 return CircleEffect::Create(et, center, radius); |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
253 const EllipseEffect& ee = other.cast<EllipseEffect>(); | 253 const EllipseEffect& ee = other.cast<EllipseEffect>(); |
254 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR
adii; | 254 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR
adii; |
255 } | 255 } |
256 | 256 |
257 ////////////////////////////////////////////////////////////////////////////// | 257 ////////////////////////////////////////////////////////////////////////////// |
258 | 258 |
259 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); | 259 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); |
260 | 260 |
261 GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random, | 261 GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random, |
262 GrContext*, | 262 GrContext*, |
263 const GrDrawTargetCaps& caps, | 263 const GrCaps& caps, |
264 GrTexture*[]) { | 264 GrTexture*[]) { |
265 SkPoint center; | 265 SkPoint center; |
266 center.fX = random->nextRangeScalar(0.f, 1000.f); | 266 center.fX = random->nextRangeScalar(0.f, 1000.f); |
267 center.fY = random->nextRangeScalar(0.f, 1000.f); | 267 center.fY = random->nextRangeScalar(0.f, 1000.f); |
268 SkScalar rx = random->nextRangeF(0.f, 1000.f); | 268 SkScalar rx = random->nextRangeF(0.f, 1000.f); |
269 SkScalar ry = random->nextRangeF(0.f, 1000.f); | 269 SkScalar ry = random->nextRangeF(0.f, 1000.f); |
270 GrPrimitiveEdgeType et; | 270 GrPrimitiveEdgeType et; |
271 do { | 271 do { |
272 et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt)
; | 272 et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt)
; |
273 } while (kHairlineAA_GrProcessorEdgeType == et); | 273 } while (kHairlineAA_GrProcessorEdgeType == et); |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 w /= 2; | 392 w /= 2; |
393 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); | 393 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval
.fTop + w), w); |
394 } else { | 394 } else { |
395 w /= 2; | 395 w /= 2; |
396 h /= 2; | 396 h /= 2; |
397 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); | 397 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova
l.fTop + h), w, h); |
398 } | 398 } |
399 | 399 |
400 return NULL; | 400 return NULL; |
401 } | 401 } |
OLD | NEW |