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

Unified Diff: src/gpu/effects/GrMatrixConvolutionEffect.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/GrDitherEffect.cpp ('k') | src/gpu/effects/GrOvalEffect.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrMatrixConvolutionEffect.cpp
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 93876adafab72f711ecd3d33fa70aeba49ded240..0dd83b4632feedcec71195109bd8063d445f461e 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(),
« no previous file with comments | « src/gpu/effects/GrDitherEffect.cpp ('k') | src/gpu/effects/GrOvalEffect.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698