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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 static const GrGLfloat kRec709ConversionMatrix[16]; | 57 static const GrGLfloat kRec709ConversionMatrix[16]; |
58 | 58 |
59 // this class always generates the same code. | 59 // this class always generates the same code. |
60 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} | 60 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} |
61 | 61 |
62 GLProcessor(const GrProcessor&) {} | 62 GLProcessor(const GrProcessor&) {} |
63 | 63 |
64 virtual void emitCode(EmitArgs& args) override { | 64 virtual void emitCode(EmitArgs& args) override { |
65 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBui
lder(); | 65 GrGLFragmentBuilder* fsBuilder = args.fBuilder->getFragmentShaderBui
lder(); |
66 | 66 |
67 const char* yuvMatrix = NULL; | 67 const char* yuvMatrix = nullptr; |
68 fMatrixUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment
_Visibility, | 68 fMatrixUni = args.fBuilder->addUniform(GrGLProgramBuilder::kFragment
_Visibility, |
69 kMat44f_GrSLType, kDefault_GrSLPrec
ision, | 69 kMat44f_GrSLType, kDefault_GrSLPrec
ision, |
70 "YUVMatrix", &yuvMatrix); | 70 "YUVMatrix", &yuvMatrix); |
71 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", args.fOutputColor); | 71 fsBuilder->codeAppendf("\t%s = vec4(\n\t\t", args.fOutputColor); |
72 fsBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_
str(), | 72 fsBuilder->appendTextureLookup(args.fSamplers[0], args.fCoords[0].c_
str(), |
73 args.fCoords[0].getType()); | 73 args.fCoords[0].getType()); |
74 fsBuilder->codeAppend(".r,\n\t\t"); | 74 fsBuilder->codeAppend(".r,\n\t\t"); |
75 fsBuilder->appendTextureLookup(args.fSamplers[1], args.fCoords[1].c_
str(), | 75 fsBuilder->appendTextureLookup(args.fSamplers[1], args.fCoords[1].c_
str(), |
76 args.fCoords[1].getType()); | 76 args.fCoords[1].getType()); |
77 fsBuilder->codeAppend(".r,\n\t\t"); | 77 fsBuilder->codeAppend(".r,\n\t\t"); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 | 171 |
172 ////////////////////////////////////////////////////////////////////////////// | 172 ////////////////////////////////////////////////////////////////////////////// |
173 | 173 |
174 GrFragmentProcessor* | 174 GrFragmentProcessor* |
175 GrYUVtoRGBEffect::Create(GrProcessorDataManager* procDataManager, GrTexture* yTe
xture, | 175 GrYUVtoRGBEffect::Create(GrProcessorDataManager* procDataManager, GrTexture* yTe
xture, |
176 GrTexture* uTexture, GrTexture* vTexture, const SkISize
sizes[3], | 176 GrTexture* uTexture, GrTexture* vTexture, const SkISize
sizes[3], |
177 SkYUVColorSpace colorSpace) { | 177 SkYUVColorSpace colorSpace) { |
178 SkASSERT(procDataManager && yTexture && uTexture && vTexture && sizes); | 178 SkASSERT(procDataManager && yTexture && uTexture && vTexture && sizes); |
179 return YUVtoRGBEffect::Create(procDataManager, yTexture, uTexture, vTexture,
sizes, colorSpace); | 179 return YUVtoRGBEffect::Create(procDataManager, yTexture, uTexture, vTexture,
sizes, colorSpace); |
180 } | 180 } |
OLD | NEW |