Clamp in GrBicubicEffect (to match SW and for general sanity)
Bug: skia:8809
Change-Id: I9f5b6428113602929b3a1b45c25b623e8da0e264
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/200512
Commit-Queue: Brian Osman <brianosman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/src/gpu/effects/GrBicubicEffect.h b/src/gpu/effects/GrBicubicEffect.h
index be2e44c..9086b5a 100644
--- a/src/gpu/effects/GrBicubicEffect.h
+++ b/src/gpu/effects/GrBicubicEffect.h
@@ -28,16 +28,19 @@
const GrTextureDomain& domain() const { return fDomain; }
+ SkAlphaType alphaType() const { return fAlphaType; }
+
/**
* Create a Mitchell filter effect with specified texture matrix and x/y tile modes.
*/
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
const SkMatrix& matrix,
- const GrSamplerState::WrapMode wrapModes[2]) {
+ const GrSamplerState::WrapMode wrapModes[2],
+ SkAlphaType alphaType) {
// Ignore the domain on x and y, since this factory relies solely on the wrap mode of the
// sampler to constrain texture coordinates
return Make(std::move(proxy), matrix, wrapModes, GrTextureDomain::kIgnore_Mode,
- GrTextureDomain::kIgnore_Mode);
+ GrTextureDomain::kIgnore_Mode, alphaType);
}
/**
@@ -50,11 +53,12 @@
const GrSamplerState::WrapMode wrapModes[2],
GrTextureDomain::Mode modeX,
GrTextureDomain::Mode modeY,
+ SkAlphaType alphaType,
const SkRect* domain = nullptr) {
SkRect resolvedDomain = domain ? *domain : GrTextureDomain::MakeTexelDomain(
SkIRect::MakeWH(proxy->width(), proxy->height()), modeX, modeY);
return std::unique_ptr<GrFragmentProcessor>(new GrBicubicEffect(
- std::move(proxy), matrix, resolvedDomain, wrapModes, modeX, modeY));
+ std::move(proxy), matrix, resolvedDomain, wrapModes, modeX, modeY, alphaType));
}
/**
@@ -62,11 +66,12 @@
*/
static std::unique_ptr<GrFragmentProcessor> Make(sk_sp<GrTextureProxy> proxy,
const SkMatrix& matrix,
- const SkRect& domain) {
+ const SkRect& domain,
+ SkAlphaType alphaType) {
static const GrSamplerState::WrapMode kClampClamp[] = {
GrSamplerState::WrapMode::kClamp, GrSamplerState::WrapMode::kClamp};
return Make(std::move(proxy), matrix, kClampClamp, GrTextureDomain::kClamp_Mode,
- GrTextureDomain::kClamp_Mode, &domain);
+ GrTextureDomain::kClamp_Mode, alphaType, &domain);
}
/**
@@ -82,7 +87,8 @@
private:
GrBicubicEffect(sk_sp<GrTextureProxy>, const SkMatrix& matrix, const SkRect& domain,
const GrSamplerState::WrapMode wrapModes[2],
- GrTextureDomain::Mode modeX, GrTextureDomain::Mode modeY);
+ GrTextureDomain::Mode modeX, GrTextureDomain::Mode modeY,
+ SkAlphaType alphaType);
explicit GrBicubicEffect(const GrBicubicEffect&);
GrGLSLFragmentProcessor* onCreateGLSLInstance() const override;
@@ -96,6 +102,7 @@
GrCoordTransform fCoordTransform;
GrTextureDomain fDomain;
TextureSampler fTextureSampler;
+ SkAlphaType fAlphaType;
GR_DECLARE_FRAGMENT_PROCESSOR_TEST