| 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 "GrTBackendProcessorFactory.h" | 10 #include "GrTBackendProcessorFactory.h" |
| 11 #include "GrTexture.h" | 11 #include "GrTexture.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 GrBackendProcessorFactory& factory, const GrPr
ocessor&) | 19 GrGLSimpleTextureEffect(const GrBackendProcessorFactory& factory, const GrPr
ocessor&) |
| 20 : INHERITED (factory) { | 20 : INHERITED (factory) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 virtual void emitCode(GrGLFPBuilder* builder, | 23 virtual void emitCode(GrGLFPBuilder* builder, |
| 24 const GrFragmentProcessor& fp, | 24 const GrFragmentProcessor& fp, |
| 25 const GrProcessorKey& key, | |
| 26 const char* outputColor, | 25 const char* outputColor, |
| 27 const char* inputColor, | 26 const char* inputColor, |
| 28 const TransformedCoordsArray& coords, | 27 const TransformedCoordsArray& coords, |
| 29 const TextureSamplerArray& samplers) SK_OVERRIDE { | 28 const TextureSamplerArray& samplers) SK_OVERRIDE { |
| 30 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); | 29 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder(); |
| 31 fsBuilder->codeAppendf("\t%s = ", outputColor); | 30 fsBuilder->codeAppendf("\t%s = ", outputColor); |
| 32 fsBuilder->appendTextureLookupAndModulate(inputColor, | 31 fsBuilder->appendTextureLookupAndModulate(inputColor, |
| 33 samplers[0], | 32 samplers[0], |
| 34 coords[0].c_str(), | 33 coords[0].c_str(), |
| 35 coords[0].getType()); | 34 coords[0].getType()); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 73 |
| 75 static const GrCoordSet kCoordSets[] = { | 74 static const GrCoordSet kCoordSets[] = { |
| 76 kLocal_GrCoordSet, | 75 kLocal_GrCoordSet, |
| 77 kPosition_GrCoordSet | 76 kPosition_GrCoordSet |
| 78 }; | 77 }; |
| 79 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; | 78 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; |
| 80 | 79 |
| 81 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); | 80 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); |
| 82 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); | 81 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); |
| 83 } | 82 } |
| OLD | NEW |