Remove cached OptDrawState from GrDrawState.
Since we now snap and create the ODS one time in the inorder draw buffer,
there is no need for us to keep a cached version of it around.
BUG=skia:
Review URL: https://codereview.chromium.org/701123003
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index a9d8ec4..c764b43 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -99,39 +99,23 @@
GrGpu* gpu,
const GrDeviceCoordTexture* dstCopy,
GrGpu::DrawType drawType) {
- const GrDrawTargetCaps& caps = *gpu->caps();
- if (NULL == drawState.fCachedOptState || caps.getUniqueID() != drawState.fCachedCapsID) {
- GrBlendCoeff srcCoeff;
- GrBlendCoeff dstCoeff;
- BlendOptFlags blendFlags = (BlendOptFlags) drawState.getBlendOpts(false,
- &srcCoeff,
- &dstCoeff);
+ GrBlendCoeff srcCoeff;
+ GrBlendCoeff dstCoeff;
+ BlendOptFlags blendFlags = (BlendOptFlags) drawState.getBlendOpts(false,
+ &srcCoeff,
+ &dstCoeff);
- // If our blend coeffs are set to 0,1 we know we will not end up drawing unless we are
- // stenciling. When path rendering the stencil settings are not always set on the draw state
- // so we must check the draw type. In cases where we will skip drawing we simply return a
- // null GrOptDrawState.
- if (kZero_GrBlendCoeff == srcCoeff && kOne_GrBlendCoeff == dstCoeff &&
- !drawState.getStencil().doesWrite() && GrGpu::kStencilPath_DrawType != drawType) {
- return NULL;
- }
-
- drawState.fCachedOptState = SkNEW_ARGS(GrOptDrawState, (drawState, blendFlags, srcCoeff,
- dstCoeff, gpu, dstCopy, drawType));
- drawState.fCachedCapsID = caps.getUniqueID();
- } else {
-#ifdef SK_DEBUG
- GrBlendCoeff srcCoeff;
- GrBlendCoeff dstCoeff;
- BlendOptFlags blendFlags = (BlendOptFlags) drawState.getBlendOpts(false,
- &srcCoeff,
- &dstCoeff);
- SkASSERT(GrOptDrawState(drawState, blendFlags, srcCoeff, dstCoeff, gpu, dstCopy,
- drawType) == *drawState.fCachedOptState);
-#endif
+ // If our blend coeffs are set to 0,1 we know we will not end up drawing unless we are
+ // stenciling. When path rendering the stencil settings are not always set on the draw state
+ // so we must check the draw type. In cases where we will skip drawing we simply return a
+ // null GrOptDrawState.
+ if (kZero_GrBlendCoeff == srcCoeff && kOne_GrBlendCoeff == dstCoeff &&
+ !drawState.getStencil().doesWrite() && GrGpu::kStencilPath_DrawType != drawType) {
+ return NULL;
}
- drawState.fCachedOptState->ref();
- return drawState.fCachedOptState;
+
+ return SkNEW_ARGS(GrOptDrawState, (drawState, blendFlags, srcCoeff,
+ dstCoeff, gpu, dstCopy, drawType));
}
void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds,