Lift TextureSampler's proxy to SurfaceProxy
Now that the UniformHandlers can accept SurfaceProxies directly, there's
no need to have the restricted type on TextureSampler anymore. This will
make them one step closer to compatibility with GrSurfaceProxyView.
While making these changes, several effects performed their own source
coord normalization by peeking the texture. I updated these to just
use the proxy's backing store dimensions.
Bug: skia:9556
Change-Id: I97183e8453b7a3db86cd90d614c8c959b3707abb
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/255978
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/effects/GrMatrixConvolutionEffect.cpp b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
index 86df7a0..1f70a53 100644
--- a/src/gpu/effects/GrMatrixConvolutionEffect.cpp
+++ b/src/gpu/effects/GrMatrixConvolutionEffect.cpp
@@ -125,13 +125,13 @@
void GrGLMatrixConvolutionEffect::onSetData(const GrGLSLProgramDataManager& pdman,
const GrFragmentProcessor& processor) {
const GrMatrixConvolutionEffect& conv = processor.cast<GrMatrixConvolutionEffect>();
- GrTextureProxy* proxy = conv.textureSampler(0).proxy();
- GrTexture* texture = proxy->peekTexture();
+ GrSurfaceProxy* proxy = conv.textureSampler(0).proxy();
+ SkISize textureDims = proxy->backingStoreDimensions();
float imageIncrement[2];
float ySign = proxy->origin() == kTopLeft_GrSurfaceOrigin ? 1.0f : -1.0f;
- imageIncrement[0] = 1.0f / texture->width();
- imageIncrement[1] = ySign / texture->height();
+ imageIncrement[0] = 1.0f / textureDims.width();
+ imageIncrement[1] = ySign / textureDims.height();
pdman.set2fv(fImageIncrementUni, 1, imageIncrement);
pdman.set2fv(fKernelOffsetUni, 1, conv.kernelOffset());
int kernelCount = conv.kernelSize().width() * conv.kernelSize().height();
@@ -143,7 +143,7 @@
fDomain.setData(pdman, conv.domain(), proxy, conv.textureSampler(0).samplerState());
}
-GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrTextureProxy> srcProxy,
+GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(sk_sp<GrSurfaceProxy> srcProxy,
const SkIRect& srcBounds,
const SkISize& kernelSize,
const SkScalar* kernel,