diff options
author | 2012-10-08 18:59:39 +0000 | |
---|---|---|
committer | 2012-10-08 18:59:39 +0000 | |
commit | a834746cc1bd92301fd0840a221ca1623c0bbb29 (patch) | |
tree | fb1028fc986fc05584d089286df3177d6a4e0ba9 /src/gpu/GrDrawState.h | |
parent | 042aff872a22cadd28368676839a21be8b33e119 (diff) |
Make additional code paths go through GrDrawState helper classes for their matrix manipulations.
R=robertphillips@google.com
Review URL: https://codereview.appspot.com/6615064
git-svn-id: http://skia.googlecode.com/svn/trunk@5856 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrDrawState.h')
-rw-r--r-- | src/gpu/GrDrawState.h | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h index 5dccb1581d..8e063f775e 100644 --- a/src/gpu/GrDrawState.h +++ b/src/gpu/GrDrawState.h @@ -483,6 +483,9 @@ public: ~AutoViewMatrixRestore() { this->restore(); } + /** + * Can be called prior to destructor to restore the original matrix. + */ void restore(); void set(GrDrawState* drawState, @@ -520,13 +523,30 @@ public: this->set(drawState, explicitCoordStageMask); } + ~AutoDeviceCoordDraw() { this->restore(); } + bool set(GrDrawState* drawState, uint32_t explicitCoordStageMask = 0); + /** + * Returns true if this object was successfully initialized on to a GrDrawState. It may + * return false because a non-default constructor or set() were never called or because + * the view matrix was not invertible. + */ bool succeeded() const { return NULL != fDrawState; } - void restore(); + /** + * Returns the matrix that was set previously set on the drawState. This is only valid + * if succeeded returns true. + */ + const GrMatrix& getOriginalMatrix() const { + GrAssert(this->succeeded()); + return fViewMatrix; + } - ~AutoDeviceCoordDraw() { this->restore(); } + /** + * Can be called prior to destructor to restore the original matrix. + */ + void restore(); private: GrDrawState* fDrawState; |