Reland "Revert "Make FP optimizations helpers use SkAlphaType not GrColorType""
This reverts commit 997b37fdb986b45ff9941319b0111b188e749cfc.
Reason for revert: May be blocking Chrome roll
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>
TBR=egdaniel@google.com,bsalomon@google.com
Change-Id: I0d2754ac7f4672f0758e4d00cd9e06998637846a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/256196
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/effects/GrTextureDomain.cpp b/src/gpu/effects/GrTextureDomain.cpp
index 10fa17f..8bb662b 100644
--- a/src/gpu/effects/GrTextureDomain.cpp
+++ b/src/gpu/effects/GrTextureDomain.cpp
@@ -252,40 +252,41 @@
std::unique_ptr<GrFragmentProcessor> GrTextureDomainEffect::Make(
sk_sp<GrTextureProxy> proxy,
- SkAlphaType srcAlphaType,
+ GrColorType srcColorType,
const SkMatrix& matrix,
const SkRect& domain,
GrTextureDomain::Mode mode,
GrSamplerState::Filter filterMode) {
- return Make(std::move(proxy), srcAlphaType, matrix, domain, mode, mode,
+ return Make(std::move(proxy), srcColorType, matrix, domain, mode, mode,
GrSamplerState(GrSamplerState::WrapMode::kClamp, filterMode));
}
-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) {
+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) {
// 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), srcAlphaType, matrix, domain, modeX, modeY, sampler));
+ std::move(proxy), srcColorType, matrix, domain, modeX, modeY, sampler));
}
GrTextureDomainEffect::GrTextureDomainEffect(sk_sp<GrTextureProxy> proxy,
- SkAlphaType srcAlphaType,
+ GrColorType srcColorType,
const SkMatrix& matrix,
const SkRect& domain,
GrTextureDomain::Mode modeX,
GrTextureDomain::Mode modeY,
const GrSamplerState& sampler)
: INHERITED(kGrTextureDomainEffect_ClassID,
- ModulateForSamplerOptFlags(
- srcAlphaType, GrTextureDomain::IsDecalSampled(sampler, modeX, modeY)))
+ ModulateForSamplerOptFlags(srcColorType,
+ GrTextureDomain::IsDecalSampled(sampler, modeX, modeY)))
, fCoordTransform(matrix, proxy.get())
, fTextureDomain(proxy.get(), domain, modeX, modeY)
, fTextureSampler(std::move(proxy), sampler) {
@@ -373,17 +374,15 @@
const SkMatrix& matrix = GrTest::TestMatrix(d->fRandom);
bool bilerp = modeX != GrTextureDomain::kRepeat_Mode && modeY != GrTextureDomain::kRepeat_Mode ?
d->fRandom->nextBool() : false;
- 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));
+ return GrTextureDomainEffect::Make(
+ std::move(proxy),
+ d->textureProxyColorType(texIdx),
+ matrix,
+ domain,
+ modeX,
+ modeY,
+ GrSamplerState(GrSamplerState::WrapMode::kClamp, bilerp ?
+ GrSamplerState::Filter::kBilerp : GrSamplerState::Filter::kNearest));
}
#endif