Index: src/gpu/GrRODrawState.cpp |
diff --git a/src/gpu/GrRODrawState.cpp b/src/gpu/GrRODrawState.cpp |
index e522008cae4ab7c256b602d75330dde1bc0b6ac5..f7e486f925983522c936d5dc6f96bdf3245dd69f 100644 |
--- a/src/gpu/GrRODrawState.cpp |
+++ b/src/gpu/GrRODrawState.cpp |
@@ -184,6 +184,26 @@ |
dstCoeff = &bogusDstCoeff; |
} |
+ if (forceCoverage) { |
+ return this->calcBlendOpts(true, srcCoeff, dstCoeff); |
+ } |
+ |
+ if (0 == (fBlendOptFlags & kInvalid_BlendOptFlag)) { |
+ *srcCoeff = fOptSrcBlend; |
+ *dstCoeff = fOptDstBlend; |
+ return fBlendOptFlags; |
+ } |
+ |
+ fBlendOptFlags = this->calcBlendOpts(forceCoverage, srcCoeff, dstCoeff); |
+ fOptSrcBlend = *srcCoeff; |
+ fOptDstBlend = *dstCoeff; |
+ |
+ return fBlendOptFlags; |
+} |
+ |
+GrRODrawState::BlendOptFlags GrRODrawState::calcBlendOpts(bool forceCoverage, |
+ GrBlendCoeff* srcCoeff, |
+ GrBlendCoeff* dstCoeff) const { |
*srcCoeff = this->getSrcBlendCoeff(); |
*dstCoeff = this->getDstBlendCoeff(); |
@@ -352,3 +372,13 @@ |
return (kA_GrColorComponentFlag & validComponentFlags) && 0xFF == GrColorUnpackA(color); |
} |
+//////////////////////////////////////////////////////////////////////////////// |
+ |
+bool GrRODrawState::canIgnoreColorAttribute() const { |
+ if (fBlendOptFlags & kInvalid_BlendOptFlag) { |
+ this->getBlendOpts(); |
+ } |
+ return SkToBool(fBlendOptFlags & (GrRODrawState::kEmitTransBlack_BlendOptFlag | |
+ GrRODrawState::kEmitCoverage_BlendOptFlag)); |
+} |
+ |