| 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 "GrYUVtoRGBEffect.h" | 8 #include "GrYUVtoRGBEffect.h" |
| 9 | 9 |
| 10 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} | 59 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} |
| 60 | 60 |
| 61 GLProcessor(const GrProcessor&) {} | 61 GLProcessor(const GrProcessor&) {} |
| 62 | 62 |
| 63 virtual void emitCode(GrGLFPBuilder* builder, | 63 virtual void emitCode(GrGLFPBuilder* builder, |
| 64 const GrFragmentProcessor&, | 64 const GrFragmentProcessor&, |
| 65 const char* outputColor, | 65 const char* outputColor, |
| 66 const char* inputColor, | 66 const char* inputColor, |
| 67 const TransformedCoordsArray& coords, | 67 const TransformedCoordsArray& coords, |
| 68 const TextureSamplerArray& samplers) override { | 68 const TextureSamplerArray& samplers) override { |
| 69 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); | 69 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder()
; |
| 70 | 70 |
| 71 const char* yuvMatrix = NULL; | 71 const char* yuvMatrix = NULL; |
| 72 fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, | 72 fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, |
| 73 kMat44f_GrSLType, kDefault_GrSLPrec
ision, | 73 kMat44f_GrSLType, kDefault_GrSLPrec
ision, |
| 74 "YUVMatrix", &yuvMatrix); | 74 "YUVMatrix", &yuvMatrix); |
| 75 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", outputColor); | 75 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", outputColor); |
| 76 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coord
s[0].getType()); | 76 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coord
s[0].getType()); |
| 77 fsBuilder->codeAppend(".r,\n\t\t"); | 77 fsBuilder->codeAppend(".r,\n\t\t"); |
| 78 fsBuilder->appendTextureLookup(samplers[1], coords[1].c_str(), coord
s[1].getType()); | 78 fsBuilder->appendTextureLookup(samplers[1], coords[1].c_str(), coord
s[1].getType()); |
| 79 fsBuilder->codeAppend(".r,\n\t\t"); | 79 fsBuilder->codeAppend(".r,\n\t\t"); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 } | 164 } |
| 165 | 165 |
| 166 ////////////////////////////////////////////////////////////////////////////// | 166 ////////////////////////////////////////////////////////////////////////////// |
| 167 | 167 |
| 168 GrFragmentProcessor* | 168 GrFragmentProcessor* |
| 169 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, | 169 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, |
| 170 SkISize sizes[3], SkYUVColorSpace colorSpace) { | 170 SkISize sizes[3], SkYUVColorSpace colorSpace) { |
| 171 SkASSERT(yTexture && uTexture && vTexture && sizes); | 171 SkASSERT(yTexture && uTexture && vTexture && sizes); |
| 172 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, sizes, colorSpac
e); | 172 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, sizes, colorSpac
e); |
| 173 } | 173 } |
| OLD | NEW |