Index: include/gpu/GrCoordTransform.h |
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h |
index f266577ec62b8d027f307b594a1ab1e574b59402..0bd7da0a0d4160debd896e046601cd8c9face2de 100644 |
--- a/include/gpu/GrCoordTransform.h |
+++ b/include/gpu/GrCoordTransform.h |
@@ -64,7 +64,7 @@ public: |
void reset(GrCoordSet sourceCoords, const GrTexture* texture) { |
SkASSERT(!fInEffect); |
SkASSERT(NULL != texture); |
- this->reset(sourceCoords, GrEffect::MakeDivByTextureWHMatrix(texture), texture); |
+ this->reset(sourceCoords, MakeDivByTextureWHMatrix(texture), texture); |
} |
void reset(GrCoordSet sourceCoords, const SkMatrix& m, const GrTexture* texture = NULL) { |
@@ -101,6 +101,15 @@ public: |
const SkMatrix& getMatrix() const { return fMatrix; } |
bool reverseY() const { return fReverseY; } |
+ /** Useful for effects that want to insert a texture matrix that is implied by the texture |
+ dimensions */ |
+ static inline SkMatrix MakeDivByTextureWHMatrix(const GrTexture* texture) { |
+ SkASSERT(NULL != texture); |
+ SkMatrix mat; |
+ mat.setIDiv(texture->width(), texture->height()); |
+ return mat; |
+ } |
+ |
private: |
GrCoordSet fSourceCoords; |
SkMatrix fMatrix; |