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 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 | 225 |
226 void GrGLProgram::setCoverage(const GrOptDrawState& optState, uint8_t coverage)
{ | 226 void GrGLProgram::setCoverage(const GrOptDrawState& optState, uint8_t coverage)
{ |
227 const GrProgramDesc::KeyHeader& header = fDesc.header(); | 227 const GrProgramDesc::KeyHeader& header = fDesc.header(); |
228 switch (header.fCoverageInput) { | 228 switch (header.fCoverageInput) { |
229 case GrProgramDesc::kAttribute_ColorInput: | 229 case GrProgramDesc::kAttribute_ColorInput: |
230 // Attribute case is handled in GrGpuGL::setupGeometry | 230 // Attribute case is handled in GrGpuGL::setupGeometry |
231 break; | 231 break; |
232 case GrProgramDesc::kUniform_ColorInput: | 232 case GrProgramDesc::kUniform_ColorInput: |
233 if (fCoverage != coverage) { | 233 if (fCoverage != coverage) { |
234 // OpenGL ES doesn't support unsigned byte varieties of glUnifor
m | 234 // OpenGL ES doesn't support unsigned byte varieties of glUnifor
m |
235 static const float ONE_OVER_255 = 1.f / 255.f; | 235 GrGLfloat c = GrNormalizeByteToFloat(coverage); |
236 GrGLfloat c = coverage * ONE_OVER_255; | |
237 fProgramDataManager.set1f(fBuiltinUniformHandles.fCoverageUni, c
); | 236 fProgramDataManager.set1f(fBuiltinUniformHandles.fCoverageUni, c
); |
238 fCoverage = coverage; | 237 fCoverage = coverage; |
239 } | 238 } |
240 break; | 239 break; |
241 case GrProgramDesc::kAllOnes_ColorInput: | 240 case GrProgramDesc::kAllOnes_ColorInput: |
242 // Handled by shader creation | 241 // Handled by shader creation |
243 break; | 242 break; |
244 default: | 243 default: |
245 SkFAIL("Unexpected coverage type."); | 244 SkFAIL("Unexpected coverage type."); |
246 } | 245 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
378 for (int t = 0; t < numTransforms; ++t) { | 377 for (int t = 0; t < numTransforms; ++t) { |
379 const SkMatrix& transform = get_transform_matrix(proc, false, t); | 378 const SkMatrix& transform = get_transform_matrix(proc, false, t); |
380 GrGLPathRendering::PathTexGenComponents components = | 379 GrGLPathRendering::PathTexGenComponents components = |
381 GrGLPathRendering::kST_PathTexGenComponents; | 380 GrGLPathRendering::kST_PathTexGenComponents; |
382 if (proc.isPerspectiveCoordTransform(t, false)) { | 381 if (proc.isPerspectiveCoordTransform(t, false)) { |
383 components = GrGLPathRendering::kSTR_PathTexGenComponents; | 382 components = GrGLPathRendering::kSTR_PathTexGenComponents; |
384 } | 383 } |
385 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); | 384 fGpu->glPathRendering()->enablePathTexGen(texCoordIndex++, components, t
ransform); |
386 } | 385 } |
387 } | 386 } |
OLD | NEW |