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

Unified Diff: src/gpu/GrDrawState.h

Issue 15780002: Replace GrDrawState::AutoDeviceCoordDraw with GrDrawState::AutoViewMatrixRestore::setIdentity(). s (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: undo unrelated change 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
Index: src/gpu/GrDrawState.h
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 80ad28eac5d794edafa6915fb425a2ed5bee4ca4..c36a9674c065c6cee4db1000cfcf27368bc8842b 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -685,7 +685,7 @@ public:
/**
* Preconcats the current view matrix and restores the previous view matrix in the destructor.
- * Effect matrices are automatically adjusted to compensate.
+ * Effect matrices are automatically adjusted to compensate and adjusted back in the destructor.
*/
class AutoViewMatrixRestore : public ::GrNoncopyable {
public:
@@ -705,60 +705,11 @@ public:
void set(GrDrawState* drawState, const SkMatrix& preconcatMatrix);
- bool isSet() const { return NULL != fDrawState; }
+ /** Sets the draw state's matrix to identity. This can fail because the current view matrix
+ is not invertible. */
+ bool setIdentity(GrDrawState* drawState);
robertphillips 2013/05/22 23:47:01 delete this?
- private:
- GrDrawState* fDrawState;
- SkMatrix fViewMatrix;
- GrEffectStage::SavedCoordChange fSavedCoordChanges[GrDrawState::kNumStages];
- uint32_t fRestoreMask;
- };
-
- ////////////////////////////////////////////////////////////////////////////
-
- /**
- * This sets the view matrix to identity and adjusts stage matrices to compensate. The
- * destructor undoes the changes, restoring the view matrix that was set before the
- * constructor. It is similar to passing the inverse of the current view matrix to
- * AutoViewMatrixRestore, but lazily computes the inverse only if necessary.
- */
- class AutoDeviceCoordDraw : ::GrNoncopyable {
- public:
- AutoDeviceCoordDraw() : fDrawState(NULL) {}
- /**
- * If a stage's texture matrix is applied to explicit per-vertex coords, rather than to
- * positions, then we don't want to modify its matrix. The explicitCoordStageMask is used
- * to specify such stages.
- */
- AutoDeviceCoordDraw(GrDrawState* drawState) {
- fDrawState = NULL;
- this->set(drawState);
- }
-
- ~AutoDeviceCoordDraw() { this->restore(); }
-
- bool set(GrDrawState* drawState);
-
- /**
- * 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; }
-
- /**
- * Returns the matrix that was set previously set on the drawState. This is only valid
- * if succeeded returns true.
- */
- const SkMatrix& getOriginalMatrix() const {
- GrAssert(this->succeeded());
- return fViewMatrix;
- }
-
- /**
- * Can be called prior to destructor to restore the original matrix.
- */
- void restore();
+ //bool isSet() const { return NULL != fDrawState; }
private:
GrDrawState* fDrawState;

Powered by Google App Engine
This is Rietveld 408576698