Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: include/gpu/GrCoordTransform.h

Issue 522873005: Move MakeDivByTextureWHMatrix to GrCoordTransform (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/gpu/GrEffect.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
« no previous file with comments | « no previous file | include/gpu/GrEffect.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698