| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 fColorProcInfoValid = false; | 105 fColorProcInfoValid = false; |
| 106 fCoverageProcInfoValid = false; | 106 fCoverageProcInfoValid = false; |
| 107 | 107 |
| 108 fColorCache = GrColor_ILLEGAL; | 108 fColorCache = GrColor_ILLEGAL; |
| 109 fCoverageCache = GrColor_ILLEGAL; | 109 fCoverageCache = GrColor_ILLEGAL; |
| 110 | 110 |
| 111 fColorPrimProc = NULL; | 111 fColorPrimProc = NULL; |
| 112 fCoveragePrimProc = NULL; | 112 fCoveragePrimProc = NULL; |
| 113 } | 113 } |
| 114 | 114 |
| 115 bool GrDrawState::setIdentityViewMatrix() { | |
| 116 if (this->numFragmentStages()) { | |
| 117 SkMatrix invVM; | |
| 118 if (!fViewMatrix.invert(&invVM)) { | |
| 119 // sad trombone sound | |
| 120 return false; | |
| 121 } | |
| 122 for (int s = 0; s < this->numColorStages(); ++s) { | |
| 123 fColorStages[s].localCoordChange(invVM); | |
| 124 } | |
| 125 for (int s = 0; s < this->numCoverageStages(); ++s) { | |
| 126 fCoverageStages[s].localCoordChange(invVM); | |
| 127 } | |
| 128 } | |
| 129 fViewMatrix.reset(); | |
| 130 return true; | |
| 131 } | |
| 132 | |
| 133 void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
rTarget* rt) { | 115 void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
rTarget* rt) { |
| 134 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numFragmentStages()); | 116 SkASSERT(0 == fBlockEffectRemovalCnt || 0 == this->numFragmentStages()); |
| 135 | 117 |
| 136 fColorStages.reset(); | 118 fColorStages.reset(); |
| 137 fCoverageStages.reset(); | 119 fCoverageStages.reset(); |
| 138 | 120 |
| 139 for (int i = 0; i < paint.numColorStages(); ++i) { | 121 for (int i = 0; i < paint.numColorStages(); ++i) { |
| 140 fColorStages.push_back(paint.getColorStage(i)); | 122 fColorStages.push_back(paint.getColorStage(i)); |
| 141 } | 123 } |
| 142 | 124 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { | 343 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { |
| 362 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 344 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
| 363 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 345 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
| 364 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 346 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
| 365 this->numCoverageStages(), cover
age, flags, | 347 this->numCoverageStages(), cover
age, flags, |
| 366 true); | 348 true); |
| 367 fCoverageProcInfoValid = true; | 349 fCoverageProcInfoValid = true; |
| 368 fCoverageCache = coverage; | 350 fCoverageCache = coverage; |
| 369 } | 351 } |
| 370 } | 352 } |
| OLD | NEW |