OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |