| Index: src/gpu/GrDrawState.cpp
|
| diff --git a/src/gpu/GrDrawState.cpp b/src/gpu/GrDrawState.cpp
|
| index 8285a324d5902ce11d3dc71324ca9b69c3a0bf13..00d678a4f50926a53bb24c1ab4ee4672f3974208 100644
|
| --- a/src/gpu/GrDrawState.cpp
|
| +++ b/src/gpu/GrDrawState.cpp
|
| @@ -59,6 +59,7 @@ void GrDrawState::setFromPaint(const GrPaint& paint, const SkMatrix& vm, GrRende
|
|
|
| this->setBlendFunc(paint.getSrcBlendCoeff(), paint.getDstBlendCoeff());
|
| this->setCoverage(paint.getCoverage());
|
| + fBlendOptFlags = kInvalid_BlendOptFlag;
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -119,6 +120,7 @@ void GrDrawState::setVertexAttribs(const GrVertexAttrib* attribs, int count) {
|
| overlapCheck |= (mask << offsetShift);
|
| #endif
|
| }
|
| + fBlendOptFlags = kInvalid_BlendOptFlag;
|
| // Positions must be specified.
|
| SkASSERT(-1 != fFixedFunctionVertexAttribIndices[kPosition_GrVertexAttribBinding]);
|
| }
|
| @@ -137,6 +139,7 @@ void GrDrawState::setDefaultVertexAttribs() {
|
| 0xff,
|
| sizeof(fFixedFunctionVertexAttribIndices));
|
| fFixedFunctionVertexAttribIndices[kPosition_GrVertexAttribBinding] = 0;
|
| + fBlendOptFlags = kInvalid_BlendOptFlag;
|
| }
|
|
|
| ////////////////////////////////////////////////////////////////////////////////
|
| @@ -286,6 +289,31 @@ bool GrDrawState::canTweakAlphaForCoverage() const {
|
| GrDrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage,
|
| GrBlendCoeff* srcCoeff,
|
| GrBlendCoeff* dstCoeff) const {
|
| + GrBlendCoeff bogusSrcCoeff, bogusDstCoeff;
|
| + if (NULL == srcCoeff) {
|
| + srcCoeff = &bogusSrcCoeff;
|
| + }
|
| +
|
| + if (NULL == dstCoeff) {
|
| + dstCoeff = &bogusDstCoeff;
|
| + }
|
| +
|
| + if (0 == (fBlendOptFlags & kInvalid_BlendOptFlag)) {
|
| + *srcCoeff = fOptSrcBlend;
|
| + *dstCoeff = fOptDstBlend;
|
| + return fBlendOptFlags;
|
| + }
|
| +
|
| + fBlendOptFlags = this->calcBlendOpts(forceCoverage, srcCoeff, dstCoeff);
|
| + fOptSrcBlend = *srcCoeff;
|
| + fOptDstBlend = *dstCoeff;
|
| +
|
| + return fBlendOptFlags;
|
| +}
|
| +
|
| +GrDrawState::BlendOptFlags GrDrawState::calcBlendOpts(bool forceCoverage,
|
| + GrBlendCoeff* srcCoeff,
|
| + GrBlendCoeff* dstCoeff) const {
|
|
|
| GrBlendCoeff bogusSrcCoeff, bogusDstCoeff;
|
| if (NULL == srcCoeff) {
|
| @@ -298,6 +326,7 @@ GrDrawState::BlendOptFlags GrDrawState::getBlendOpts(bool forceCoverage,
|
| }
|
| *dstCoeff = this->getDstBlendCoeff();
|
|
|
| +
|
| if (this->isColorWriteDisabled()) {
|
| *srcCoeff = kZero_GrBlendCoeff;
|
| *dstCoeff = kOne_GrBlendCoeff;
|
|
|