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 #include "GrPaint.h" | 9 #include "GrPaint.h" |
10 | 10 |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 | 320 |
321 bool covIsZero = !this->isCoverageDrawing() && | 321 bool covIsZero = !this->isCoverageDrawing() && |
322 !this->hasCoverageVertexAttribute() && | 322 !this->hasCoverageVertexAttribute() && |
323 0 == this->getCoverage(); | 323 0 == this->getCoverage(); |
324 // When coeffs are (0,1) there is no reason to draw at all, unless | 324 // When coeffs are (0,1) there is no reason to draw at all, unless |
325 // stenciling is enabled. Having color writes disabled is effectively | 325 // stenciling is enabled. Having color writes disabled is effectively |
326 // (0,1). The same applies when coverage is known to be 0. | 326 // (0,1). The same applies when coverage is known to be 0. |
327 if ((kZero_GrBlendCoeff == *srcCoeff && dstCoeffIsOne) || covIsZero) { | 327 if ((kZero_GrBlendCoeff == *srcCoeff && dstCoeffIsOne) || covIsZero) { |
328 if (this->getStencil().doesWrite()) { | 328 if (this->getStencil().doesWrite()) { |
329 return kDisableBlend_BlendOptFlag | | 329 return kDisableBlend_BlendOptFlag | |
330 kEmitTransBlack_BlendOptFlag; | 330 kEmitCoverage_BlendOptFlag; |
331 } else { | 331 } else { |
332 return kSkipDraw_BlendOptFlag; | 332 return kSkipDraw_BlendOptFlag; |
333 } | 333 } |
334 } | 334 } |
335 | 335 |
336 // check for coverage due to constant coverage, per-vertex coverage, or cove
rage stage | 336 // check for coverage due to constant coverage, per-vertex coverage, or cove
rage stage |
337 bool hasCoverage = forceCoverage || | 337 bool hasCoverage = forceCoverage || |
338 0xffffffff != this->getCoverage() || | 338 0xffffffff != this->getCoverage() || |
339 this->hasCoverageVertexAttribute() || | 339 this->hasCoverageVertexAttribute() || |
340 fCoverageStages.count() > 0; | 340 fCoverageStages.count() > 0; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); | 475 fDrawState->fColorStages[s].saveCoordChange(&fSavedCoordChanges[i]); |
476 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); | 476 fDrawState->fColorStages[s].localCoordChange(coordChangeMatrix); |
477 } | 477 } |
478 | 478 |
479 int numCoverageStages = fDrawState->numCoverageStages(); | 479 int numCoverageStages = fDrawState->numCoverageStages(); |
480 for (int s = 0; s < numCoverageStages; ++s, ++i) { | 480 for (int s = 0; s < numCoverageStages; ++s, ++i) { |
481 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); | 481 fDrawState->fCoverageStages[s].saveCoordChange(&fSavedCoordChanges[i]); |
482 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); | 482 fDrawState->fCoverageStages[s].localCoordChange(coordChangeMatrix); |
483 } | 483 } |
484 } | 484 } |
OLD | NEW |