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" |
11 #include "GrOptDrawState.h" | 11 #include "GrOptDrawState.h" |
12 #include "GrPaint.h" | 12 #include "GrPaint.h" |
13 #include "GrProcOptInfo.h" | 13 #include "GrProcOptInfo.h" |
14 #include "GrXferProcessor.h" | 14 #include "GrXferProcessor.h" |
15 #include "effects/GrPorterDuffXferProcessor.h" | 15 #include "effects/GrPorterDuffXferProcessor.h" |
16 | 16 |
| 17 /////////////////////////////////////////////////////////////////////////////// |
| 18 |
17 bool GrDrawState::isEqual(const GrDrawState& that) const { | 19 bool GrDrawState::isEqual(const GrDrawState& that) const { |
18 bool usingVertexColors = this->hasColorVertexAttribute(); | 20 bool usingVertexColors = this->hasColorVertexAttribute(); |
19 if (!usingVertexColors && this->fColor != that.fColor) { | 21 if (!usingVertexColors && this->fColor != that.fColor) { |
20 return false; | 22 return false; |
21 } | 23 } |
22 | 24 |
23 if (this->getRenderTarget() != that.getRenderTarget() || | 25 if (this->getRenderTarget() != that.getRenderTarget() || |
24 this->fColorStages.count() != that.fColorStages.count() || | 26 this->fColorStages.count() != that.fColorStages.count() || |
25 this->fCoverageStages.count() != that.fCoverageStages.count() || | 27 this->fCoverageStages.count() != that.fCoverageStages.count() || |
26 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || | 28 !this->fViewMatrix.cheapEqualTo(that.fViewMatrix) || |
| 29 this->fSrcBlend != that.fSrcBlend || |
| 30 this->fDstBlend != that.fDstBlend || |
| 31 this->fBlendConstant != that.fBlendConstant || |
27 this->fFlagBits != that.fFlagBits || | 32 this->fFlagBits != that.fFlagBits || |
28 this->fStencilSettings != that.fStencilSettings || | 33 this->fStencilSettings != that.fStencilSettings || |
29 this->fDrawFace != that.fDrawFace) { | 34 this->fDrawFace != that.fDrawFace) { |
30 return false; | 35 return false; |
31 } | 36 } |
32 | 37 |
33 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); | 38 bool usingVertexCoverage = this->hasCoverageVertexAttribute(); |
34 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { | 39 if (!usingVertexCoverage && this->fCoverage != that.fCoverage) { |
35 return false; | 40 return false; |
36 } | 41 } |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 for (int i = 0; i < this->numCoverageStages(); ++i) { | 83 for (int i = 0; i < this->numCoverageStages(); ++i) { |
79 fCoverageStages[i].localCoordChange(preConcatMatrix); | 84 fCoverageStages[i].localCoordChange(preConcatMatrix); |
80 } | 85 } |
81 } | 86 } |
82 } | 87 } |
83 | 88 |
84 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { | 89 GrDrawState& GrDrawState::operator=(const GrDrawState& that) { |
85 fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get())); | 90 fRenderTarget.reset(SkSafeRef(that.fRenderTarget.get())); |
86 fColor = that.fColor; | 91 fColor = that.fColor; |
87 fViewMatrix = that.fViewMatrix; | 92 fViewMatrix = that.fViewMatrix; |
| 93 fSrcBlend = that.fSrcBlend; |
| 94 fDstBlend = that.fDstBlend; |
| 95 fBlendConstant = that.fBlendConstant; |
88 fFlagBits = that.fFlagBits; | 96 fFlagBits = that.fFlagBits; |
89 fStencilSettings = that.fStencilSettings; | 97 fStencilSettings = that.fStencilSettings; |
90 fCoverage = that.fCoverage; | 98 fCoverage = that.fCoverage; |
91 fDrawFace = that.fDrawFace; | 99 fDrawFace = that.fDrawFace; |
92 fGeometryProcessor.reset(SkSafeRef(that.fGeometryProcessor.get())); | 100 fGeometryProcessor.reset(SkSafeRef(that.fGeometryProcessor.get())); |
93 fXPFactory.reset(SkRef(that.getXPFactory())); | 101 fXPFactory.reset(SkRef(that.getXPFactory())); |
94 fColorStages = that.fColorStages; | 102 fColorStages = that.fColorStages; |
95 fCoverageStages = that.fCoverageStages; | 103 fCoverageStages = that.fCoverageStages; |
96 | 104 |
97 fHints = that.fHints; | 105 fHints = that.fHints; |
(...skipping 17 matching lines...) Expand all Loading... |
115 fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode)); | 123 fXPFactory.reset(GrPorterDuffXPFactory::Create(SkXfermode::kSrc_Mode)); |
116 fColorStages.reset(); | 124 fColorStages.reset(); |
117 fCoverageStages.reset(); | 125 fCoverageStages.reset(); |
118 | 126 |
119 fColor = 0xffffffff; | 127 fColor = 0xffffffff; |
120 if (NULL == initialViewMatrix) { | 128 if (NULL == initialViewMatrix) { |
121 fViewMatrix.reset(); | 129 fViewMatrix.reset(); |
122 } else { | 130 } else { |
123 fViewMatrix = *initialViewMatrix; | 131 fViewMatrix = *initialViewMatrix; |
124 } | 132 } |
| 133 fSrcBlend = kOne_GrBlendCoeff; |
| 134 fDstBlend = kZero_GrBlendCoeff; |
| 135 fBlendConstant = 0x0; |
125 fFlagBits = 0x0; | 136 fFlagBits = 0x0; |
126 fStencilSettings.setDisabled(); | 137 fStencilSettings.setDisabled(); |
127 fCoverage = 0xff; | 138 fCoverage = 0xff; |
128 fDrawFace = kBoth_DrawFace; | 139 fDrawFace = kBoth_DrawFace; |
129 | 140 |
130 fHints = 0; | 141 fHints = 0; |
131 | 142 |
132 fColorProcInfoValid = false; | 143 fColorProcInfoValid = false; |
133 fCoverageProcInfoValid = false; | 144 fCoverageProcInfoValid = false; |
134 } | 145 } |
(...skipping 26 matching lines...) Expand all Loading... |
161 for (int i = 0; i < paint.numColorStages(); ++i) { | 172 for (int i = 0; i < paint.numColorStages(); ++i) { |
162 fColorStages.push_back(paint.getColorStage(i)); | 173 fColorStages.push_back(paint.getColorStage(i)); |
163 } | 174 } |
164 | 175 |
165 for (int i = 0; i < paint.numCoverageStages(); ++i) { | 176 for (int i = 0; i < paint.numCoverageStages(); ++i) { |
166 fCoverageStages.push_back(paint.getCoverageStage(i)); | 177 fCoverageStages.push_back(paint.getCoverageStage(i)); |
167 } | 178 } |
168 | 179 |
169 fXPFactory.reset(SkRef(paint.getXPFactory())); | 180 fXPFactory.reset(SkRef(paint.getXPFactory())); |
170 | 181 |
| 182 this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff()); |
171 this->setRenderTarget(rt); | 183 this->setRenderTarget(rt); |
172 | 184 |
173 fViewMatrix = vm; | 185 fViewMatrix = vm; |
174 | 186 |
175 // These have no equivalent in GrPaint, set them to defaults | 187 // These have no equivalent in GrPaint, set them to defaults |
| 188 fBlendConstant = 0x0; |
176 fDrawFace = kBoth_DrawFace; | 189 fDrawFace = kBoth_DrawFace; |
177 fStencilSettings.setDisabled(); | 190 fStencilSettings.setDisabled(); |
178 fFlagBits = 0; | 191 fFlagBits = 0; |
179 fHints = 0; | 192 fHints = 0; |
180 | 193 |
181 // Enable the clip bit | 194 // Enable the clip bit |
182 this->enableState(GrDrawState::kClip_StateBit); | 195 this->enableState(GrDrawState::kClip_StateBit); |
183 | 196 |
184 this->setColor(paint.getColor()); | 197 this->setColor(paint.getColor()); |
185 this->setState(GrDrawState::kDither_StateBit, paint.isDither()); | 198 this->setState(GrDrawState::kDither_StateBit, paint.isDither()); |
186 this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias()); | 199 this->setState(GrDrawState::kHWAntialias_StateBit, paint.isAntiAlias()); |
187 | 200 |
188 this->setCoverage(0xFF); | 201 this->setCoverage(0xFF); |
189 fColorProcInfoValid = false; | 202 fColorProcInfoValid = false; |
190 fCoverageProcInfoValid = false; | 203 fCoverageProcInfoValid = false; |
191 } | 204 } |
192 | 205 |
193 //////////////////////////////////////////////////////////////////////////////// | 206 //////////////////////////////////////////////////////////////////////////////// |
194 | 207 |
195 bool GrDrawState::couldApplyCoverage(const GrDrawTargetCaps& caps) const { | 208 bool GrDrawState::couldApplyCoverage(const GrDrawTargetCaps& caps) const { |
196 if (caps.dualSourceBlendingSupport()) { | 209 if (caps.dualSourceBlendingSupport()) { |
197 return true; | 210 return true; |
198 } | 211 } |
199 | 212 // we can correctly apply coverage if a) we have dual source blending |
200 this->calcColorInvariantOutput(); | 213 // or b) one of our blend optimizations applies |
201 this->calcCoverageInvariantOutput(); | 214 // or c) the src, dst blend coeffs are 1,0 and we will read Dst Color |
202 return fXPFactory->canApplyCoverage(fColorProcInfo, fCoverageProcInfo, | 215 GrBlendCoeff srcCoeff; |
203 this->isCoverageDrawing(), this->isColor
WriteDisabled()); | 216 GrBlendCoeff dstCoeff; |
| 217 BlendOpt opt = this->getBlendOpt(true, &srcCoeff, &dstCoeff); |
| 218 return GrDrawState::kNone_BlendOpt != opt || |
| 219 (this->willEffectReadDstColor() && |
| 220 kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff); |
204 } | 221 } |
205 | 222 |
206 bool GrDrawState::hasSolidCoverage() const { | 223 bool GrDrawState::hasSolidCoverage() const { |
207 // If we're drawing coverage directly then coverage is effectively treated a
s color. | 224 // If we're drawing coverage directly then coverage is effectively treated a
s color. |
208 if (this->isCoverageDrawing()) { | 225 if (this->isCoverageDrawing()) { |
209 return true; | 226 return true; |
210 } | 227 } |
211 | 228 |
212 if (this->numCoverageStages() > 0) { | 229 if (this->numCoverageStages() > 0) { |
213 return false; | 230 return false; |
214 } | 231 } |
215 | 232 |
216 this->calcCoverageInvariantOutput(); | 233 this->calcCoverageInvariantOutput(); |
217 return fCoverageProcInfo.isSolidWhite(); | 234 return fCoverageProcInfo.isSolidWhite(); |
218 } | 235 } |
219 | 236 |
220 //////////////////////////////////////////////////////////////////////////////s | 237 //////////////////////////////////////////////////////////////////////////////s |
221 | 238 |
222 bool GrDrawState::willEffectReadDstColor() const { | 239 bool GrDrawState::willEffectReadDstColor() const { |
223 this->calcColorInvariantOutput(); | |
224 this->calcCoverageInvariantOutput(); | |
225 // TODO: Remove need to create the XP here. | |
226 // Also once all custom blends are turned into XPs we can remove the n
eed | |
227 // to check other stages since only xp's will be able to read dst | |
228 SkAutoTUnref<GrXferProcessor> xferProcessor(fXPFactory->createXferProcessor(
fColorProcInfo, | |
229
fCoverageProcInfo)); | |
230 if (xferProcessor && xferProcessor->willReadDstColor()) { | |
231 return true; | |
232 } | |
233 | |
234 if (!this->isColorWriteDisabled()) { | 240 if (!this->isColorWriteDisabled()) { |
| 241 this->calcColorInvariantOutput(); |
235 if (fColorProcInfo.readsDst()) { | 242 if (fColorProcInfo.readsDst()) { |
236 return true; | 243 return true; |
237 } | 244 } |
238 } | 245 } |
| 246 this->calcCoverageInvariantOutput(); |
239 return fCoverageProcInfo.readsDst(); | 247 return fCoverageProcInfo.readsDst(); |
240 } | 248 } |
241 | 249 |
242 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { | 250 void GrDrawState::AutoRestoreEffects::set(GrDrawState* ds) { |
243 if (fDrawState) { | 251 if (fDrawState) { |
244 // See the big comment on the class definition about GPs. | 252 // See the big comment on the class definition about GPs. |
245 if (SK_InvalidUniqueID == fOriginalGPID) { | 253 if (SK_InvalidUniqueID == fOriginalGPID) { |
246 fDrawState->fGeometryProcessor.reset(NULL); | 254 fDrawState->fGeometryProcessor.reset(NULL); |
247 } else { | 255 } else { |
248 SkASSERT(fDrawState->getGeometryProcessor()->getUniqueID() == | 256 SkASSERT(fDrawState->getGeometryProcessor()->getUniqueID() == |
(...skipping 24 matching lines...) Expand all Loading... |
273 fCoverageEffectCnt = ds->numCoverageStages(); | 281 fCoverageEffectCnt = ds->numCoverageStages(); |
274 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) | 282 SkDEBUGCODE(++ds->fBlockEffectRemovalCnt;) |
275 } | 283 } |
276 } | 284 } |
277 | 285 |
278 //////////////////////////////////////////////////////////////////////////////// | 286 //////////////////////////////////////////////////////////////////////////////// |
279 | 287 |
280 // Some blend modes allow folding a fractional coverage value into the color's a
lpha channel, while | 288 // Some blend modes allow folding a fractional coverage value into the color's a
lpha channel, while |
281 // others will blend incorrectly. | 289 // others will blend incorrectly. |
282 bool GrDrawState::canTweakAlphaForCoverage() const { | 290 bool GrDrawState::canTweakAlphaForCoverage() const { |
283 return fXPFactory->canTweakAlphaForCoverage(this->isCoverageDrawing()); | 291 /* |
| 292 The fractional coverage is f. |
| 293 The src and dst coeffs are Cs and Cd. |
| 294 The dst and src colors are S and D. |
| 295 We want the blend to compute: f*Cs*S + (f*Cd + (1-f))D. By tweaking the sou
rce color's alpha |
| 296 we're replacing S with S'=fS. It's obvious that that first term will always
be ok. The second |
| 297 term can be rearranged as [1-(1-Cd)f]D. By substituting in the various poss
ibilities for Cd we |
| 298 find that only 1, ISA, and ISC produce the correct destination when applied
to S' and D. |
| 299 Also, if we're directly rendering coverage (isCoverageDrawing) then coverag
e is treated as |
| 300 color by definition. |
| 301 */ |
| 302 return kOne_GrBlendCoeff == fDstBlend || |
| 303 kISA_GrBlendCoeff == fDstBlend || |
| 304 kISC_GrBlendCoeff == fDstBlend || |
| 305 this->isCoverageDrawing(); |
284 } | 306 } |
285 | 307 |
286 //////////////////////////////////////////////////////////////////////////////// | 308 //////////////////////////////////////////////////////////////////////////////// |
287 | 309 |
288 void GrDrawState::AutoViewMatrixRestore::restore() { | 310 void GrDrawState::AutoViewMatrixRestore::restore() { |
289 if (fDrawState) { | 311 if (fDrawState) { |
290 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) | 312 SkDEBUGCODE(--fDrawState->fBlockEffectRemovalCnt;) |
291 fDrawState->fViewMatrix = fViewMatrix; | 313 fDrawState->fViewMatrix = fViewMatrix; |
292 SkASSERT(fDrawState->numColorStages() >= fNumColorStages); | 314 SkASSERT(fDrawState->numColorStages() >= fNumColorStages); |
293 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; | 315 int numCoverageStages = fSavedCoordChanges.count() - fNumColorStages; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
371 } | 393 } |
372 | 394 |
373 //////////////////////////////////////////////////////////////////////////////// | 395 //////////////////////////////////////////////////////////////////////////////// |
374 | 396 |
375 GrDrawState::~GrDrawState() { | 397 GrDrawState::~GrDrawState() { |
376 SkASSERT(0 == fBlockEffectRemovalCnt); | 398 SkASSERT(0 == fBlockEffectRemovalCnt); |
377 } | 399 } |
378 | 400 |
379 //////////////////////////////////////////////////////////////////////////////// | 401 //////////////////////////////////////////////////////////////////////////////// |
380 | 402 |
| 403 GrDrawState::BlendOpt GrDrawState::getBlendOpt(bool forceCoverage, |
| 404 GrBlendCoeff* srcCoeff, |
| 405 GrBlendCoeff* dstCoeff) const { |
| 406 GrBlendCoeff bogusSrcCoeff, bogusDstCoeff; |
| 407 if (NULL == srcCoeff) { |
| 408 srcCoeff = &bogusSrcCoeff; |
| 409 } |
| 410 if (NULL == dstCoeff) { |
| 411 dstCoeff = &bogusDstCoeff; |
| 412 } |
| 413 |
| 414 *srcCoeff = this->getSrcBlendCoeff(); |
| 415 *dstCoeff = this->getDstBlendCoeff(); |
| 416 |
| 417 if (this->isColorWriteDisabled()) { |
| 418 *srcCoeff = kZero_GrBlendCoeff; |
| 419 *dstCoeff = kOne_GrBlendCoeff; |
| 420 } |
| 421 |
| 422 bool srcAIsOne = this->srcAlphaWillBeOne(); |
| 423 bool dstCoeffIsOne = kOne_GrBlendCoeff == *dstCoeff || |
| 424 (kSA_GrBlendCoeff == *dstCoeff && srcAIsOne); |
| 425 bool dstCoeffIsZero = kZero_GrBlendCoeff == *dstCoeff || |
| 426 (kISA_GrBlendCoeff == *dstCoeff && srcAIsOne); |
| 427 |
| 428 // When coeffs are (0,1) there is no reason to draw at all, unless |
| 429 // stenciling is enabled. Having color writes disabled is effectively |
| 430 // (0,1). |
| 431 if ((kZero_GrBlendCoeff == *srcCoeff && dstCoeffIsOne)) { |
| 432 if (this->getStencil().doesWrite()) { |
| 433 return kEmitCoverage_BlendOpt; |
| 434 } else { |
| 435 *dstCoeff = kOne_GrBlendCoeff; |
| 436 return kSkipDraw_BlendOpt; |
| 437 } |
| 438 } |
| 439 |
| 440 bool hasCoverage = forceCoverage || !this->hasSolidCoverage(); |
| 441 |
| 442 // if we don't have coverage we can check whether the dst |
| 443 // has to read at all. If not, we'll disable blending. |
| 444 if (!hasCoverage) { |
| 445 if (dstCoeffIsZero) { |
| 446 if (kOne_GrBlendCoeff == *srcCoeff) { |
| 447 // if there is no coverage and coeffs are (1,0) then we |
| 448 // won't need to read the dst at all, it gets replaced by src |
| 449 *dstCoeff = kZero_GrBlendCoeff; |
| 450 return kNone_BlendOpt; |
| 451 } else if (kZero_GrBlendCoeff == *srcCoeff) { |
| 452 // if the op is "clear" then we don't need to emit a color |
| 453 // or blend, just write transparent black into the dst. |
| 454 *srcCoeff = kOne_GrBlendCoeff; |
| 455 *dstCoeff = kZero_GrBlendCoeff; |
| 456 return kEmitTransBlack_BlendOpt; |
| 457 } |
| 458 } |
| 459 } else if (this->isCoverageDrawing()) { |
| 460 // we have coverage but we aren't distinguishing it from alpha by reques
t. |
| 461 return kCoverageAsAlpha_BlendOpt; |
| 462 } else { |
| 463 // check whether coverage can be safely rolled into alpha |
| 464 // of if we can skip color computation and just emit coverage |
| 465 if (this->canTweakAlphaForCoverage()) { |
| 466 return kCoverageAsAlpha_BlendOpt; |
| 467 } |
| 468 if (dstCoeffIsZero) { |
| 469 if (kZero_GrBlendCoeff == *srcCoeff) { |
| 470 // the source color is not included in the blend |
| 471 // the dst coeff is effectively zero so blend works out to: |
| 472 // (c)(0)D + (1-c)D = (1-c)D. |
| 473 *dstCoeff = kISA_GrBlendCoeff; |
| 474 return kEmitCoverage_BlendOpt; |
| 475 } else if (srcAIsOne) { |
| 476 // the dst coeff is effectively zero so blend works out to: |
| 477 // cS + (c)(0)D + (1-c)D = cS + (1-c)D. |
| 478 // If Sa is 1 then we can replace Sa with c |
| 479 // and set dst coeff to 1-Sa. |
| 480 *dstCoeff = kISA_GrBlendCoeff; |
| 481 return kCoverageAsAlpha_BlendOpt; |
| 482 } |
| 483 } else if (dstCoeffIsOne) { |
| 484 // the dst coeff is effectively one so blend works out to: |
| 485 // cS + (c)(1)D + (1-c)D = cS + D. |
| 486 *dstCoeff = kOne_GrBlendCoeff; |
| 487 return kCoverageAsAlpha_BlendOpt; |
| 488 } |
| 489 } |
| 490 |
| 491 return kNone_BlendOpt; |
| 492 } |
| 493 |
381 bool GrDrawState::srcAlphaWillBeOne() const { | 494 bool GrDrawState::srcAlphaWillBeOne() const { |
382 this->calcColorInvariantOutput(); | 495 this->calcColorInvariantOutput(); |
383 if (this->isCoverageDrawing()) { | 496 if (this->isCoverageDrawing()) { |
384 this->calcCoverageInvariantOutput(); | 497 this->calcCoverageInvariantOutput(); |
385 return (fColorProcInfo.isOpaque() && fCoverageProcInfo.isOpaque()); | 498 return (fColorProcInfo.isOpaque() && fCoverageProcInfo.isOpaque()); |
386 } | 499 } |
387 return fColorProcInfo.isOpaque(); | 500 return fColorProcInfo.isOpaque(); |
388 } | 501 } |
389 | 502 |
390 bool GrDrawState::willBlendWithDst() const { | 503 bool GrDrawState::willBlendWithDst() const { |
391 this->calcColorInvariantOutput(); | 504 if (!this->hasSolidCoverage()) { |
392 this->calcCoverageInvariantOutput(); | 505 return true; |
393 return fXPFactory->willBlendWithDst(fColorProcInfo, fCoverageProcInfo, | 506 } |
394 this->isCoverageDrawing(), this->isColor
WriteDisabled()); | 507 |
| 508 if (this->willEffectReadDstColor()) { |
| 509 return true; |
| 510 } |
| 511 |
| 512 if (GrBlendCoeffRefsDst(this->getSrcBlendCoeff())) { |
| 513 return true; |
| 514 } |
| 515 |
| 516 GrBlendCoeff dstCoeff = this->getDstBlendCoeff(); |
| 517 if (!(kZero_GrBlendCoeff == dstCoeff || |
| 518 (kISA_GrBlendCoeff == dstCoeff && this->srcAlphaWillBeOne()))) { |
| 519 return true; |
| 520 } |
| 521 |
| 522 return false; |
395 } | 523 } |
396 | 524 |
397 void GrDrawState::calcColorInvariantOutput() const { | 525 void GrDrawState::calcColorInvariantOutput() const { |
398 if (!fColorProcInfoValid) { | 526 if (!fColorProcInfoValid) { |
399 GrColor color; | 527 GrColor color; |
400 GrColorComponentFlags flags; | 528 GrColorComponentFlags flags; |
401 if (this->hasColorVertexAttribute()) { | 529 if (this->hasColorVertexAttribute()) { |
402 if (fHints & kVertexColorsAreOpaque_Hint) { | 530 if (fHints & kVertexColorsAreOpaque_Hint) { |
403 flags = kA_GrColorComponentFlag; | 531 flags = kA_GrColorComponentFlag; |
404 color = 0xFF << GrColor_SHIFT_A; | 532 color = 0xFF << GrColor_SHIFT_A; |
(...skipping 21 matching lines...) Expand all Loading... |
426 color = 0; | 554 color = 0; |
427 } else { | 555 } else { |
428 flags = kRGBA_GrColorComponentFlags; | 556 flags = kRGBA_GrColorComponentFlags; |
429 color = this->getCoverageColor(); | 557 color = this->getCoverageColor(); |
430 } | 558 } |
431 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->n
umCoverageStages(), | 559 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), this->n
umCoverageStages(), |
432 color, flags, true, fGeometryPro
cessor.get()); | 560 color, flags, true, fGeometryPro
cessor.get()); |
433 fCoverageProcInfoValid = true; | 561 fCoverageProcInfoValid = true; |
434 } | 562 } |
435 } | 563 } |
| 564 |
OLD | NEW |