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(); |