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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 fStencilSettings = that.fStencilSettings; | 67 fStencilSettings = that.fStencilSettings; |
68 fDrawFace = that.fDrawFace; | 68 fDrawFace = that.fDrawFace; |
69 fXPFactory.reset(SkRef(that.getXPFactory())); | 69 fXPFactory.reset(SkRef(that.getXPFactory())); |
70 fColorStages = that.fColorStages; | 70 fColorStages = that.fColorStages; |
71 fCoverageStages = that.fCoverageStages; | 71 fCoverageStages = that.fCoverageStages; |
72 | 72 |
73 fColorProcInfoValid = that.fColorProcInfoValid; | 73 fColorProcInfoValid = that.fColorProcInfoValid; |
74 fCoverageProcInfoValid = that.fCoverageProcInfoValid; | 74 fCoverageProcInfoValid = that.fCoverageProcInfoValid; |
75 fColorCache = that.fColorCache; | 75 fColorCache = that.fColorCache; |
76 fCoverageCache = that.fCoverageCache; | 76 fCoverageCache = that.fCoverageCache; |
| 77 fColorPrimProc = that.fColorPrimProc; |
| 78 fCoveragePrimProc = that.fCoveragePrimProc; |
77 if (fColorProcInfoValid) { | 79 if (fColorProcInfoValid) { |
78 fColorProcInfo = that.fColorProcInfo; | 80 fColorProcInfo = that.fColorProcInfo; |
79 } | 81 } |
80 if (fCoverageProcInfoValid) { | 82 if (fCoverageProcInfoValid) { |
81 fCoverageProcInfo = that.fCoverageProcInfo; | 83 fCoverageProcInfo = that.fCoverageProcInfo; |
82 } | 84 } |
83 return *this; | 85 return *this; |
84 } | 86 } |
85 | 87 |
86 void GrDrawState::onReset(const SkMatrix* initialViewMatrix) { | 88 void GrDrawState::onReset(const SkMatrix* initialViewMatrix) { |
(...skipping 14 matching lines...) Expand all Loading... |
101 fDrawFace = kBoth_DrawFace; | 103 fDrawFace = kBoth_DrawFace; |
102 | 104 |
103 fColorProcInfoValid = false; | 105 fColorProcInfoValid = false; |
104 fCoverageProcInfoValid = false; | 106 fCoverageProcInfoValid = false; |
105 | 107 |
106 fColorCache = GrColor_ILLEGAL; | 108 fColorCache = GrColor_ILLEGAL; |
107 fCoverageCache = GrColor_ILLEGAL; | 109 fCoverageCache = GrColor_ILLEGAL; |
108 | 110 |
109 fColorPrimProc = NULL; | 111 fColorPrimProc = NULL; |
110 fCoveragePrimProc = NULL; | 112 fCoveragePrimProc = NULL; |
111 | |
112 } | 113 } |
113 | 114 |
114 bool GrDrawState::setIdentityViewMatrix() { | 115 bool GrDrawState::setIdentityViewMatrix() { |
115 if (this->numFragmentStages()) { | 116 if (this->numFragmentStages()) { |
116 SkMatrix invVM; | 117 SkMatrix invVM; |
117 if (!fViewMatrix.invert(&invVM)) { | 118 if (!fViewMatrix.invert(&invVM)) { |
118 // sad trombone sound | 119 // sad trombone sound |
119 return false; | 120 return false; |
120 } | 121 } |
121 for (int s = 0; s < this->numColorStages(); ++s) { | 122 for (int s = 0; s < this->numColorStages(); ++s) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 this->enableState(GrDrawState::kClip_StateBit); | 159 this->enableState(GrDrawState::kClip_StateBit); |
159 | 160 |
160 this->setState(GrDrawState::kDither_StateBit, paint.isDither()); | 161 this->setState(GrDrawState::kDither_StateBit, paint.isDither()); |
161 this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias()); | 162 this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias()); |
162 | 163 |
163 fColorProcInfoValid = false; | 164 fColorProcInfoValid = false; |
164 fCoverageProcInfoValid = false; | 165 fCoverageProcInfoValid = false; |
165 | 166 |
166 fColorCache = GrColor_ILLEGAL; | 167 fColorCache = GrColor_ILLEGAL; |
167 fCoverageCache = GrColor_ILLEGAL; | 168 fCoverageCache = GrColor_ILLEGAL; |
| 169 |
| 170 fColorPrimProc = NULL; |
| 171 fCoveragePrimProc = NULL; |
168 } | 172 } |
169 | 173 |
170 //////////////////////////////////////////////////////////////////////////////// | 174 //////////////////////////////////////////////////////////////////////////////// |
171 | 175 |
172 bool GrDrawState::canUseFracCoveragePrimProc(GrColor color, const GrDrawTargetCa
ps& caps) const { | 176 bool GrDrawState::canUseFracCoveragePrimProc(GrColor color, const GrDrawTargetCa
ps& caps) const { |
173 if (caps.dualSourceBlendingSupport()) { | 177 if (caps.dualSourceBlendingSupport()) { |
174 return true; | 178 return true; |
175 } | 179 } |
176 | 180 |
177 this->calcColorInvariantOutput(color); | 181 this->calcColorInvariantOutput(color); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
383 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { | 387 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { |
384 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 388 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
385 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 389 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
386 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 390 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
387 this->numCoverageStages(), cover
age, flags, | 391 this->numCoverageStages(), cover
age, flags, |
388 true); | 392 true); |
389 fCoverageProcInfoValid = true; | 393 fCoverageProcInfoValid = true; |
390 fCoverageCache = coverage; | 394 fCoverageCache = coverage; |
391 } | 395 } |
392 } | 396 } |
OLD | NEW |