| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 "GrYUVtoRGBEffect.h" | 9 #include "GrYUVtoRGBEffect.h" |
| 10 | 10 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 static const GrGLfloat kRec601ConversionMatrix[16]; | 38 static const GrGLfloat kRec601ConversionMatrix[16]; |
| 39 | 39 |
| 40 // this class always generates the same code. | 40 // this class always generates the same code. |
| 41 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu
ilder*) {} | 41 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu
ilder*) {} |
| 42 | 42 |
| 43 GLProcessor(const GrBackendProcessorFactory& factory, | 43 GLProcessor(const GrBackendProcessorFactory& factory, |
| 44 const GrProcessor&) | 44 const GrProcessor&) |
| 45 : INHERITED(factory) { | 45 : INHERITED(factory) { |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual void emitCode(GrGLProgramBuilder* builder, | 48 virtual void emitCode(GrGLFPBuilder* builder, |
| 49 const GrFragmentProcessor&, | 49 const GrFragmentProcessor&, |
| 50 const GrProcessorKey&, | 50 const GrProcessorKey&, |
| 51 const char* outputColor, | 51 const char* outputColor, |
| 52 const char* inputColor, | 52 const char* inputColor, |
| 53 const TransformedCoordsArray& coords, | 53 const TransformedCoordsArray& coords, |
| 54 const TextureSamplerArray& samplers) SK_OVERRIDE { | 54 const TextureSamplerArray& samplers) SK_OVERRIDE { |
| 55 GrGLFragmentShaderBuilder* fsBuilder = builder->getFragmentShaderBui
lder(); | 55 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); |
| 56 | 56 |
| 57 const char* yuvMatrix = NULL; | 57 const char* yuvMatrix = NULL; |
| 58 fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, | 58 fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, |
| 59 kMat44f_GrSLType, "YUVMatrix", | 59 kMat44f_GrSLType, "YUVMatrix", |
| 60 &yuvMatrix); | 60 &yuvMatrix); |
| 61 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", outputColor); | 61 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", outputColor); |
| 62 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coord
s[0].getType()); | 62 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coord
s[0].getType()); |
| 63 fsBuilder->codeAppend(".r,\n\t\t"); | 63 fsBuilder->codeAppend(".r,\n\t\t"); |
| 64 fsBuilder->appendTextureLookup(samplers[1], coords[0].c_str(), coord
s[0].getType()); | 64 fsBuilder->appendTextureLookup(samplers[1], coords[0].c_str(), coord
s[0].getType()); |
| 65 fsBuilder->codeAppend(".r,\n\t\t"); | 65 fsBuilder->codeAppend(".r,\n\t\t"); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 0.0f, 0.0f, 0.0f, 1.0}; | 138 0.0f, 0.0f, 0.0f, 1.0}; |
| 139 } | 139 } |
| 140 | 140 |
| 141 ////////////////////////////////////////////////////////////////////////////// | 141 ////////////////////////////////////////////////////////////////////////////// |
| 142 | 142 |
| 143 GrFragmentProcessor* | 143 GrFragmentProcessor* |
| 144 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, | 144 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, |
| 145 SkYUVColorSpace colorSpace) { | 145 SkYUVColorSpace colorSpace) { |
| 146 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); | 146 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); |
| 147 } | 147 } |
| OLD | NEW |