Reland "Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType"""
This is a reland of 997b37fdb986b45ff9941319b0111b188e749cfc
Layout tests have been suppressed.
Original change's description:
> Revert "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
>
> This reverts commit 078e8faa26d8b1f33a92e57f587be011150d1776.
>
> Change-Id: I67b2970584db5a1afbf9928b77c5444947ef71a3
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255897
> Reviewed-by: Brian Salomon <bsalomon@google.com>
> Commit-Queue: Brian Salomon <bsalomon@google.com>
Change-Id: I6db4cff8b71ef1f29ac47f7729b9514d009f730a
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256225
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Salomon <bsalomon@google.com>
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 8bb662b..10fa17f 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -252,41 +252,40 @@
std::unique_ptr<GrFragmentProcessor> GrTextureDomainEffect::Make(
sk_sp<GrTextureProxy> proxy,
- GrColorType srcColorType,
+ SkAlphaType srcAlphaType,
const SkMatrix& matrix,
const SkRect& domain,
GrTextureDomain::Mode mode,
GrSamplerState::Filter filterMode) {
- return Make(std::move(proxy), srcColorType, matrix, domain, mode, mode,
+ return Make(std::move(proxy), srcAlphaType, matrix, domain, mode, mode,
GrSamplerState(GrSamplerState::WrapMode::kClamp, filterMode));
}
-std::unique_ptr<GrFragmentProcessor> GrTextureDomainEffect::Make(
- sk_sp<GrTextureProxy> proxy,
- GrColorType srcColorType,
- const SkMatrix& matrix,
- const SkRect& domain,
- GrTextureDomain::Mode modeX,
- GrTextureDomain::Mode modeY,
- const GrSamplerState& sampler) {
+std::unique_ptr<GrFragmentProcessor> GrTextureDomainEffect::Make(sk_sp<GrTextureProxy> proxy,
+ SkAlphaType srcAlphaType,
+ const SkMatrix& matrix,
+ const SkRect& domain,
+ GrTextureDomain::Mode modeX,
+ GrTextureDomain::Mode modeY,
+ const GrSamplerState& sampler) {
// If both domain modes happen to be ignore, it would be faster to just drop the domain logic
// entirely Technically, we could also use the simple texture effect if the domain modes agree
// with the sampler modes and the proxy is the same size as the domain. It's a lot easier for
// calling code to detect these cases and handle it themselves.
return std::unique_ptr<GrFragmentProcessor>(new GrTextureDomainEffect(
- std::move(proxy), srcColorType, matrix, domain, modeX, modeY, sampler));
+ std::move(proxy), srcAlphaType, matrix, domain, modeX, modeY, sampler));
}
GrTextureDomainEffect::GrTextureDomainEffect(sk_sp<GrTextureProxy> proxy,
- GrColorType srcColorType,
+ SkAlphaType srcAlphaType,
const SkMatrix& matrix,
const SkRect& domain,
GrTextureDomain::Mode modeX,
GrTextureDomain::Mode modeY,
const GrSamplerState& sampler)
: INHERITED(kGrTextureDomainEffect_ClassID,
- ModulateForSamplerOptFlags(srcColorType,
- GrTextureDomain::IsDecalSampled(sampler, modeX, modeY)))
+ ModulateForSamplerOptFlags(
+ srcAlphaType, GrTextureDomain::IsDecalSampled(sampler, modeX, modeY)))
, fCoordTransform(matrix, proxy.get())
, fTextureDomain(proxy.get(), domain, modeX, modeY)
, fTextureSampler(std::move(proxy), sampler) {
@@ -374,15 +373,17 @@
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
bool bilerp = modeX != GrTextureDomain::kRepeat_Mode && modeY != GrTextureDomain::kRepeat_Mode ?
d->fRandom->nextBool() : false;
- return GrTextureDomainEffect::Make(
- std::move(proxy),
- d->textureProxyColorType(texIdx),
- matrix,
- domain,
- modeX,
- modeY,
- GrSamplerState(GrSamplerState::WrapMode::kClamp, bilerp ?
- GrSamplerState::Filter::kBilerp : GrSamplerState::Filter::kNearest));
+ auto alphaType = static_cast<SkAlphaType>(
+ d->fRandom->nextRangeU(kUnknown_SkAlphaType + 1, kLastEnum_SkAlphaType));
+ return GrTextureDomainEffect::Make(std::move(proxy),
+ alphaType,
+ matrix,
+ domain,
+ modeX,
+ modeY,
+ GrSamplerState(GrSamplerState::WrapMode::kClamp,
+ bilerp ? GrSamplerState::Filter::kBilerp
+ : GrSamplerState::Filter::kNearest));
}
#endif