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

Unified Diff: src/gpu/GrDrawTarget.h

Issue 15780002: Replace GrDrawState::AutoDeviceCoordDraw with GrDrawState::AutoViewMatrixRestore::setIdentity(). s (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: update based on comments Created 7 years, 7 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 | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawTarget.h
diff --git a/src/gpu/GrDrawTarget.h b/src/gpu/GrDrawTarget.h
index 8f5f09fd65874105a397da4c719e7b49f3b322c5..e87613663e0636e492a5641b2306e576889fec62 100644
--- a/src/gpu/GrDrawTarget.h
+++ b/src/gpu/GrDrawTarget.h
@@ -488,8 +488,12 @@ public:
*
* @param init Should the newly installed GrDrawState be a copy of the
* previous state or a default-initialized GrDrawState.
+ * @param viewMatrix Optional view matrix. If init = kPreserve then the draw state's
+ * matrix will be preconcat'ed with the param. All stages will be
+ updated to compensate for the matrix change. If init == kReset
+ then the draw state's matrix will be this matrix.
*/
- AutoStateRestore(GrDrawTarget* target, ASRInit init);
+ AutoStateRestore(GrDrawTarget* target, ASRInit init, const SkMatrix* viewMatrix = NULL);
~AutoStateRestore();
@@ -501,13 +505,25 @@ public:
*
* @param init Should the newly installed GrDrawState be a copy of the
* previous state or a default-initialized GrDrawState.
+ * @param viewMatrix Optional view matrix. If init = kPreserve then the draw state's
+ * matrix will be preconcat'ed with the param. All stages will be
+ updated to compensate for the matrix change. If init == kReset
+ then the draw state's matrix will be this matrix.
*/
- void set(GrDrawTarget* target, ASRInit init);
+ void set(GrDrawTarget* target, ASRInit init, const SkMatrix* viewMatrix = NULL);
+
+ /**
+ * Like set() but makes the view matrix identity. When init is kReset it is as though
+ * NULL was passed to set's viewMatrix param. When init is kPreserve it is as though
+ * the inverse view matrix was passed. If kPreserve is passed and the draw state's matrix
+ * is not invertible then this may fail.
+ */
+ bool setIdentity(GrDrawTarget* target, ASRInit init);
private:
- GrDrawTarget* fDrawTarget;
- SkTLazy<GrDrawState> fTempState;
- GrDrawState* fSavedState;
+ GrDrawTarget* fDrawTarget;
+ SkTLazy<GrDrawState> fTempState;
+ GrDrawState* fSavedState;
};
////////////////////////////////////////////////////////////////////////////
@@ -586,8 +602,10 @@ public:
*/
class AutoGeometryAndStatePush : ::GrNoncopyable {
public:
- AutoGeometryAndStatePush(GrDrawTarget* target, ASRInit init)
- : fState(target, init){
+ AutoGeometryAndStatePush(GrDrawTarget* target,
+ ASRInit init,
+ const SkMatrix* viewMatrix = NULL)
+ : fState(target, init, viewMatrix) {
GrAssert(NULL != target);
fTarget = target;
target->pushGeometrySource();
« no previous file with comments | « src/gpu/GrDrawState.cpp ('k') | src/gpu/GrDrawTarget.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698