diff options
Diffstat (limited to 'src/gpu')
22 files changed, 225 insertions, 320 deletions
diff --git a/src/gpu/GrAAConvexPathRenderer.cpp b/src/gpu/GrAAConvexPathRenderer.cpp index 58a393140a..2d4694cb84 100644 --- a/src/gpu/GrAAConvexPathRenderer.cpp +++ b/src/gpu/GrAAConvexPathRenderer.cpp @@ -668,15 +668,12 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(QuadEdgeEffect); -GrGeometryProcessor* QuadEdgeEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { +GrGeometryProcessor* QuadEdgeEffect::TestCreate(GrProcessorTestData* d) { // Doesn't work without derivative instructions. - return caps.shaderCaps()->shaderDerivativeSupport() ? - QuadEdgeEffect::Create(GrRandomColor(random), - GrTest::TestMatrix(random), - random->nextBool()) : NULL; + return d->fCaps->shaderCaps()->shaderDerivativeSupport() ? + QuadEdgeEffect::Create(GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool()) : NULL; } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/GrDefaultGeoProcFactory.cpp b/src/gpu/GrDefaultGeoProcFactory.cpp index 39efd248ea..48aa813182 100644 --- a/src/gpu/GrDefaultGeoProcFactory.cpp +++ b/src/gpu/GrDefaultGeoProcFactory.cpp @@ -239,28 +239,25 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DefaultGeoProc); -GrGeometryProcessor* DefaultGeoProc::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { +GrGeometryProcessor* DefaultGeoProc::TestCreate(GrProcessorTestData* d) { uint32_t flags = 0; - if (random->nextBool()) { + if (d->fRandom->nextBool()) { flags |= GrDefaultGeoProcFactory::kColor_GPType; } - if (random->nextBool()) { + if (d->fRandom->nextBool()) { flags |= GrDefaultGeoProcFactory::kCoverage_GPType; } - if (random->nextBool()) { + if (d->fRandom->nextBool()) { flags |= GrDefaultGeoProcFactory::kLocalCoord_GPType; } return DefaultGeoProc::Create(flags, - GrRandomColor(random), - GrTest::TestMatrix(random), - GrTest::TestMatrix(random), - random->nextBool(), - random->nextBool(), - GrRandomCoverage(random)); + GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), + GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool(), + d->fRandom->nextBool(), + GrRandomCoverage(d->fRandom)); } const GrGeometryProcessor* GrDefaultGeoProcFactory::Create(uint32_t gpTypeFlags, diff --git a/src/gpu/GrOvalRenderer.cpp b/src/gpu/GrOvalRenderer.cpp index 57e53b69d6..0d7da2ebcf 100644 --- a/src/gpu/GrOvalRenderer.cpp +++ b/src/gpu/GrOvalRenderer.cpp @@ -203,14 +203,11 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(CircleEdgeEffect); -GrGeometryProcessor* CircleEdgeEffect::TestCreate(SkRandom* random, - GrContext* context, - const GrCaps&, - GrTexture* textures[]) { - return CircleEdgeEffect::Create(GrRandomColor(random), - random->nextBool(), - GrTest::TestMatrix(random), - random->nextBool()); +GrGeometryProcessor* CircleEdgeEffect::TestCreate(GrProcessorTestData* d) { + return CircleEdgeEffect::Create(GrRandomColor(d->fRandom), + d->fRandom->nextBool(), + GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool()); } /////////////////////////////////////////////////////////////////////////////// @@ -385,14 +382,11 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(EllipseEdgeEffect); -GrGeometryProcessor* EllipseEdgeEffect::TestCreate(SkRandom* random, - GrContext* context, - const GrCaps&, - GrTexture* textures[]) { - return EllipseEdgeEffect::Create(GrRandomColor(random), - random->nextBool(), - GrTest::TestMatrix(random), - random->nextBool()); +GrGeometryProcessor* EllipseEdgeEffect::TestCreate(GrProcessorTestData* d) { + return EllipseEdgeEffect::Create(GrRandomColor(d->fRandom), + d->fRandom->nextBool(), + GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool()); } /////////////////////////////////////////////////////////////////////////////// @@ -589,14 +583,11 @@ private: GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DIEllipseEdgeEffect); -GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(SkRandom* random, - GrContext* context, - const GrCaps&, - GrTexture* textures[]) { - return DIEllipseEdgeEffect::Create(GrRandomColor(random), - GrTest::TestMatrix(random), - (Mode)(random->nextRangeU(0,2)), - random->nextBool()); +GrGeometryProcessor* DIEllipseEdgeEffect::TestCreate(GrProcessorTestData* d) { + return DIEllipseEdgeEffect::Create(GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), + (Mode)(d->fRandom->nextRangeU(0,2)), + d->fRandom->nextBool()); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrBezierEffect.cpp b/src/gpu/effects/GrBezierEffect.cpp index cdea9d01ff..6f492c76ac 100644 --- a/src/gpu/effects/GrBezierEffect.cpp +++ b/src/gpu/effects/GrBezierEffect.cpp @@ -217,17 +217,15 @@ GrConicEffect::GrConicEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrConicEffect); -GrGeometryProcessor* GrConicEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { +GrGeometryProcessor* GrConicEffect::TestCreate(GrProcessorTestData* d) { GrGeometryProcessor* gp; do { - GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( - random->nextULessThan(kGrProcessorEdgeTypeCnt)); - gp = GrConicEffect::Create(GrRandomColor(random), GrTest::TestMatrix(random), - edgeType, caps, - GrTest::TestMatrix(random), random->nextBool()); + GrPrimitiveEdgeType edgeType = + static_cast<GrPrimitiveEdgeType>( + d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); + gp = GrConicEffect::Create(GrRandomColor(d->fRandom), GrTest::TestMatrix(d->fRandom), + edgeType, *d->fCaps, + GrTest::TestMatrix(d->fRandom), d->fRandom->nextBool()); } while (NULL == gp); return gp; } @@ -427,19 +425,16 @@ GrQuadEffect::GrQuadEffect(GrColor color, const SkMatrix& viewMatrix, uint8_t co GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrQuadEffect); -GrGeometryProcessor* GrQuadEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { +GrGeometryProcessor* GrQuadEffect::TestCreate(GrProcessorTestData* d) { GrGeometryProcessor* gp; do { GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( - random->nextULessThan(kGrProcessorEdgeTypeCnt)); - gp = GrQuadEffect::Create(GrRandomColor(random), - GrTest::TestMatrix(random), - edgeType, caps, - GrTest::TestMatrix(random), - random->nextBool()); + d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); + gp = GrQuadEffect::Create(GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), + edgeType, *d->fCaps, + GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool()); } while (NULL == gp); return gp; } @@ -650,16 +645,14 @@ GrCubicEffect::GrCubicEffect(GrColor color, const SkMatrix& viewMatrix, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrCubicEffect); -GrGeometryProcessor* GrCubicEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { +GrGeometryProcessor* GrCubicEffect::TestCreate(GrProcessorTestData* d) { GrGeometryProcessor* gp; do { - GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( - random->nextULessThan(kGrProcessorEdgeTypeCnt)); - gp = GrCubicEffect::Create(GrRandomColor(random), - GrTest::TestMatrix(random), edgeType, caps); + GrPrimitiveEdgeType edgeType = + static_cast<GrPrimitiveEdgeType>( + d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); + gp = GrCubicEffect::Create(GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), edgeType, *d->fCaps); } while (NULL == gp); return gp; } diff --git a/src/gpu/effects/GrBicubicEffect.cpp b/src/gpu/effects/GrBicubicEffect.cpp index 5d94bd9862..c4ceeba866 100644 --- a/src/gpu/effects/GrBicubicEffect.cpp +++ b/src/gpu/effects/GrBicubicEffect.cpp @@ -180,17 +180,14 @@ void GrBicubicEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrBicubicEffect); -GrFragmentProcessor* GrBicubicEffect::TestCreate(SkRandom* random, - GrContext* context, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; +GrFragmentProcessor* GrBicubicEffect::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; SkScalar coefficients[16]; for (int i = 0; i < 16; i++) { - coefficients[i] = random->nextSScalar1(); + coefficients[i] = d->fRandom->nextSScalar1(); } - return GrBicubicEffect::Create(textures[texIdx], coefficients); + return GrBicubicEffect::Create(d->fTextures[texIdx], coefficients); } ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrBitmapTextGeoProc.cpp b/src/gpu/effects/GrBitmapTextGeoProc.cpp index 2871f86ced..4bfa01644c 100644 --- a/src/gpu/effects/GrBitmapTextGeoProc.cpp +++ b/src/gpu/effects/GrBitmapTextGeoProc.cpp @@ -152,28 +152,23 @@ GrBitmapTextGeoProc::createGLInstance(const GrBatchTracker& bt, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrBitmapTextGeoProc); -GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; +GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode, }; SkShader::TileMode tileModes[] = { - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode : + GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode); GrMaskFormat format; - switch (random->nextULessThan(3)) { - default: - SkFAIL("Incomplete enum\n"); + switch (d->fRandom->nextULessThan(3)) { case 0: format = kA8_GrMaskFormat; break; @@ -185,6 +180,7 @@ GrGeometryProcessor* GrBitmapTextGeoProc::TestCreate(SkRandom* random, break; } - return GrBitmapTextGeoProc::Create(GrRandomColor(random), textures[texIdx], params, - format, GrTest::TestMatrix(random), random->nextBool()); + return GrBitmapTextGeoProc::Create(GrRandomColor(d->fRandom), d->fTextures[texIdx], params, + format, GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool()); } diff --git a/src/gpu/effects/GrConfigConversionEffect.cpp b/src/gpu/effects/GrConfigConversionEffect.cpp index d5b8a18e88..8b072f627b 100644 --- a/src/gpu/effects/GrConfigConversionEffect.cpp +++ b/src/gpu/effects/GrConfigConversionEffect.cpp @@ -128,22 +128,19 @@ void GrConfigConversionEffect::onComputeInvariantOutput(GrInvariantOutput* inout GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConfigConversionEffect); -GrFragmentProcessor* GrConfigConversionEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - PMConversion pmConv = static_cast<PMConversion>(random->nextULessThan(kPMConversionCnt)); +GrFragmentProcessor* GrConfigConversionEffect::TestCreate(GrProcessorTestData* d) { + PMConversion pmConv = static_cast<PMConversion>(d->fRandom->nextULessThan(kPMConversionCnt)); bool swapRB; if (kNone_PMConversion == pmConv) { swapRB = true; } else { - swapRB = random->nextBool(); + swapRB = d->fRandom->nextBool(); } return SkNEW_ARGS(GrConfigConversionEffect, - (textures[GrProcessorUnitTest::kSkiaPMTextureIdx], + (d->fTextures[GrProcessorUnitTest::kSkiaPMTextureIdx], swapRB, pmConv, - GrTest::TestMatrix(random))); + GrTest::TestMatrix(d->fRandom))); } /////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrConstColorProcessor.cpp b/src/gpu/effects/GrConstColorProcessor.cpp index e80e06a4a6..964e85c708 100644 --- a/src/gpu/effects/GrConstColorProcessor.cpp +++ b/src/gpu/effects/GrConstColorProcessor.cpp @@ -105,18 +105,15 @@ bool GrConstColorProcessor::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConstColorProcessor); -GrFragmentProcessor* GrConstColorProcessor::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture*[]) { +GrFragmentProcessor* GrConstColorProcessor::TestCreate(GrProcessorTestData* d) { GrColor color; - int colorPicker = random->nextULessThan(3); + int colorPicker = d->fRandom->nextULessThan(3); switch (colorPicker) { case 0: { - uint32_t a = random->nextULessThan(0x100); - uint32_t r = random->nextULessThan(a+1); - uint32_t g = random->nextULessThan(a+1); - uint32_t b = random->nextULessThan(a+1); + uint32_t a = d->fRandom->nextULessThan(0x100); + uint32_t r = d->fRandom->nextULessThan(a+1); + uint32_t g = d->fRandom->nextULessThan(a+1); + uint32_t b = d->fRandom->nextULessThan(a+1); color = GrColorPackRGBA(r, g, b, a); break; } @@ -124,10 +121,10 @@ GrFragmentProcessor* GrConstColorProcessor::TestCreate(SkRandom* random, color = 0; break; case 2: - color = random->nextULessThan(0x100); + color = d->fRandom->nextULessThan(0x100); color = color | (color << 8) | (color << 16) | (color << 24); break; } - InputMode mode = static_cast<InputMode>(random->nextULessThan(kInputModeCnt)); + InputMode mode = static_cast<InputMode>(d->fRandom->nextULessThan(kInputModeCnt)); return GrConstColorProcessor::Create(color, mode); } diff --git a/src/gpu/effects/GrConvexPolyEffect.cpp b/src/gpu/effects/GrConvexPolyEffect.cpp index c42ac5326c..a3d032f4a0 100644 --- a/src/gpu/effects/GrConvexPolyEffect.cpp +++ b/src/gpu/effects/GrConvexPolyEffect.cpp @@ -60,18 +60,15 @@ private: GR_DEFINE_FRAGMENT_PROCESSOR_TEST(AARectEffect); -GrFragmentProcessor* AARectEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { - SkRect rect = SkRect::MakeLTRB(random->nextSScalar1(), - random->nextSScalar1(), - random->nextSScalar1(), - random->nextSScalar1()); +GrFragmentProcessor* AARectEffect::TestCreate(GrProcessorTestData* d) { + SkRect rect = SkRect::MakeLTRB(d->fRandom->nextSScalar1(), + d->fRandom->nextSScalar1(), + d->fRandom->nextSScalar1(), + d->fRandom->nextSScalar1()); GrFragmentProcessor* fp; do { - GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>(random->nextULessThan( - kGrProcessorEdgeTypeCnt)); + GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( + d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); fp = AARectEffect::Create(edgeType, rect); } while (NULL == fp); @@ -360,20 +357,17 @@ bool GrConvexPolyEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvexPolyEffect); -GrFragmentProcessor* GrConvexPolyEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { - int count = random->nextULessThan(kMaxEdges) + 1; +GrFragmentProcessor* GrConvexPolyEffect::TestCreate(GrProcessorTestData* d) { + int count = d->fRandom->nextULessThan(kMaxEdges) + 1; SkScalar edges[kMaxEdges * 3]; for (int i = 0; i < 3 * count; ++i) { - edges[i] = random->nextSScalar1(); + edges[i] = d->fRandom->nextSScalar1(); } GrFragmentProcessor* fp; do { GrPrimitiveEdgeType edgeType = static_cast<GrPrimitiveEdgeType>( - random->nextULessThan(kGrProcessorEdgeTypeCnt)); + d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt)); fp = GrConvexPolyEffect::Create(edgeType, count, edges); } while (NULL == fp); return fp; diff --git a/src/gpu/effects/GrConvolutionEffect.cpp b/src/gpu/effects/GrConvolutionEffect.cpp index 0dfc3bf54e..9f3c6c1170 100644 --- a/src/gpu/effects/GrConvolutionEffect.cpp +++ b/src/gpu/effects/GrConvolutionEffect.cpp @@ -224,25 +224,22 @@ bool GrConvolutionEffect::onIsEqual(const GrFragmentProcessor& sBase) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrConvolutionEffect); -GrFragmentProcessor* GrConvolutionEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; - Direction dir = random->nextBool() ? kX_Direction : kY_Direction; - int radius = random->nextRangeU(1, kMaxKernelRadius); +GrFragmentProcessor* GrConvolutionEffect::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; + Direction dir = d->fRandom->nextBool() ? kX_Direction : kY_Direction; + int radius = d->fRandom->nextRangeU(1, kMaxKernelRadius); float kernel[kMaxKernelWidth]; for (size_t i = 0; i < SK_ARRAY_COUNT(kernel); ++i) { - kernel[i] = random->nextSScalar1(); + kernel[i] = d->fRandom->nextSScalar1(); } float bounds[2]; for (size_t i = 0; i < SK_ARRAY_COUNT(bounds); ++i) { - bounds[i] = random->nextF(); + bounds[i] = d->fRandom->nextF(); } - bool useBounds = random->nextBool(); - return GrConvolutionEffect::Create(textures[texIdx], + bool useBounds = d->fRandom->nextBool(); + return GrConvolutionEffect::Create(d->fTextures[texIdx], dir, radius, kernel, diff --git a/src/gpu/effects/GrCoverageSetOpXP.cpp b/src/gpu/effects/GrCoverageSetOpXP.cpp index c732098679..d7f4347b08 100644 --- a/src/gpu/effects/GrCoverageSetOpXP.cpp +++ b/src/gpu/effects/GrCoverageSetOpXP.cpp @@ -245,12 +245,9 @@ void GrCoverageSetOpXPFactory::getInvariantBlendedColor(const GrProcOptInfo& col GR_DEFINE_XP_FACTORY_TEST(GrCoverageSetOpXPFactory); -GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture*[]) { - SkRegion::Op regionOp = SkRegion::Op(random->nextULessThan(SkRegion::kLastOp + 1)); - bool invertCoverage = random->nextBool(); +GrXPFactory* GrCoverageSetOpXPFactory::TestCreate(GrProcessorTestData* d) { + SkRegion::Op regionOp = SkRegion::Op(d->fRandom->nextULessThan(SkRegion::kLastOp + 1)); + bool invertCoverage = d->fRandom->nextBool(); return GrCoverageSetOpXPFactory::Create(regionOp, invertCoverage); } diff --git a/src/gpu/effects/GrCustomXfermode.cpp b/src/gpu/effects/GrCustomXfermode.cpp index 94d50f684e..c1ff3af1ed 100644 --- a/src/gpu/effects/GrCustomXfermode.cpp +++ b/src/gpu/effects/GrCustomXfermode.cpp @@ -509,15 +509,11 @@ void GrCustomXferFP::onComputeInvariantOutput(GrInvariantOutput* inout) const { } GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrCustomXferFP); -GrFragmentProcessor* GrCustomXferFP::TestCreate(SkRandom* rand, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode); - - GrShaderDataManager shaderDataManager; - return SkNEW_ARGS(GrCustomXferFP, (&shaderDataManager, static_cast<SkXfermode::Mode>(mode), - textures[0])); +GrFragmentProcessor* GrCustomXferFP::TestCreate(GrProcessorTestData* d) { + int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode); + + return SkNEW_ARGS(GrCustomXferFP, (d->fShaderDataManager, static_cast<SkXfermode::Mode>(mode), + d->fTextures[0])); } /////////////////////////////////////////////////////////////////////////////// @@ -817,11 +813,9 @@ void GrCustomXPFactory::getInvariantBlendedColor(const GrProcOptInfo& colorPOI, } GR_DEFINE_XP_FACTORY_TEST(GrCustomXPFactory); -GrXPFactory* GrCustomXPFactory::TestCreate(SkRandom* rand, - GrContext*, - const GrCaps&, - GrTexture*[]) { - int mode = rand->nextRangeU(SkXfermode::kLastCoeffMode + 1, SkXfermode::kLastSeparableMode); +GrXPFactory* GrCustomXPFactory::TestCreate(GrProcessorTestData* d) { + int mode = d->fRandom->nextRangeU(SkXfermode::kLastCoeffMode + 1, + SkXfermode::kLastSeparableMode); return SkNEW_ARGS(GrCustomXPFactory, (static_cast<SkXfermode::Mode>(mode))); } diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index 063bfd1352..26a2506b83 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -957,14 +957,11 @@ DashingCircleEffect::DashingCircleEffect(GrColor color, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingCircleEffect); -GrGeometryProcessor* DashingCircleEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { - DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAModeCount)); - return DashingCircleEffect::Create(GrRandomColor(random), - aaMode, GrTest::TestMatrix(random), - random->nextBool()); +GrGeometryProcessor* DashingCircleEffect::TestCreate(GrProcessorTestData* d) { + DashAAMode aaMode = static_cast<DashAAMode>(d->fRandom->nextULessThan(kDashAAModeCount)); + return DashingCircleEffect::Create(GrRandomColor(d->fRandom), + aaMode, GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool()); } ////////////////////////////////////////////////////////////////////////////// @@ -1195,13 +1192,11 @@ DashingLineEffect::DashingLineEffect(GrColor color, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(DashingLineEffect); -GrGeometryProcessor* DashingLineEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { - DashAAMode aaMode = static_cast<DashAAMode>(random->nextULessThan(kDashAAModeCount)); - return DashingLineEffect::Create(GrRandomColor(random), - aaMode, GrTest::TestMatrix(random), random->nextBool()); +GrGeometryProcessor* DashingLineEffect::TestCreate(GrProcessorTestData* d) { + DashAAMode aaMode = static_cast<DashAAMode>(d->fRandom->nextULessThan(kDashAAModeCount)); + return DashingLineEffect::Create(GrRandomColor(d->fRandom), + aaMode, GrTest::TestMatrix(d->fRandom), + d->fRandom->nextBool()); } ////////////////////////////////////////////////////////////////////////////// diff --git a/src/gpu/effects/GrDisableColorXP.cpp b/src/gpu/effects/GrDisableColorXP.cpp index e3f588ad65..31d58490e9 100644 --- a/src/gpu/effects/GrDisableColorXP.cpp +++ b/src/gpu/effects/GrDisableColorXP.cpp @@ -108,10 +108,7 @@ GrDisableColorXPFactory::onCreateXferProcessor(const GrCaps& caps, GR_DEFINE_XP_FACTORY_TEST(GrDisableColorXPFactory); -GrXPFactory* GrDisableColorXPFactory::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture*[]) { +GrXPFactory* GrDisableColorXPFactory::TestCreate(GrProcessorTestData*) { return GrDisableColorXPFactory::Create(); } diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp index fa05275a32..393a99db57 100755 --- a/src/gpu/effects/GrDistanceFieldGeoProc.cpp +++ b/src/gpu/effects/GrDistanceFieldGeoProc.cpp @@ -239,33 +239,30 @@ GrDistanceFieldA8TextGeoProc::createGLInstance(const GrBatchTracker& bt, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldA8TextGeoProc); -GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; +GrGeometryProcessor* GrDistanceFieldA8TextGeoProc::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode, }; SkShader::TileMode tileModes[] = { - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode : + GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode); - return GrDistanceFieldA8TextGeoProc::Create(GrRandomColor(random), - GrTest::TestMatrix(random), - textures[texIdx], params, + return GrDistanceFieldA8TextGeoProc::Create(GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), + d->fTextures[texIdx], params, #ifdef SK_GAMMA_APPLY_TO_A8 - random->nextF(), + d->fRandom->nextF(), #endif - random->nextBool() ? + d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0, - random->nextBool()); + d->fRandom->nextBool()); } /////////////////////////////////////////////////////////////////////////////// @@ -465,31 +462,28 @@ GrDistanceFieldPathGeoProc::createGLInstance(const GrBatchTracker& bt, const GrG GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldPathGeoProc); -GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx - : GrProcessorUnitTest::kAlphaTextureIdx; +GrGeometryProcessor* GrDistanceFieldPathGeoProc::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx + : GrProcessorUnitTest::kAlphaTextureIdx; static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode, }; SkShader::TileMode tileModes[] = { - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode - : GrTextureParams::kNone_FilterMode); + GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode + : GrTextureParams::kNone_FilterMode); - return GrDistanceFieldPathGeoProc::Create(GrRandomColor(random), - GrTest::TestMatrix(random), - textures[texIdx], + return GrDistanceFieldPathGeoProc::Create(GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), + d->fTextures[texIdx], params, - random->nextBool() ? + d->fRandom->nextBool() ? kSimilarity_DistanceFieldEffectFlag : 0, - random->nextBool()); + d->fRandom->nextBool()); } /////////////////////////////////////////////////////////////////////////////// @@ -725,31 +719,28 @@ GrDistanceFieldLCDTextGeoProc::createGLInstance(const GrBatchTracker& bt, GR_DEFINE_GEOMETRY_PROCESSOR_TEST(GrDistanceFieldLCDTextGeoProc); -GrGeometryProcessor* GrDistanceFieldLCDTextGeoProc::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; +GrGeometryProcessor* GrDistanceFieldLCDTextGeoProc::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode, }; SkShader::TileMode tileModes[] = { - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode : + GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : GrTextureParams::kNone_FilterMode); DistanceAdjust wa = { 0.0f, 0.1f, -0.1f }; uint32_t flags = kUseLCD_DistanceFieldEffectFlag; - flags |= random->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; - flags |= random->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; - return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(random), - GrTest::TestMatrix(random), - textures[texIdx], params, + flags |= d->fRandom->nextBool() ? kUniformScale_DistanceFieldEffectMask : 0; + flags |= d->fRandom->nextBool() ? kBGR_DistanceFieldEffectFlag : 0; + return GrDistanceFieldLCDTextGeoProc::Create(GrRandomColor(d->fRandom), + GrTest::TestMatrix(d->fRandom), + d->fTextures[texIdx], params, wa, flags, - random->nextBool()); + d->fRandom->nextBool()); } diff --git a/src/gpu/effects/GrDitherEffect.cpp b/src/gpu/effects/GrDitherEffect.cpp index 0c252321ac..eb8466b0b5 100644 --- a/src/gpu/effects/GrDitherEffect.cpp +++ b/src/gpu/effects/GrDitherEffect.cpp @@ -53,10 +53,7 @@ void DitherEffect::onComputeInvariantOutput(GrInvariantOutput* inout) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(DitherEffect); -GrFragmentProcessor* DitherEffect::TestCreate(SkRandom*, - GrContext*, - const GrCaps&, - GrTexture*[]) { +GrFragmentProcessor* DitherEffect::TestCreate(GrProcessorTestData*) { return DitherEffect::Create(); } diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp index 93876adafa..0dd83b4632 100644 --- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp +++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp @@ -236,30 +236,28 @@ GrMatrixConvolutionEffect::CreateGaussian(GrTexture* texture, GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrMatrixConvolutionEffect); -GrFragmentProcessor* GrMatrixConvolutionEffect::TestCreate(SkRandom* random, - GrContext* context, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; - int width = random->nextRangeU(1, MAX_KERNEL_SIZE); - int height = random->nextRangeU(1, MAX_KERNEL_SIZE / width); +GrFragmentProcessor* GrMatrixConvolutionEffect::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; + int width = d->fRandom->nextRangeU(1, MAX_KERNEL_SIZE); + int height = d->fRandom->nextRangeU(1, MAX_KERNEL_SIZE / width); SkISize kernelSize = SkISize::Make(width, height); SkAutoTDeleteArray<SkScalar> kernel(new SkScalar[width * height]); for (int i = 0; i < width * height; i++) { - kernel.get()[i] = random->nextSScalar1(); + kernel.get()[i] = d->fRandom->nextSScalar1(); } - SkScalar gain = random->nextSScalar1(); - SkScalar bias = random->nextSScalar1(); - SkIPoint kernelOffset = SkIPoint::Make(random->nextRangeU(0, kernelSize.width()), - random->nextRangeU(0, kernelSize.height())); - SkIRect bounds = SkIRect::MakeXYWH(random->nextRangeU(0, textures[texIdx]->width()), - random->nextRangeU(0, textures[texIdx]->height()), - random->nextRangeU(0, textures[texIdx]->width()), - random->nextRangeU(0, textures[texIdx]->height())); - GrTextureDomain::Mode tileMode = static_cast<GrTextureDomain::Mode>(random->nextRangeU(0, 2)); - bool convolveAlpha = random->nextBool(); - return GrMatrixConvolutionEffect::Create(textures[texIdx], + SkScalar gain = d->fRandom->nextSScalar1(); + SkScalar bias = d->fRandom->nextSScalar1(); + SkIPoint kernelOffset = SkIPoint::Make(d->fRandom->nextRangeU(0, kernelSize.width()), + d->fRandom->nextRangeU(0, kernelSize.height())); + SkIRect bounds = SkIRect::MakeXYWH(d->fRandom->nextRangeU(0, d->fTextures[texIdx]->width()), + d->fRandom->nextRangeU(0, d->fTextures[texIdx]->height()), + d->fRandom->nextRangeU(0, d->fTextures[texIdx]->width()), + d->fRandom->nextRangeU(0, d->fTextures[texIdx]->height())); + GrTextureDomain::Mode tileMode = + static_cast<GrTextureDomain::Mode>(d->fRandom->nextRangeU(0, 2)); + bool convolveAlpha = d->fRandom->nextBool(); + return GrMatrixConvolutionEffect::Create(d->fTextures[texIdx], bounds, kernelSize, kernel.get(), diff --git a/src/gpu/effects/GrOvalEffect.cpp b/src/gpu/effects/GrOvalEffect.cpp index 7b9fd0a7c8..1b6df12790 100644 --- a/src/gpu/effects/GrOvalEffect.cpp +++ b/src/gpu/effects/GrOvalEffect.cpp @@ -75,17 +75,14 @@ bool CircleEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircleEffect); -GrFragmentProcessor* CircleEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { +GrFragmentProcessor* CircleEffect::TestCreate(GrProcessorTestData* d) { SkPoint center; - center.fX = random->nextRangeScalar(0.f, 1000.f); - center.fY = random->nextRangeScalar(0.f, 1000.f); - SkScalar radius = random->nextRangeF(0.f, 1000.f); + center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f); + center.fY = d->fRandom->nextRangeScalar(0.f, 1000.f); + SkScalar radius = d->fRandom->nextRangeF(0.f, 1000.f); GrPrimitiveEdgeType et; do { - et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt); + et = (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt); } while (kHairlineAA_GrProcessorEdgeType == et); return CircleEffect::Create(et, center, radius); } @@ -257,18 +254,15 @@ bool EllipseEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipseEffect); -GrFragmentProcessor* EllipseEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { +GrFragmentProcessor* EllipseEffect::TestCreate(GrProcessorTestData* d) { SkPoint center; - center.fX = random->nextRangeScalar(0.f, 1000.f); - center.fY = random->nextRangeScalar(0.f, 1000.f); - SkScalar rx = random->nextRangeF(0.f, 1000.f); - SkScalar ry = random->nextRangeF(0.f, 1000.f); + center.fX = d->fRandom->nextRangeScalar(0.f, 1000.f); + center.fY = d->fRandom->nextRangeScalar(0.f, 1000.f); + SkScalar rx = d->fRandom->nextRangeF(0.f, 1000.f); + SkScalar ry = d->fRandom->nextRangeF(0.f, 1000.f); GrPrimitiveEdgeType et; do { - et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt); + et = (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt); } while (kHairlineAA_GrProcessorEdgeType == et); return EllipseEffect::Create(et, center, rx, ry); } diff --git a/src/gpu/effects/GrPorterDuffXferProcessor.cpp b/src/gpu/effects/GrPorterDuffXferProcessor.cpp index 6fc3c93e00..b6b57aefea 100644 --- a/src/gpu/effects/GrPorterDuffXferProcessor.cpp +++ b/src/gpu/effects/GrPorterDuffXferProcessor.cpp @@ -808,11 +808,8 @@ bool GrPorterDuffXPFactory::willReadDstColor(const GrCaps& caps, GR_DEFINE_XP_FACTORY_TEST(GrPorterDuffXPFactory); -GrXPFactory* GrPorterDuffXPFactory::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture*[]) { - SkXfermode::Mode mode = SkXfermode::Mode(random->nextULessThan(SkXfermode::kLastCoeffMode)); +GrXPFactory* GrPorterDuffXPFactory::TestCreate(GrProcessorTestData* d) { + SkXfermode::Mode mode = SkXfermode::Mode(d->fRandom->nextULessThan(SkXfermode::kLastCoeffMode)); return GrPorterDuffXPFactory::Create(mode); } diff --git a/src/gpu/effects/GrRRectEffect.cpp b/src/gpu/effects/GrRRectEffect.cpp index 0db9c13e38..a31e89ce3e 100644 --- a/src/gpu/effects/GrRRectEffect.cpp +++ b/src/gpu/effects/GrRRectEffect.cpp @@ -107,19 +107,16 @@ bool CircularRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(CircularRRectEffect); -GrFragmentProcessor* CircularRRectEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { - SkScalar w = random->nextRangeScalar(20.f, 1000.f); - SkScalar h = random->nextRangeScalar(20.f, 1000.f); - SkScalar r = random->nextRangeF(kRadiusMin, 9.f); +GrFragmentProcessor* CircularRRectEffect::TestCreate(GrProcessorTestData* d) { + SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); + SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); + SkScalar r = d->fRandom->nextRangeF(kRadiusMin, 9.f); SkRRect rrect; rrect.setRectXY(SkRect::MakeWH(w, h), r, r); GrFragmentProcessor* fp; do { GrPrimitiveEdgeType et = - (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt); + (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt); fp = GrRRectEffect::Create(et, rrect); } while (NULL == fp); return fp; @@ -444,24 +441,21 @@ bool EllipticalRRectEffect::onIsEqual(const GrFragmentProcessor& other) const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(EllipticalRRectEffect); -GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps& caps, - GrTexture*[]) { - SkScalar w = random->nextRangeScalar(20.f, 1000.f); - SkScalar h = random->nextRangeScalar(20.f, 1000.f); +GrFragmentProcessor* EllipticalRRectEffect::TestCreate(GrProcessorTestData* d) { + SkScalar w = d->fRandom->nextRangeScalar(20.f, 1000.f); + SkScalar h = d->fRandom->nextRangeScalar(20.f, 1000.f); SkVector r[4]; - r[SkRRect::kUpperLeft_Corner].fX = random->nextRangeF(kRadiusMin, 9.f); + r[SkRRect::kUpperLeft_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9.f); // ensure at least one corner really is elliptical do { - r[SkRRect::kUpperLeft_Corner].fY = random->nextRangeF(kRadiusMin, 9.f); + r[SkRRect::kUpperLeft_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9.f); } while (r[SkRRect::kUpperLeft_Corner].fY == r[SkRRect::kUpperLeft_Corner].fX); SkRRect rrect; - if (random->nextBool()) { + if (d->fRandom->nextBool()) { // half the time create a four-radii rrect. - r[SkRRect::kLowerRight_Corner].fX = random->nextRangeF(kRadiusMin, 9.f); - r[SkRRect::kLowerRight_Corner].fY = random->nextRangeF(kRadiusMin, 9.f); + r[SkRRect::kLowerRight_Corner].fX = d->fRandom->nextRangeF(kRadiusMin, 9.f); + r[SkRRect::kLowerRight_Corner].fY = d->fRandom->nextRangeF(kRadiusMin, 9.f); r[SkRRect::kUpperRight_Corner].fX = r[SkRRect::kLowerRight_Corner].fX; r[SkRRect::kUpperRight_Corner].fY = r[SkRRect::kUpperLeft_Corner].fY; @@ -476,7 +470,8 @@ GrFragmentProcessor* EllipticalRRectEffect::TestCreate(SkRandom* random, } GrFragmentProcessor* fp; do { - GrPrimitiveEdgeType et = (GrPrimitiveEdgeType)random->nextULessThan(kGrProcessorEdgeTypeCnt); + GrPrimitiveEdgeType et = + (GrPrimitiveEdgeType)d->fRandom->nextULessThan(kGrProcessorEdgeTypeCnt); fp = GrRRectEffect::Create(et, rrect); } while (NULL == fp); return fp; diff --git a/src/gpu/effects/GrSimpleTextureEffect.cpp b/src/gpu/effects/GrSimpleTextureEffect.cpp index 370b2ce9a9..0f6f4032a4 100644 --- a/src/gpu/effects/GrSimpleTextureEffect.cpp +++ b/src/gpu/effects/GrSimpleTextureEffect.cpp @@ -55,30 +55,27 @@ GrGLFragmentProcessor* GrSimpleTextureEffect::createGLInstance() const { GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrSimpleTextureEffect); -GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; +GrFragmentProcessor* GrSimpleTextureEffect::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; static const SkShader::TileMode kTileModes[] = { SkShader::kClamp_TileMode, SkShader::kRepeat_TileMode, SkShader::kMirror_TileMode, }; SkShader::TileMode tileModes[] = { - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], - kTileModes[random->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], + kTileModes[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kTileModes))], }; - GrTextureParams params(tileModes, random->nextBool() ? GrTextureParams::kBilerp_FilterMode : - GrTextureParams::kNone_FilterMode); + GrTextureParams params(tileModes, d->fRandom->nextBool() ? GrTextureParams::kBilerp_FilterMode : + GrTextureParams::kNone_FilterMode); static const GrCoordSet kCoordSets[] = { kLocal_GrCoordSet, kDevice_GrCoordSet }; - GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoordSets))]; + GrCoordSet coordSet = kCoordSets[d->fRandom->nextULessThan(SK_ARRAY_COUNT(kCoordSets))]; - const SkMatrix& matrix = GrTest::TestMatrix(random); - return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); + const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); + return GrSimpleTextureEffect::Create(d->fTextures[texIdx], matrix, coordSet); } diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp index 7ac3a18996..31f51aad22 100644 --- a/src/gpu/effects/GrTextureDomain.cpp +++ b/src/gpu/effects/GrTextureDomain.cpp @@ -286,23 +286,20 @@ void GrTextureDomainEffect::onComputeInvariantOutput(GrInvariantOutput* inout) c GR_DEFINE_FRAGMENT_PROCESSOR_TEST(GrTextureDomainEffect); -GrFragmentProcessor* GrTextureDomainEffect::TestCreate(SkRandom* random, - GrContext*, - const GrCaps&, - GrTexture* textures[]) { - int texIdx = random->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : - GrProcessorUnitTest::kAlphaTextureIdx; +GrFragmentProcessor* GrTextureDomainEffect::TestCreate(GrProcessorTestData* d) { + int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx : + GrProcessorUnitTest::kAlphaTextureIdx; SkRect domain; - domain.fLeft = random->nextUScalar1(); - domain.fRight = random->nextRangeScalar(domain.fLeft, SK_Scalar1); - domain.fTop = random->nextUScalar1(); - domain.fBottom = random->nextRangeScalar(domain.fTop, SK_Scalar1); + domain.fLeft = d->fRandom->nextUScalar1(); + domain.fRight = d->fRandom->nextRangeScalar(domain.fLeft, SK_Scalar1); + domain.fTop = d->fRandom->nextUScalar1(); + domain.fBottom = d->fRandom->nextRangeScalar(domain.fTop, SK_Scalar1); GrTextureDomain::Mode mode = - (GrTextureDomain::Mode) random->nextULessThan(GrTextureDomain::kModeCount); - const SkMatrix& matrix = GrTest::TestMatrix(random); - bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? random->nextBool() : false; - GrCoordSet coords = random->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoordSet; - return GrTextureDomainEffect::Create(textures[texIdx], + (GrTextureDomain::Mode) d->fRandom->nextULessThan(GrTextureDomain::kModeCount); + const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom); + bool bilerp = mode != GrTextureDomain::kRepeat_Mode ? d->fRandom->nextBool() : false; + GrCoordSet coords = d->fRandom->nextBool() ? kLocal_GrCoordSet : kDevice_GrCoordSet; + return GrTextureDomainEffect::Create(d->fTextures[texIdx], matrix, domain, mode, |