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

Unified Diff: src/gpu/effects/GrDistanceFieldGeoProc.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.cpp ('k') | src/gpu/effects/GrDitherEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDistanceFieldGeoProc.cpp
diff --git a/src/gpu/effects/GrDistanceFieldGeoProc.cpp b/src/gpu/effects/GrDistanceFieldGeoProc.cpp
index fa05275a329cc46a9d6ca7f531d04e1b15d0bdbc..393a99db570be2aa43e743b6447af93466f3e6d1 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());
}
« no previous file with comments | « src/gpu/effects/GrDisableColorXP.cpp ('k') | src/gpu/effects/GrDitherEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698