| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 #include "GrDrawState.h" | 8 #include "GrDrawState.h" |
| 9 | 9 |
| 10 #include "GrBlend.h" | 10 #include "GrBlend.h" |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 140 |
| 141 // The coverage isn't actually white, its unknown, but this will produce the
same effect | 141 // The coverage isn't actually white, its unknown, but this will produce the
same effect |
| 142 // TODO we want to cache the result of this call, but we can probably clean
up the interface | 142 // TODO we want to cache the result of this call, but we can probably clean
up the interface |
| 143 // so we don't have to pass in a seemingly known coverage | 143 // so we don't have to pass in a seemingly known coverage |
| 144 this->calcCoverageInvariantOutput(GrColor_WHITE); | 144 this->calcCoverageInvariantOutput(GrColor_WHITE); |
| 145 return fXPFactory->canApplyCoverage(fColorProcInfo, fCoverageProcInfo); | 145 return fXPFactory->canApplyCoverage(fColorProcInfo, fCoverageProcInfo); |
| 146 } | 146 } |
| 147 | 147 |
| 148 //////////////////////////////////////////////////////////////////////////////s | 148 //////////////////////////////////////////////////////////////////////////////s |
| 149 | 149 |
| 150 bool GrDrawState::willEffectReadDstColor(const GrPrimitiveProcessor* pp) const { | 150 bool GrDrawState::willEffectReadDstColor() const { |
| 151 this->calcColorInvariantOutput(pp); | 151 return fXPFactory->willReadDst(); |
| 152 this->calcCoverageInvariantOutput(pp); | |
| 153 | |
| 154 return fXPFactory->willReadDst(fColorProcInfo, fCoverageProcInfo); | |
| 155 } | 152 } |
| 156 | 153 |
| 157 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { | 154 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { |
| 158 if (fDrawState) { | 155 if (fDrawState) { |
| 159 int m = fDrawState->numColorStages() - fColorEffectCnt; | 156 int m = fDrawState->numColorStages() - fColorEffectCnt; |
| 160 SkASSERT(m >= 0); | 157 SkASSERT(m >= 0); |
| 161 fDrawState->fColorStages.pop_back_n(m); | 158 fDrawState->fColorStages.pop_back_n(m); |
| 162 | 159 |
| 163 int n = fDrawState->numCoverageStages() - fCoverageEffectCnt; | 160 int n = fDrawState->numCoverageStages() - fCoverageEffectCnt; |
| 164 SkASSERT(n >= 0); | 161 SkASSERT(n >= 0); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { | 229 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { |
| 233 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 230 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
| 234 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 231 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
| 235 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 232 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
| 236 this->numCoverageStages(), cover
age, flags, | 233 this->numCoverageStages(), cover
age, flags, |
| 237 true); | 234 true); |
| 238 fCoverageProcInfoValid = true; | 235 fCoverageProcInfoValid = true; |
| 239 fCoverageCache = coverage; | 236 fCoverageCache = coverage; |
| 240 } | 237 } |
| 241 } | 238 } |
| OLD | NEW |