| 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 "GrGLProgram.h" | 8 #include "GrGLProgram.h" |
| 9 | 9 |
| 10 #include "GrAllocator.h" | 10 #include "GrAllocator.h" |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 } | 198 } |
| 199 | 199 |
| 200 void GrGLProgram::didSetData(GrGpu::DrawType drawType) { | 200 void GrGLProgram::didSetData(GrGpu::DrawType drawType) { |
| 201 SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType)); | 201 SkASSERT(!GrGpu::IsPathRenderingDrawType(drawType)); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void GrGLProgram::setColor(const GrOptDrawState& optState, | 204 void GrGLProgram::setColor(const GrOptDrawState& optState, |
| 205 GrColor color, | 205 GrColor color, |
| 206 SharedGLState* sharedState) { | 206 SharedGLState* sharedState) { |
| 207 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); | 207 const GrGLProgramDesc::GLKeyHeader& header = fDesc.header(); |
| 208 if (!optState.hasColorVertexAttribute()) { | 208 if (!optState.hasColorVertexAttribute()) { |
| 209 switch (header.fColorInput) { | 209 switch (header.fColorInput) { |
| 210 case GrGLProgramDesc::kAttribute_ColorInput: | 210 case GrGLProgramDesc::kAttribute_ColorInput: |
| 211 SkASSERT(-1 != header.fColorAttributeIndex); | 211 SkASSERT(-1 != header.fColorAttributeIndex); |
| 212 if (sharedState->fConstAttribColor != color || | 212 if (sharedState->fConstAttribColor != color || |
| 213 sharedState->fConstAttribColorIndex != header.fColorAttribut
eIndex) { | 213 sharedState->fConstAttribColorIndex != header.fColorAttribut
eIndex) { |
| 214 // OpenGL ES only supports the float varieties of glVertexAt
trib | 214 // OpenGL ES only supports the float varieties of glVertexAt
trib |
| 215 GrGLfloat c[4]; | 215 GrGLfloat c[4]; |
| 216 GrColorToRGBAFloat(color, c); | 216 GrColorToRGBAFloat(color, c); |
| 217 GL_CALL(VertexAttrib4fv(header.fColorAttributeIndex, c)); | 217 GL_CALL(VertexAttrib4fv(header.fColorAttributeIndex, c)); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 236 SkFAIL("Unexpected color type."); | 236 SkFAIL("Unexpected color type."); |
| 237 } | 237 } |
| 238 } else { | 238 } else { |
| 239 sharedState->fConstAttribColorIndex = -1; | 239 sharedState->fConstAttribColorIndex = -1; |
| 240 } | 240 } |
| 241 } | 241 } |
| 242 | 242 |
| 243 void GrGLProgram::setCoverage(const GrOptDrawState& optState, | 243 void GrGLProgram::setCoverage(const GrOptDrawState& optState, |
| 244 GrColor coverage, | 244 GrColor coverage, |
| 245 SharedGLState* sharedState) { | 245 SharedGLState* sharedState) { |
| 246 const GrGLProgramDesc::KeyHeader& header = fDesc.getHeader(); | 246 const GrGLProgramDesc::GLKeyHeader& header = fDesc.header(); |
| 247 if (!optState.hasCoverageVertexAttribute()) { | 247 if (!optState.hasCoverageVertexAttribute()) { |
| 248 switch (header.fCoverageInput) { | 248 switch (header.fCoverageInput) { |
| 249 case GrGLProgramDesc::kAttribute_ColorInput: | 249 case GrGLProgramDesc::kAttribute_ColorInput: |
| 250 if (sharedState->fConstAttribCoverage != coverage || | 250 if (sharedState->fConstAttribCoverage != coverage || |
| 251 sharedState->fConstAttribCoverageIndex != header.fCoverageAt
tributeIndex) { | 251 sharedState->fConstAttribCoverageIndex != header.fCoverageAt
tributeIndex) { |
| 252 // OpenGL ES only supports the float varieties of glVertexA
ttrib | 252 // OpenGL ES only supports the float varieties of glVertexA
ttrib |
| 253 GrGLfloat c[4]; | 253 GrGLfloat c[4]; |
| 254 GrColorToRGBAFloat(coverage, c); | 254 GrColorToRGBAFloat(coverage, c); |
| 255 GL_CALL(VertexAttrib4fv(header.fCoverageAttributeIndex, c)); | 255 GL_CALL(VertexAttrib4fv(header.fCoverageAttributeIndex, c)); |
| 256 sharedState->fConstAttribCoverage = coverage; | 256 sharedState->fConstAttribCoverage = coverage; |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 for (int t = 0; t < numTransforms; ++t) { | 410 for (int t = 0; t < numTransforms; ++t) { |
| 411 const SkMatrix& transform = get_transform_matrix(proc, false, t); | 411 const SkMatrix& transform = get_transform_matrix(proc, false, t); |
| 412 GrGLPathRendering::PathTexGenComponents components = | 412 GrGLPathRendering::PathTexGenComponents components = |
| 413 GrGLPathRendering::kST_PathTexGenComponents; | 413 GrGLPathRendering::kST_PathTexGenComponents; |
| 414 if (proc.isPerspectiveCoordTransform(t, false)) { | 414 if (proc.isPerspectiveCoordTransform(t, false)) { |
| 415 components = GrGLPathRendering::kSTR_PathTexGenComponents; | 415 components = GrGLPathRendering::kSTR_PathTexGenComponents; |
| 416 } | 416 } |
| 417 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); | 417 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); |
| 418 } | 418 } |
| 419 } | 419 } |
| OLD | NEW |