| 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 "SkPathPriv.h" | 10 #include "SkPathPriv.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 GrPrimitiveEdgeType fEdgeType; | 53 GrPrimitiveEdgeType fEdgeType; |
| 54 | 54 |
| 55 typedef GrFragmentProcessor INHERITED; | 55 typedef GrFragmentProcessor INHERITED; |
| 56 | 56 |
| 57 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 57 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
| 58 | 58 |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect); | 61 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect); |
| 62 | 62 |
| 63 const GrFragmentProcessor* AARectEffect::TestCreate(GrProcessorTestData* d) { | 63 GrFragmentProcessor* AARectEffect::TestCreate(GrProcessorTestData* d) { |
| 64 SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(), | 64 SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(), |
| 65 d->fRandom->nextSScalar1(), | 65 d->fRandom->nextSScalar1(), |
| 66 d->fRandom->nextSScalar1(), | 66 d->fRandom->nextSScalar1(), |
| 67 d->fRandom->nextSScalar1()); | 67 d->fRandom->nextSScalar1()); |
| 68 GrFragmentProcessor* fp; | 68 GrFragmentProcessor* fp; |
| 69 do { | 69 do { |
| 70 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 70 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 71 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 71 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 72 | 72 |
| 73 fp = AARectEffect::Create(edgeType, rect); | 73 fp = AARectEffect::Create(edgeType, rect); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 const GrConvexPolyEffect& cpe = other.cast<GrConvexPolyEffect>(); | 332 const GrConvexPolyEffect& cpe = other.cast<GrConvexPolyEffect>(); |
| 333 // ignore the fact that 0 == -0 and just use memcmp. | 333 // ignore the fact that 0 == -0 and just use memcmp. |
| 334 return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount && | 334 return (cpe.fEdgeType == fEdgeType && cpe.fEdgeCount == fEdgeCount && |
| 335 0 == memcmp(cpe.fEdges, fEdges, 3 * fEdgeCount * sizeof(SkScalar))); | 335 0 == memcmp(cpe.fEdges, fEdges, 3 * fEdgeCount * sizeof(SkScalar))); |
| 336 } | 336 } |
| 337 | 337 |
| 338 ////////////////////////////////////////////////////////////////////////////// | 338 ////////////////////////////////////////////////////////////////////////////// |
| 339 | 339 |
| 340 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect); | 340 GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect); |
| 341 | 341 |
| 342 const GrFragmentProcessor* GrConvexPolyEffect::TestCreate(GrProcessorTestData* d
) { | 342 GrFragmentProcessor* GrConvexPolyEffect::TestCreate(GrProcessorTestData* d) { |
| 343 int count = d->fRandom->nextULessThan(kMaxEdges) + 1; | 343 int count = d->fRandom->nextULessThan(kMaxEdges) + 1; |
| 344 SkScalar edges[kMaxEdges * 3]; | 344 SkScalar edges[kMaxEdges * 3]; |
| 345 for (int i = 0; i < 3 * count; ++i) { | 345 for (int i = 0; i < 3 * count; ++i) { |
| 346 edges[i] = d->fRandom->nextSScalar1(); | 346 edges[i] = d->fRandom->nextSScalar1(); |
| 347 } | 347 } |
| 348 | 348 |
| 349 GrFragmentProcessor* fp; | 349 GrFragmentProcessor* fp; |
| 350 do { | 350 do { |
| 351 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( | 351 GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( |
| 352 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); | 352 d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); |
| 353 fp = GrConvexPolyEffect::Create(edgeType, count, edges); | 353 fp = GrConvexPolyEffect::Create(edgeType, count, edges); |
| 354 } while (nullptr == fp); | 354 } while (nullptr == fp); |
| 355 return fp; | 355 return fp; |
| 356 } | 356 } |
| OLD | NEW |