Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: src/gpu/effects/GrOvalEffect.cpp

Issue 1213623022: fix up test create functions (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more cleanup Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 68
69 bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const { 69 bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const {
70 const CircleEffect& ce = other.cast<CircleEffect>(); 70 const CircleEffect& ce = other.cast<CircleEffect>();
71 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f Radius; 71 return fEdgeType == ce.fEdgeType && fCenter == ce.fCenter && fRadius == ce.f Radius;
72 } 72 }
73 73
74 ////////////////////////////////////////////////////////////////////////////// 74 //////////////////////////////////////////////////////////////////////////////
75 75
76 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); 76 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect);
77 77
78 GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random, 78 GrFragmentProcessor* CircleEffect::TestCreate(GrProcessorTestData* d) {
79 GrContext*,
80 const GrCaps& caps,
81 GrTexture*[]) {
82 SkPoint center; 79 SkPoint center;
83 center.fX = random->nextRangeScalar(0.f, 1000.f); 80 center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f);
84 center.fY = random->nextRangeScalar(0.f, 1000.f); 81 center.fY = d->fRandom->nextRangeScalar(0.f, 1000.f);
85 SkScalar radius = random->nextRangeF(0.f, 1000.f); 82 SkScalar radius = d->fRandom->nextRangeF(0.f, 1000.f);
86 GrPrimitiveEdgeType et; 83 GrPrimitiveEdgeType et;
87 do { 84 do {
88 et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt) ; 85 et = (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeType Cnt);
89 } while (kHairlineAA_GrProcessorEdgeType == et); 86 } while (kHairlineAA_GrProcessorEdgeType == et);
90 return CircleEffect::Create(et, center, radius); 87 return CircleEffect::Create(et, center, radius);
91 } 88 }
92 89
93 ////////////////////////////////////////////////////////////////////////////// 90 //////////////////////////////////////////////////////////////////////////////
94 91
95 class GLCircleEffect : public GrGLFragmentProcessor { 92 class GLCircleEffect : public GrGLFragmentProcessor {
96 public: 93 public:
97 GLCircleEffect(const GrProcessor&); 94 GLCircleEffect(const GrProcessor&);
98 95
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 247
251 bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const { 248 bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const {
252 const EllipseEffect& ee = other.cast<EllipseEffect>(); 249 const EllipseEffect& ee = other.cast<EllipseEffect>();
253 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR adii; 250 return fEdgeType == ee.fEdgeType && fCenter == ee.fCenter && fRadii == ee.fR adii;
254 } 251 }
255 252
256 ////////////////////////////////////////////////////////////////////////////// 253 //////////////////////////////////////////////////////////////////////////////
257 254
258 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); 255 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect);
259 256
260 GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random, 257 GrFragmentProcessor* EllipseEffect::TestCreate(GrProcessorTestData* d) {
261 GrContext*,
262 const GrCaps& caps,
263 GrTexture*[]) {
264 SkPoint center; 258 SkPoint center;
265 center.fX = random->nextRangeScalar(0.f, 1000.f); 259 center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f);
266 center.fY = random->nextRangeScalar(0.f, 1000.f); 260 center.fY = d->fRandom->nextRangeScalar(0.f, 1000.f);
267 SkScalar rx = random->nextRangeF(0.f, 1000.f); 261 SkScalar rx = d->fRandom->nextRangeF(0.f, 1000.f);
268 SkScalar ry = random->nextRangeF(0.f, 1000.f); 262 SkScalar ry = d->fRandom->nextRangeF(0.f, 1000.f);
269 GrPrimitiveEdgeType et; 263 GrPrimitiveEdgeType et;
270 do { 264 do {
271 et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt) ; 265 et = (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeType Cnt);
272 } while (kHairlineAA_GrProcessorEdgeType == et); 266 } while (kHairlineAA_GrProcessorEdgeType == et);
273 return EllipseEffect::Create(et, center, rx, ry); 267 return EllipseEffect::Create(et, center, rx, ry);
274 } 268 }
275 269
276 ////////////////////////////////////////////////////////////////////////////// 270 //////////////////////////////////////////////////////////////////////////////
277 271
278 class GLEllipseEffect : public GrGLFragmentProcessor { 272 class GLEllipseEffect : public GrGLFragmentProcessor {
279 public: 273 public:
280 GLEllipseEffect(const GrProcessor&); 274 GLEllipseEffect(const GrProcessor&);
281 275
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 w /= 2; 385 w /= 2;
392 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w); 386 return CircleEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, oval .fTop + w), w);
393 } else { 387 } else {
394 w /= 2; 388 w /= 2;
395 h /= 2; 389 h /= 2;
396 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h); 390 return EllipseEffect::Create(edgeType, SkPoint::Make(oval.fLeft + w, ova l.fTop + h), w, h);
397 } 391 }
398 392
399 return NULL; 393 return NULL;
400 } 394 }
OLDNEW
« no previous file with comments | « src/gpu/effects/GrMatrixConvolutionEffect.cpp ('k') | src/gpu/effects/GrPorterDuffXferProcessor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698