Make morphology, convolution, and table color filter opt out of default texture matrices.
Review URL: https://codereview.appspot.com/6817077
git-svn-id: http://skia.googlecode.com/svn/trunk@6280 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/Gr1DKernelEffect.h b/src/gpu/effects/Gr1DKernelEffect.h
index 9ef7652..f176cdd 100644
--- a/src/gpu/effects/Gr1DKernelEffect.h
+++ b/src/gpu/effects/Gr1DKernelEffect.h
@@ -9,6 +9,8 @@
#define Gr1DKernelEffect_DEFINED
#include "GrSingleTextureEffect.h"
+#include "GrTexture.h"
+#include "SkMatrix.h"
/**
* Base class for 1D kernel effects. The kernel operates either in X or Y and
@@ -18,6 +20,16 @@
* read. Since the center pixel is also read, the total width is one larger than
* two times the radius.
*/
+
+namespace {
+inline SkMatrix make_texture_matrix(GrTexture* tex) {
+ GrAssert(NULL != tex);
+ SkMatrix mat;
+ mat.setIDiv(tex->width(), tex->height());
+ return mat;
+}
+}
+
class Gr1DKernelEffect : public GrSingleTextureEffect {
public:
@@ -29,7 +41,7 @@
Gr1DKernelEffect(GrTexture* texture,
Direction direction,
int radius)
- : GrSingleTextureEffect(texture)
+ : GrSingleTextureEffect(texture, make_texture_matrix(texture))
, fDirection(direction)
, fRadius(radius) {}