Make sure random unit test processors use an alpha type compatible with
texture data.
It'd probably be good to provide an opaque texture that has an alpha
channel and widen the range of color types that are present in the
future.
Change-Id: I5587a479f7e2f3991f8ae27a4cd44afc533324e8
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/260696
Reviewed-by: Michael Ludwig <michaelludwig@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
index 80bc165..9a66a07 100644
--- a/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
+++ b/src/gpu/effects/GrGaussianConvolutionFragmentProcessor.cpp
@@ -280,9 +280,7 @@
#if GR_TEST_UTILS
std::unique_ptr<GrFragmentProcessor> GrGaussianConvolutionFragmentProcessor::TestCreate(
GrProcessorTestData* d) {
- int texIdx = d->fRandom->nextBool() ? GrProcessorUnitTest::kSkiaPMTextureIdx
- : GrProcessorUnitTest::kAlphaTextureIdx;
- sk_sp<GrTextureProxy> proxy = d->textureProxy(texIdx);
+ auto [proxy, ct, at] = d->randomProxy();
int bounds[2];
int modeIdx = d->fRandom->nextRangeU(0, GrTextureDomain::kModeCount-1);
@@ -301,10 +299,8 @@
int radius = d->fRandom->nextRangeU(1, kMaxKernelRadius);
float sigma = radius / 3.f;
- auto alphaType = static_cast<SkAlphaType>(
- d->fRandom->nextRangeU(kUnknown_SkAlphaType + 1, kLastEnum_SkAlphaType));
- return GrGaussianConvolutionFragmentProcessor::Make(
- std::move(proxy), alphaType, dir, radius, sigma,
- static_cast<GrTextureDomain::Mode>(modeIdx), bounds);
+ return GrGaussianConvolutionFragmentProcessor::Make(std::move(proxy), at, dir, radius, sigma,
+ static_cast<GrTextureDomain::Mode>(modeIdx),
+ bounds);
}
#endif