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

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

Issue 18295008: Remove possiblity of NULL effect in GrEffectStage (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: wrap line Created 7 years, 5 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
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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after
1017 fStages[i + fColorStageCnt].saveFrom(drawState.fCoverageStages[i ]); 1017 fStages[i + fColorStageCnt].saveFrom(drawState.fCoverageStages[i ]);
1018 } 1018 }
1019 GR_DEBUGCODE(fInitialized = true;) 1019 GR_DEBUGCODE(fInitialized = true;)
1020 } 1020 }
1021 1021
1022 void restoreTo(GrDrawState* drawState) { 1022 void restoreTo(GrDrawState* drawState) {
1023 GrAssert(fInitialized); 1023 GrAssert(fInitialized);
1024 drawState->fCommon = fCommon; 1024 drawState->fCommon = fCommon;
1025 drawState->setRenderTarget(fRenderTarget); 1025 drawState->setRenderTarget(fRenderTarget);
1026 // reinflate color/cov stage arrays. 1026 // reinflate color/cov stage arrays.
1027 drawState->fColorStages.reset(fColorStageCnt); 1027 drawState->fColorStages.reset();
1028 for (int i = 0; i < fColorStageCnt; ++i) { 1028 for (int i = 0; i < fColorStageCnt; ++i) {
1029 fStages[i].restoreTo(&drawState->fColorStages[i]); 1029 SkNEW_APPEND_TO_TARRAY(&drawState->fColorStages, GrEffectStage, (fStages[i]));
1030 } 1030 }
1031 int coverageStageCnt = fStages.count() - fColorStageCnt; 1031 int coverageStageCnt = fStages.count() - fColorStageCnt;
1032 drawState->fCoverageStages.reset(coverageStageCnt); 1032 drawState->fCoverageStages.reset();
1033 for (int i = 0; i < coverageStageCnt; ++i) { 1033 for (int i = 0; i < coverageStageCnt; ++i) {
1034 fStages[fColorStageCnt + i].restoreTo(&drawState->fCoverageStage s[i]); 1034 SkNEW_APPEND_TO_TARRAY(&drawState->fCoverageStages,
1035 GrEffectStage, (fStages[i + fColorStageC nt]));
1035 } 1036 }
1036 } 1037 }
1037 1038
1038 bool isEqual(const GrDrawState& state) const { 1039 bool isEqual(const GrDrawState& state) const {
1039 int numCoverageStages = fStages.count() - fColorStageCnt; 1040 int numCoverageStages = fStages.count() - fColorStageCnt;
1040 if (fRenderTarget != state.fRenderTarget.get() || 1041 if (fRenderTarget != state.fRenderTarget.get() ||
1041 fColorStageCnt != state.fColorStages.count() || 1042 fColorStageCnt != state.fColorStages.count() ||
1042 numCoverageStages != state.fCoverageStages.count() || 1043 numCoverageStages != state.fCoverageStages.count() ||
1043 fCommon != state.fCommon) { 1044 fCommon != state.fCommon) {
1044 return false; 1045 return false;
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1089 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt. 1090 * @param count the number of attributes being set, limited to kMaxVer texAttribCnt.
1090 */ 1091 */
1091 void setVertexAttribs(const GrVertexAttrib attribs[], int count); 1092 void setVertexAttribs(const GrVertexAttrib attribs[], int count);
1092 1093
1093 typedef GrRefCnt INHERITED; 1094 typedef GrRefCnt INHERITED;
1094 }; 1095 };
1095 1096
1096 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags); 1097 GR_MAKE_BITFIELD_OPS(GrDrawState::BlendOptFlags);
1097 1098
1098 #endif 1099 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698