OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 "gl/builders/GrGLProgramBuilder.h" | 8 #include "gl/builders/GrGLProgramBuilder.h" |
9 #include "GrSimpleTextureEffect.h" | 9 #include "GrSimpleTextureEffect.h" |
10 #include "gl/GrGLEffect.h" | 10 #include "gl/GrGLEffect.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 const GrEffectKey& key, | 24 const GrEffectKey& key, |
25 const char* outputColor, | 25 const char* outputColor, |
26 const char* inputColor, | 26 const char* inputColor, |
27 const TransformedCoordsArray& coords, | 27 const TransformedCoordsArray& coords, |
28 const TextureSamplerArray& samplers) SK_OVERRIDE { | 28 const TextureSamplerArray& samplers) SK_OVERRIDE { |
29 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); | 29 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); |
30 fsBuilder->codeAppendf("\t%s = ", outputColor); | 30 fsBuilder->codeAppendf("\t%s = ", outputColor); |
31 fsBuilder->appendTextureLookupAndModulate(inputColor, | 31 fsBuilder->appendTextureLookupAndModulate(inputColor, |
32 samplers[0], | 32 samplers[0], |
33 coords[0].c_str(), | 33 coords[0].c_str(), |
34 coords[0].type()); | 34 coords[0].getType()); |
35 fsBuilder->codeAppend(";\n"); | 35 fsBuilder->codeAppend(";\n"); |
36 } | 36 } |
37 | 37 |
38 private: | 38 private: |
39 typedef GrGLEffect INHERITED; | 39 typedef GrGLEffect INHERITED; |
40 }; | 40 }; |
41 | 41 |
42 /////////////////////////////////////////////////////////////////////////////// | 42 /////////////////////////////////////////////////////////////////////////////// |
43 | 43 |
44 void GrSimpleTextureEffect::getConstantColorComponents(GrColor* color, uint32_t*
validFlags) const { | 44 void GrSimpleTextureEffect::getConstantColorComponents(GrColor* color, uint32_t*
validFlags) const { |
(...skipping 28 matching lines...) Expand all Loading... |
73 | 73 |
74 static const GrCoordSet kCoordSets[] = { | 74 static const GrCoordSet kCoordSets[] = { |
75 kLocal_GrCoordSet, | 75 kLocal_GrCoordSet, |
76 kPosition_GrCoordSet | 76 kPosition_GrCoordSet |
77 }; | 77 }; |
78 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; | 78 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; |
79 | 79 |
80 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); | 80 const SkMatrix& matrix = GrEffectUnitTest::TestMatrix(random); |
81 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); | 81 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); |
82 } | 82 } |
OLD | NEW |