Make all remaining effects use GrGLEffectMatrix
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6817079
git-svn-id: http://skia.googlecode.com/svn/trunk@6286 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/effects/Gr1DKernelEffect.h b/src/gpu/effects/Gr1DKernelEffect.h
index f176cdd..1712733 100644
--- a/src/gpu/effects/Gr1DKernelEffect.h
+++ b/src/gpu/effects/Gr1DKernelEffect.h
@@ -9,7 +9,6 @@
#define Gr1DKernelEffect_DEFINED
#include "GrSingleTextureEffect.h"
-#include "GrTexture.h"
#include "SkMatrix.h"
/**
@@ -21,15 +20,6 @@
* 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:
@@ -41,7 +31,7 @@
Gr1DKernelEffect(GrTexture* texture,
Direction direction,
int radius)
- : GrSingleTextureEffect(texture, make_texture_matrix(texture))
+ : GrSingleTextureEffect(texture, MakeDivByTextureWHMatrix(texture))
, fDirection(direction)
, fRadius(radius) {}
diff --git a/src/gpu/effects/GrSingleTextureEffect.h b/src/gpu/effects/GrSingleTextureEffect.h
index e598f2f..709d3dc 100644
--- a/src/gpu/effects/GrSingleTextureEffect.h
+++ b/src/gpu/effects/GrSingleTextureEffect.h
@@ -10,16 +10,18 @@
#include "GrEffect.h"
#include "SkMatrix.h"
+#include "GrTexture.h"
class GrGLSingleTextureEffect;
/**
- * An effect that merely blits a single texture; commonly used as a base class.
+ * An effect that draws a single texture with a texture matrix; commonly used as a base class. The
+ * output color is the texture color is modulated against the input color.
*/
class GrSingleTextureEffect : public GrEffect {
public:
- /** These three constructors assume an identity matrix */
+ /** These three constructors assume an identity matrix. TODO: Remove these.*/
GrSingleTextureEffect(GrTexture* texture); /* unfiltered, clamp mode */
GrSingleTextureEffect(GrTexture* texture, bool bilerp); /* clamp mode */
GrSingleTextureEffect(GrTexture* texture, const GrTextureParams&);
@@ -45,6 +47,14 @@
const GrSingleTextureEffect& ste = static_cast<const GrSingleTextureEffect&>(effect);
return INHERITED::isEqual(effect) && fMatrix.cheapEqualTo(ste.getMatrix());
}
+
+ static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) {
+ GrAssert(NULL != texture);
+ SkMatrix mat;
+ mat.setIDiv(texture->width(), texture->height());
+ return mat;
+ }
+
private:
GR_DECLARE_EFFECT_TEST;