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

Unified Diff: src/gpu/GrDrawState.h

Issue 13468004: Make drawRect preserve vertex attrib state and push/pop the geom sources. (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 9 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
===================================================================
--- src/gpu/GrDrawState.h (revision 8471)
+++ src/gpu/GrDrawState.h (working copy)
@@ -170,6 +170,27 @@
bool validateVertexAttribs() const;
/**
+ * Helper to save/restore vertex attribs
+ */
+ class AutoVertexAttribRestore {
+ public:
+ AutoVertexAttribRestore(GrDrawState* drawState) {
+ GrAssert(NULL != drawState);
+ fDrawState = drawState;
+ fVertexAttribs = drawState->fCommon.fVertexAttribs;
+ fDrawState->setDefaultVertexAttribs();
+ }
+
+ ~AutoVertexAttribRestore(){
+ fDrawState->fCommon.fVertexAttribs = fVertexAttribs;
+ }
+
+ private:
+ GrDrawState* fDrawState;
+ GrVertexAttribArray<kMaxVertexAttribCnt> fVertexAttribs;
+ };
+
+ /**
* Accessing positions, local coords, or colors, of a vertex within an array is a hassle
* involving casts and simple math. These helpers exist to keep GrDrawTarget clients' code a bit
* nicer looking.
« no previous file with comments | « src/gpu/GrContext.cpp ('k') | src/gpu/GrDrawTarget.h » ('j') | src/gpu/GrDrawTarget.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698