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 30 matching lines...) Expand all Loading... |
41 virtual void emitCode(GrGLFPBuilder* builder, | 41 virtual void emitCode(GrGLFPBuilder* builder, |
42 const GrFragmentProcessor&, | 42 const GrFragmentProcessor&, |
43 const char* outputColor, | 43 const char* outputColor, |
44 const char* inputColor, | 44 const char* inputColor, |
45 const TransformedCoordsArray& coords, | 45 const TransformedCoordsArray& coords, |
46 const TextureSamplerArray& samplers) SK_OVERRIDE { | 46 const TextureSamplerArray& samplers) SK_OVERRIDE { |
47 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); | 47 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); |
48 | 48 |
49 const char* yuvMatrix = NULL; | 49 const char* yuvMatrix = NULL; |
50 fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, | 50 fMatrixUni = builder->addUniform(GrGLProgramBuilder::kFragment_Visib
ility, |
51 kMat44f_GrSLType, "YUVMatrix", | 51 kMat44f_GrSLType, kDefault_GrSLPrec
ision, |
52 &yuvMatrix); | 52 "YUVMatrix", &yuvMatrix); |
53 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", outputColor); | 53 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", outputColor); |
54 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coord
s[0].getType()); | 54 fsBuilder->appendTextureLookup(samplers[0], coords[0].c_str(), coord
s[0].getType()); |
55 fsBuilder->codeAppend(".r,\n\t\t"); | 55 fsBuilder->codeAppend(".r,\n\t\t"); |
56 fsBuilder->appendTextureLookup(samplers[1], coords[0].c_str(), coord
s[0].getType()); | 56 fsBuilder->appendTextureLookup(samplers[1], coords[0].c_str(), coord
s[0].getType()); |
57 fsBuilder->codeAppend(".r,\n\t\t"); | 57 fsBuilder->codeAppend(".r,\n\t\t"); |
58 fsBuilder->appendTextureLookup(samplers[2], coords[0].c_str(), coord
s[0].getType()); | 58 fsBuilder->appendTextureLookup(samplers[2], coords[0].c_str(), coord
s[0].getType()); |
59 fsBuilder->codeAppendf(".r,\n\t\t1.0) * %s;\n", yuvMatrix); | 59 fsBuilder->codeAppendf(".r,\n\t\t1.0) * %s;\n", yuvMatrix); |
60 } | 60 } |
61 | 61 |
62 virtual void setData(const GrGLProgramDataManager& pdman, | 62 virtual void setData(const GrGLProgramDataManager& pdman, |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 0.0f, 0.0f, 0.0f, 1.0}; | 135 0.0f, 0.0f, 0.0f, 1.0}; |
136 } | 136 } |
137 | 137 |
138 ////////////////////////////////////////////////////////////////////////////// | 138 ////////////////////////////////////////////////////////////////////////////// |
139 | 139 |
140 GrFragmentProcessor* | 140 GrFragmentProcessor* |
141 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, | 141 GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vT
exture, |
142 SkYUVColorSpace colorSpace) { | 142 SkYUVColorSpace colorSpace) { |
143 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); | 143 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture, colorSpace); |
144 } | 144 } |
OLD | NEW |