| 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/GrGLProcessor.h" | 10 #include "gl/GrGLProcessor.h" |
| 11 #include "gl/GrGLSL.h" | 11 #include "gl/GrGLSL.h" |
| 12 #include "gl/GrGLTexture.h" | 12 #include "gl/GrGLTexture.h" |
| 13 #include "GrTBackendProcessorFactory.h" | 13 #include "GrTBackendProcessorFactory.h" |
| 14 #include "GrTexture.h" | 14 #include "GrTexture.h" |
| 15 | 15 |
| 16 class GrGLSimpleTextureEffect : public GrGLFragmentProcessor { | 16 class GrGLSimpleTextureEffect : public GrGLFragmentProcessor { |
| 17 public: | 17 public: |
| 18 GrGLSimpleTextureEffect(const GrBackendProcessorFactory& factory, const GrPr
ocessor&) | 18 GrGLSimpleTextureEffect(const GrBackendProcessorFactory& factory, const GrPr
ocessor&) |
| 19 : INHERITED (factory) { | 19 : INHERITED (factory) { |
| 20 } | 20 } |
| 21 | 21 |
| 22 virtual void emitCode(GrGLProgramBuilder* builder, | 22 virtual void emitCode(GrGLFPBuilder* builder, |
| 23 const GrFragmentProcessor& fp, | 23 const GrFragmentProcessor& fp, |
| 24 const GrProcessorKey& key, | 24 const GrProcessorKey& 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 GrGLFPFragmentBuilder* 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].getType()); | 34 coords[0].getType()); |
| 35 fsBuilder->codeAppend(";\n"); | 35 fsBuilder->codeAppend(";\n"); |
| 36 } | 36 } |
| 37 | 37 |
| 38 private: | 38 private: |
| 39 typedef GrGLFragmentProcessor INHERITED; | 39 typedef GrGLFragmentProcessor INHERITED; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 74 | 74 |
| 75 static const GrCoordSet kCoordSets[] = { | 75 static const GrCoordSet kCoordSets[] = { |
| 76 kLocal_GrCoordSet, | 76 kLocal_GrCoordSet, |
| 77 kPosition_GrCoordSet | 77 kPosition_GrCoordSet |
| 78 }; | 78 }; |
| 79 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; | 79 GrCoordSet coordSet = kCoordSets[random->nextULessThan(SK_ARRAY_COUNT(kCoord
Sets))]; |
| 80 | 80 |
| 81 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); | 81 const SkMatrix& matrix = GrProcessorUnitTest::TestMatrix(random); |
| 82 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); | 82 return GrSimpleTextureEffect::Create(textures[texIdx], matrix, coordSet); |
| 83 } | 83 } |
| OLD | NEW |