| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "GrGpuGL.h" | 8 #include "GrGpuGL.h" |
| 9 | 9 |
| 10 #include "builders/GrGLProgramBuilder.h" | 10 #include "builders/GrGLProgramBuilder.h" |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 const GrRenderTarget* rt = optState.getRenderTarget(); | 209 const GrRenderTarget* rt = optState.getRenderTarget(); |
| 210 SkISize size; | 210 SkISize size; |
| 211 size.set(rt->width(), rt->height()); | 211 size.set(rt->width(), rt->height()); |
| 212 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s
ize, rt->origin()); | 212 this->glPathRendering()->setProjectionMatrix(optState.getViewMatrix(), s
ize, rt->origin()); |
| 213 } else { | 213 } else { |
| 214 this->flushMiscFixedFunctionState(optState); | 214 this->flushMiscFixedFunctionState(optState); |
| 215 | 215 |
| 216 GrBlendCoeff srcCoeff = optState.getSrcBlendCoeff(); | 216 GrBlendCoeff srcCoeff = optState.getSrcBlendCoeff(); |
| 217 GrBlendCoeff dstCoeff = optState.getDstBlendCoeff(); | 217 GrBlendCoeff dstCoeff = optState.getDstBlendCoeff(); |
| 218 | 218 |
| 219 // In these blend coeff's we end up drawing nothing so we can skip draw
all together | |
| 220 if (kZero_GrBlendCoeff == srcCoeff && kOne_GrBlendCoeff == dstCoeff && | |
| 221 !optState.getStencil().doesWrite()) { | |
| 222 return false; | |
| 223 } | |
| 224 | |
| 225 fCurrentProgram.reset(fProgramCache->getProgram(optState, type)); | 219 fCurrentProgram.reset(fProgramCache->getProgram(optState, type)); |
| 226 if (NULL == fCurrentProgram.get()) { | 220 if (NULL == fCurrentProgram.get()) { |
| 227 SkDEBUGFAIL("Failed to create program!"); | 221 SkDEBUGFAIL("Failed to create program!"); |
| 228 return false; | 222 return false; |
| 229 } | 223 } |
| 230 | 224 |
| 231 fCurrentProgram.get()->ref(); | 225 fCurrentProgram.get()->ref(); |
| 232 | 226 |
| 233 GrGLuint programID = fCurrentProgram->programID(); | 227 GrGLuint programID = fCurrentProgram->programID(); |
| 234 if (fHWProgramID != programID) { | 228 if (fHWProgramID != programID) { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 305 } | 299 } |
| 306 | 300 |
| 307 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, | 301 void GrGpuGL::buildProgramDesc(const GrOptDrawState& optState, |
| 308 const GrProgramDesc::DescInfo& descInfo, | 302 const GrProgramDesc::DescInfo& descInfo, |
| 309 GrGpu::DrawType drawType, | 303 GrGpu::DrawType drawType, |
| 310 GrProgramDesc* desc) { | 304 GrProgramDesc* desc) { |
| 311 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, desc)
) { | 305 if (!GrGLProgramDescBuilder::Build(optState, descInfo, drawType, this, desc)
) { |
| 312 SkDEBUGFAIL("Failed to generate GL program descriptor"); | 306 SkDEBUGFAIL("Failed to generate GL program descriptor"); |
| 313 } | 307 } |
| 314 } | 308 } |
| OLD | NEW |