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

Side by Side Diff: src/gpu/GrDrawState.h

Issue 26922004: Make sure attribute indexes are correct after restoring vertex attributes (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #ifndef GrDrawState_DEFINED 8 #ifndef GrDrawState_DEFINED
9 #define GrDrawState_DEFINED 9 #define GrDrawState_DEFINED
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 public: 153 public:
154 AutoVertexAttribRestore(GrDrawState* drawState) { 154 AutoVertexAttribRestore(GrDrawState* drawState) {
155 SkASSERT(NULL != drawState); 155 SkASSERT(NULL != drawState);
156 fDrawState = drawState; 156 fDrawState = drawState;
157 fVAPtr = drawState->fCommon.fVAPtr; 157 fVAPtr = drawState->fCommon.fVAPtr;
158 fVACount = drawState->fCommon.fVACount; 158 fVACount = drawState->fCommon.fVACount;
159 fDrawState->setDefaultVertexAttribs(); 159 fDrawState->setDefaultVertexAttribs();
160 } 160 }
161 161
162 ~AutoVertexAttribRestore(){ 162 ~AutoVertexAttribRestore(){
163 fDrawState->fCommon.fVAPtr = fVAPtr; 163 fDrawState->setVertexAttribs(fVAPtr, fVACount);
164 fDrawState->fCommon.fVACount = fVACount;
165 } 164 }
166 165
167 private: 166 private:
168 GrDrawState* fDrawState; 167 GrDrawState* fDrawState;
169 const GrVertexAttrib* fVAPtr; 168 const GrVertexAttrib* fVAPtr;
170 int fVACount; 169 int fVACount;
171 }; 170 };
172 171
173 /** 172 /**
174 * Accessing positions, local coords, or colors, of a vertex within an array is a hassle 173 * Accessing positions, local coords, or colors, of a vertex within an array is a hassle
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1076 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt. 1075 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt.
1077 */ 1076 */
1078 void setVertexAttribs(const GrVertexAttrib attribs[], int count); 1077 void setVertexAttribs(const GrVertexAttrib attribs[], int count);
1079 1078
1080 typedef SkRefCnt INHERITED; 1079 typedef SkRefCnt INHERITED;
1081 }; 1080 };
1082 1081
1083 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); 1082 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
1084 1083
1085 #endif 1084 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698