diff options
author | bsalomon <bsalomon@google.com> | 2014-08-29 15:05:53 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-29 15:05:53 -0700 |
commit | 6267f81f3d60ce144ab2b09ea369420984d5c9d9 (patch) | |
tree | 6735ee6442429168bd760eb3f12caa6131ab2bd7 /include/gpu/GrCoordTransform.h | |
parent | 413191419dabdadf43625be2f6a5f0d4f2e3af4f (diff) |
Move MakeDivByTextureWHMatrix to GrCoordTransform
R=robertphillips@google.com
Author: bsalomon@google.com
Review URL: https://codereview.chromium.org/522873005
Diffstat (limited to 'include/gpu/GrCoordTransform.h')
-rw-r--r-- | include/gpu/GrCoordTransform.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/include/gpu/GrCoordTransform.h b/include/gpu/GrCoordTransform.h index f266577ec6..0bd7da0a0d 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; |