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

Unified Diff: src/gpu/GrDrawState.h

Issue 818233002: Remove coordchanges from drawstate (Closed) Base URL: https://skia.googlesource.com/skia.git@coord-change-off-paint
Patch Set: adding test to ignore Created 6 years 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/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrDrawState.h
diff --git a/src/gpu/GrDrawState.h b/src/gpu/GrDrawState.h
index 36e2b3a2fb1f3fc3b86eb684542375b2cc5f1c1b..1f469d537efd7f4d27fcd327a10ba396188ce8dc 100644
--- a/src/gpu/GrDrawState.h
+++ b/src/gpu/GrDrawState.h
@@ -306,40 +306,41 @@ public:
////////////////////////////////////////////////////////////////////////////
/**
- * Preconcats the current view matrix and restores the previous view matrix in the destructor.
- * Effect matrices are automatically adjusted to compensate and adjusted back in the destructor.
+ * Sets the viewmatrix to identity and restores it in the destructor.
+ * TODO remove vm off of drawstate
*/
class AutoViewMatrixRestore : public ::SkNoncopyable {
public:
- AutoViewMatrixRestore() : fDrawState(NULL) {}
-
- AutoViewMatrixRestore(GrDrawState* ds, const SkMatrix& preconcatMatrix) {
+ AutoViewMatrixRestore() {
fDrawState = NULL;
- this->set(ds, preconcatMatrix);
}
- ~AutoViewMatrixRestore() { this->restore(); }
-
- /**
- * Can be called prior to destructor to restore the original matrix.
- */
- void restore();
+ AutoViewMatrixRestore(GrDrawState* ds) {
+ SkASSERT(ds);
+ fDrawState = ds;
+ fViewMatrix = fDrawState->fViewMatrix;
+ fDrawState->fViewMatrix = SkMatrix::I();
+ }
- void set(GrDrawState* drawState, const SkMatrix& preconcatMatrix);
+ void setIdentity(GrDrawState* ds) {
+ SkASSERT(ds);
+ fDrawState = ds;
+ fViewMatrix = fDrawState->fViewMatrix;
+ fDrawState->fViewMatrix = SkMatrix::I();
+ }
- /** Sets the draw state's matrix to identity. This can fail because the current view matrix
- is not invertible. */
- bool setIdentity(GrDrawState* drawState);
+ ~AutoViewMatrixRestore() {
+ if (fDrawState) {
+ fDrawState->fViewMatrix = fViewMatrix;
+ }
+ }
private:
- void doEffectCoordChanges(const SkMatrix& coordChangeMatrix);
-
GrDrawState* fDrawState;
SkMatrix fViewMatrix;
- int fNumColorStages;
- SkAutoSTArray<8, GrFragmentStage::SavedCoordChange> fSavedCoordChanges;
};
+
/// @}
///////////////////////////////////////////////////////////////////////////
« no previous file with comments | « src/gpu/GrDefaultPathRenderer.cpp ('k') | src/gpu/GrDrawState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698