Chromium Code Reviews| Index: src/gpu/gl/GrGpuGL_program.cpp |
| diff --git a/src/gpu/gl/GrGpuGL_program.cpp b/src/gpu/gl/GrGpuGL_program.cpp |
| index 363d87fbfbf1089ccfe2f0007209d6b086c1e9f4..d58acf6b93b4532b038d4b645c8697ca9640a476 100644 |
| --- a/src/gpu/gl/GrGpuGL_program.cpp |
| +++ b/src/gpu/gl/GrGpuGL_program.cpp |
| @@ -206,7 +206,13 @@ GrGLProgram* GrGpuGL::ProgramCache::getProgram(const GrOptDrawState& optState, |
| #define GL_CALL(X) GR_GL_CALL(this->glInterface(), X) |
| bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstCopy) { |
| - SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*this->caps())); |
| + SkAutoTUnref<GrOptDrawState> optState(GrOptDrawState::Create(this->getDrawState(), |
| + *this->caps(), |
| + type)); |
| + |
| + if (NULL == optState.get()) { |
|
bsalomon
2014/10/06 20:40:20
howabout if (!optState) ?
|
| + return false; |
| + } |
| // GrGpu::setupClipAndFlushState should have already checked this and bailed if not true. |
| SkASSERT(optState->getRenderTarget()); |
| @@ -294,7 +300,13 @@ bool GrGpuGL::flushGraphicsState(DrawType type, const GrDeviceCoordTexture* dstC |
| } |
| void GrGpuGL::setupGeometry(const DrawInfo& info, size_t* indexOffsetInBytes) { |
| - SkAutoTUnref<GrOptDrawState> optState(this->getDrawState().createOptState(*this->caps())); |
| + SkAutoTUnref<GrOptDrawState> optState( |
| + GrOptDrawState::Create(this->getDrawState(), *this->caps(), |
| + PrimTypeToDrawType(info.primitiveType()))); |
| + |
| + // If the optState would is NULL it should have been caught in flushGraphicsState before getting |
| + // here. |
| + SkASSERT(optState.get()); |
|
bsalomon
2014/10/06 20:40:20
SkASSERT(optState); (autotunref casts to bool)
|
| GrGLsizei stride = static_cast<GrGLsizei>(optState->getVertexStride()); |