Index: src/gpu/gl/GrGpuGL.cpp |
diff --git a/src/gpu/gl/GrGpuGL.cpp b/src/gpu/gl/GrGpuGL.cpp |
index 5987c7000f6e7a216d3f09afee549830da463a89..5460a0194599594f8f0cf23114ef3e0948584999 100644 |
--- a/src/gpu/gl/GrGpuGL.cpp |
+++ b/src/gpu/gl/GrGpuGL.cpp |
@@ -1344,8 +1344,11 @@ void GrGLGpu::flushScissor(const GrScissorState& scissorState, |
} |
bool GrGLGpu::flushGLState(const GrOptDrawState& optState) { |
+ GrXferProcessor::BlendInfo blendInfo; |
+ optState.getXferProcessor()->getBlendInfo(&blendInfo); |
+ |
this->flushDither(optState.isDitherState()); |
- this->flushColorWriteDisable(optState.isColorWriteDisabled()); |
+ this->flushColorWrite(blendInfo.fWriteColor); |
this->flushDrawFace(optState.getDrawFace()); |
fCurrentProgram.reset(fProgramCache->getProgram(optState)); |
@@ -1362,7 +1365,9 @@ bool GrGLGpu::flushGLState(const GrOptDrawState& optState) { |
fHWProgramID = programID; |
} |
- this->flushBlend(optState); |
+ if (blendInfo.fWriteColor) { |
+ this->flushBlend(blendInfo); |
+ } |
fCurrentProgram->setData(optState); |
@@ -1864,7 +1869,7 @@ void GrGLGpu::onDraw(const GrOptDrawState& ds, const GrDrawTarget::DrawInfo& inf |
} |
void GrGLGpu::onStencilPath(const GrPath* path, const StencilPathState& state) { |
- this->flushColorWriteDisable(true); |
+ this->flushColorWrite(false); |
this->flushDrawFace(GrDrawState::kBoth_DrawFace); |
GrGLRenderTarget* rt = static_cast<GrGLRenderTarget*>(state.fRenderTarget); |
@@ -2055,12 +2060,10 @@ void GrGLGpu::flushHWAAState(GrRenderTarget* rt, bool useHWAA, bool isLineDraw) |
} |
} |
-void GrGLGpu::flushBlend(const GrOptDrawState& optState) { |
+void GrGLGpu::flushBlend(const GrXferProcessor::BlendInfo& blendInfo) { |
// Any optimization to disable blending should have already been applied and |
// tweaked the coeffs to (1, 0). |
- GrXferProcessor::BlendInfo blendInfo; |
- optState.getXferProcessor()->getBlendInfo(&blendInfo); |
GrBlendCoeff srcCoeff = blendInfo.fSrcBlend; |
GrBlendCoeff dstCoeff = blendInfo.fDstBlend; |
bool blendOff = kOne_GrBlendCoeff == srcCoeff && kZero_GrBlendCoeff == dstCoeff; |
@@ -2222,8 +2225,8 @@ void GrGLGpu::flushDither(bool dither) { |
} |
} |
-void GrGLGpu::flushColorWriteDisable(bool disableColorWrites) { |
- if (disableColorWrites) { |
+void GrGLGpu::flushColorWrite(bool writeColor) { |
+ if (!writeColor) { |
if (kNo_TriState != fHWWriteToColor) { |
GL_CALL(ColorMask(GR_GL_FALSE, GR_GL_FALSE, |
GR_GL_FALSE, GR_GL_FALSE)); |