Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Unified Diff: src/gpu/GrOptDrawState.cpp

Issue 701123003: Remove cached OptDrawState from GrDrawState. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Update comment Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrOptDrawState.cpp
diff --git a/src/gpu/GrOptDrawState.cpp b/src/gpu/GrOptDrawState.cpp
index a9d8ec48881c1fc77c7d8f6b86bd2f1e72e75f65..c764b432a17abcff1e4dc6f0b25ce13ada6ff0eb 100644
--- a/src/gpu/GrOptDrawState.cpp
+++ b/src/gpu/GrOptDrawState.cpp
@@ -99,39 +99,23 @@ GrOptDrawState* GrOptDrawState::Create(const GrDrawState& drawState,
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);
-
- // 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
+ 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->ref();
- return drawState.fCachedOptState;
+
+ return SkNEW_ARGS(GrOptDrawState, (drawState, blendFlags, srcCoeff,
+ dstCoeff, gpu, dstCopy, drawType));
}
void GrOptDrawState::setOutputStateInfo(const GrDrawState& ds,
« no previous file with comments | « src/gpu/GrOptDrawState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698