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 "GrConvexPolyEffect.h" | 8 #include "GrConvexPolyEffect.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "SkPath.h" | 10 #include "SkPath.h" |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 typedef GrFragmentProcessor INHERITED; | 56 typedef GrFragmentProcessor INHERITED; |
57 | 57 |
58 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 58 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
59 | 59 |
60 }; | 60 }; |
61 | 61 |
62 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect); | 62 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect); |
63 | 63 |
64 GrFragmentProcessor* AARectEffect::TestCreate(SkRandom* random, | 64 GrFragmentProcessor* AARectEffect::TestCreate(SkRandom* random, |
65 GrContext*, | 65 GrContext*, |
66 const GrDrawTargetCaps& caps, | 66 const GrCaps& caps, |
67 GrTexture*[]) { | 67 GrTexture*[]) { |
68 SkRect rect = SkRect::MakeLTRB(random->nextSScalar1(), | 68 SkRect rect = SkRect::MakeLTRB(random->nextSScalar1(), |
69 random->nextSScalar1(), | 69 random->nextSScalar1(), |
70 random->nextSScalar1(), | 70 random->nextSScalar1(), |
71 random->nextSScalar1()); | 71 random->nextSScalar1()); |
72 GrFragmentProcessor* fp; | 72 GrFragmentProcessor* fp; |
73 do { | 73 do { |
74 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(random->
nextULessThan( | 74 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(random->
nextULessThan( |
75 kGrProcessor
EdgeTypeCnt)); | 75 kGrProcessor
EdgeTypeCnt)); |
76 | 76 |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
356 return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount && | 356 return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount && |
357 0 == memcmp(cpe.fEdges, fEdges, 3 * fEdgeCount * sizeof(SkScalar))); | 357 0 == memcmp(cpe.fEdges, fEdges, 3 * fEdgeCount * sizeof(SkScalar))); |
358 } | 358 } |
359 | 359 |
360 ////////////////////////////////////////////////////////////////////////////// | 360 ////////////////////////////////////////////////////////////////////////////// |
361 | 361 |
362 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect); | 362 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect); |
363 | 363 |
364 GrFragmentProcessor* GrConvexPolyEffect::TestCreate(SkRandom* random, | 364 GrFragmentProcessor* GrConvexPolyEffect::TestCreate(SkRandom* random, |
365 GrContext*, | 365 GrContext*, |
366 const GrDrawTargetCaps& caps
, | 366 const GrCaps& caps, |
367 GrTexture*[]) { | 367 GrTexture*[]) { |
368 int count = random->nextULessThan(kMaxEdges) + 1; | 368 int count = random->nextULessThan(kMaxEdges) + 1; |
369 SkScalar edges[kMaxEdges * 3]; | 369 SkScalar edges[kMaxEdges * 3]; |
370 for (int i = 0; i < 3 * count; ++i) { | 370 for (int i = 0; i < 3 * count; ++i) { |
371 edges[i] = random->nextSScalar1(); | 371 edges[i] = random->nextSScalar1(); |
372 } | 372 } |
373 | 373 |
374 GrFragmentProcessor* fp; | 374 GrFragmentProcessor* fp; |
375 do { | 375 do { |
376 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 376 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
377 random->nextULessThan(kGrProcessorEdgeTy
peCnt)); | 377 random->nextULessThan(kGrProcessorEdgeTy
peCnt)); |
378 fp = GrConvexPolyEffect::Create(edgeType, count, edges); | 378 fp = GrConvexPolyEffect::Create(edgeType, count, edges); |
379 } while (NULL == fp); | 379 } while (NULL == fp); |
380 return fp; | 380 return fp; |
381 } | 381 } |
OLD | NEW |