| 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 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |