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 "GrSimpleTextureEffect.h" | 8 #include "GrSimpleTextureEffect.h" |
9 #include "GrInvariantOutput.h" | 9 #include "GrInvariantOutput.h" |
10 #include "GrTexture.h" | 10 #include "GrTexture.h" |
11 #include "gl/GrGLCaps.h" | 11 #include "gl/GrGLCaps.h" |
12 #include "gl/GrGLProcessor.h" | 12 #include "gl/GrGLProcessor.h" |
13 #include "gl/GrGLSL.h" | 13 #include "gl/GrGLSL.h" |
14 #include "gl/GrGLTexture.h" | 14 #include "gl/GrGLTexture.h" |
15 #include "gl/builders/GrGLProgramBuilder.h" | 15 #include "gl/builders/GrGLProgramBuilder.h" |
16 | 16 |
17 class GrGLSimpleTextureEffect : public GrGLFragmentProcessor { | 17 class GrGLSimpleTextureEffect : public GrGLFragmentProcessor { |
18 public: | 18 public: |
19 GrGLSimpleTextureEffect(const GrProcessor&) {} | 19 GrGLSimpleTextureEffect(const GrProcessor&) {} |
20 | 20 |
21 virtual void emitCode(GrGLFPBuilder* builder, | 21 virtual void emitCode(GrGLFPBuilder* builder, |
22 const GrFragmentProcessor& fp, | 22 const GrFragmentProcessor& fp, |
23 const char* outputColor, | 23 const char* outputColor, |
24 const char* inputColor, | 24 const char* inputColor, |
25 const TransformedCoordsArray& coords, | 25 const TransformedCoordsArray& coords, |
26 const TextureSamplerArray& samplers) SK_OVERRIDE { | 26 const TextureSamplerArray& samplers) override { |
27 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 27 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
28 fsBuilder->codeAppendf("\t%s = ", outputColor); | 28 fsBuilder->codeAppendf("\t%s = ", outputColor); |
29 fsBuilder->appendTextureLookupAndModulate(inputColor, | 29 fsBuilder->appendTextureLookupAndModulate(inputColor, |
30 samplers[0], | 30 samplers[0], |
31 coords[0].c_str(), | 31 coords[0].c_str(), |
32 coords[0].getType()); | 32 coords[0].getType()); |
33 fsBuilder->codeAppend(";\n"); | 33 fsBuilder->codeAppend(";\n"); |
34 } | 34 } |
35 | 35 |
36 private: | 36 private: |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 | 76 |
77 static const GrCoordSet kCoordSets[] = { | 77 static const GrCoordSet kCoordSets[] = { |
78 kLocal_GrCoordSet, | 78 kLocal_GrCoordSet, |
79 kDevice_GrCoordSet | 79 kDevice_GrCoordSet |
80 }; | 80 }; |
81 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; | 81 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; |
82 | 82 |
83 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); | 83 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); |
84 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); | 84 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); |
85 } | 85 } |
OLD | NEW |