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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 GrDrawState::~GrDrawState() { | 333 GrDrawState::~GrDrawState() { |
334 SkASSERT(0 == fBlockEffectRemovalCnt); | 334 SkASSERT(0 == fBlockEffectRemovalCnt); |
335 } | 335 } |
336 | 336 |
337 //////////////////////////////////////////////////////////////////////////////// | 337 //////////////////////////////////////////////////////////////////////////////// |
338 | 338 |
339 bool GrDrawState::willBlendWithDst(const GrPrimitiveProcessor* pp) const { | 339 bool GrDrawState::willBlendWithDst(const GrPrimitiveProcessor* pp) const { |
340 this->calcColorInvariantOutput(pp); | 340 this->calcColorInvariantOutput(pp); |
341 this->calcCoverageInvariantOutput(pp); | 341 this->calcCoverageInvariantOutput(pp); |
342 return fXPFactory->willBlendWithDst(fColorProcInfo, fCoverageProcInfo, | 342 |
343 this->isColorWriteDisabled()); | 343 GrXPFactory::InvariantOutput output; |
| 344 fXPFactory->getInvariantOutput(fColorProcInfo, fCoverageProcInfo, this->isCo
lorWriteDisabled(), |
| 345 &output); |
| 346 return output.fWillBlendWithDst; |
344 } | 347 } |
345 | 348 |
346 void GrDrawState::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const
{ | 349 void GrDrawState::calcColorInvariantOutput(const GrPrimitiveProcessor* pp) const
{ |
347 if (!fColorProcInfoValid || fColorPrimProc != pp) { | 350 if (!fColorProcInfoValid || fColorPrimProc != pp) { |
348 fColorProcInfo.calcColorWithPrimProc(pp, fColorStages.begin(), this->num
ColorStages()); | 351 fColorProcInfo.calcColorWithPrimProc(pp, fColorStages.begin(), this->num
ColorStages()); |
349 fColorProcInfoValid = true; | 352 fColorProcInfoValid = true; |
350 fColorPrimProc = pp; | 353 fColorPrimProc = pp; |
351 } | 354 } |
352 } | 355 } |
353 | 356 |
(...skipping 19 matching lines...) Expand all Loading... |
373 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { | 376 void GrDrawState::calcCoverageInvariantOutput(GrColor coverage) const { |
374 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { | 377 if (!fCoverageProcInfoValid || coverage != fCoverageCache) { |
375 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; | 378 GrColorComponentFlags flags = kRGBA_GrColorComponentFlags; |
376 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), | 379 fCoverageProcInfo.calcWithInitialValues(fCoverageStages.begin(), |
377 this->numCoverageStages(), cover
age, flags, | 380 this->numCoverageStages(), cover
age, flags, |
378 true); | 381 true); |
379 fCoverageProcInfoValid = true; | 382 fCoverageProcInfoValid = true; |
380 fCoverageCache = coverage; | 383 fCoverageCache = coverage; |
381 } | 384 } |
382 } | 385 } |
OLD | NEW |