Small optimization for convolution shader: only apply the bounds check in direction of convolution, not both. This requires generating different versions of the shader depending on direction.
R=robertphillips@google.com
Review URL: https://codereview.chromium.org/20789003
git-svn-id: http://skia.googlecode.com/svn/trunk@10417 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/GrConvolutionEffect.h b/src/gpu/effects/GrConvolutionEffect.h
index 265150a..56a54b4 100644
--- a/src/gpu/effects/GrConvolutionEffect.h
+++ b/src/gpu/effects/GrConvolutionEffect.h
@@ -26,14 +26,14 @@
Direction dir,
int halfWidth,
const float* kernel,
- bool useCropRect,
- float cropRect[4]) {
+ bool useBounds,
+ float bounds[2]) {
AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex,
dir,
halfWidth,
kernel,
- useCropRect,
- cropRect)));
+ useBounds,
+ bounds)));
return CreateEffectRef(effect);
}
@@ -42,14 +42,14 @@
Direction dir,
int halfWidth,
float gaussianSigma,
- bool useCropRect,
- float cropRect[4]) {
+ bool useBounds,
+ float bounds[2]) {
AutoEffectUnref effect(SkNEW_ARGS(GrConvolutionEffect, (tex,
dir,
halfWidth,
gaussianSigma,
- useCropRect,
- cropRect)));
+ useBounds,
+ bounds)));
return CreateEffectRef(effect);
}
@@ -57,8 +57,8 @@
const float* kernel() const { return fKernel; }
- const float* cropRect() const { return fCropRect; }
- bool useCropRect() const { return fUseCropRect; }
+ const float* bounds() const { return fBounds; }
+ bool useBounds() const { return fUseBounds; }
static const char* Name() { return "Convolution"; }
@@ -86,22 +86,22 @@
protected:
float fKernel[kMaxKernelWidth];
- bool fUseCropRect;
- float fCropRect[4];
+ bool fUseBounds;
+ float fBounds[2];
private:
GrConvolutionEffect(GrTexture*, Direction,
int halfWidth,
const float* kernel,
- bool useCropRect,
- float cropRect[4]);
+ bool useBounds,
+ float bounds[2]);
/// Convolve with a Gaussian kernel
GrConvolutionEffect(GrTexture*, Direction,
int halfWidth,
float gaussianSigma,
- bool useCropRect,
- float cropRect[4]);
+ bool useBounds,
+ float bounds[2]);
virtual bool onIsEqual(const GrEffect&) const SK_OVERRIDE;