| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 SkYUVColorSpace getColorSpace() const { | 49 SkYUVColorSpace getColorSpace() const { |
| 50 return fColorSpace; | 50 return fColorSpace; |
| 51 } | 51 } |
| 52 | 52 |
| 53 class GLProcessor : public GrGLFragmentProcessor { | 53 class GLProcessor : public GrGLFragmentProcessor { |
| 54 public: | 54 public: |
| 55 static const GrGLfloat kJPEGConversionMatrix[16]; | 55 static const GrGLfloat kJPEGConversionMatrix[16]; |
| 56 static const GrGLfloat kRec601ConversionMatrix[16]; | 56 static const GrGLfloat kRec601ConversionMatrix[16]; |
| 57 | 57 |
| 58 // this class always generates the same code. | 58 // this class always generates the same code. |
| 59 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu
ilder*) {} | 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 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 93 break; | 93 break; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 private: | 97 private: |
| 98 GrGLProgramDataManager::UniformHandle fMatrixUni; | 98 GrGLProgramDataManager::UniformHandle fMatrixUni; |
| 99 | 99 |
| 100 typedef GrGLFragmentProcessor INHERITED; | 100 typedef GrGLFragmentProcessor INHERITED; |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 virtual void getGLProcessorKey(const GrGLCaps& caps, | 103 virtual void getGLProcessorKey(const GrGLSLCaps& caps, |
| 104 GrProcessorKeyBuilder* b) const override { | 104 GrProcessorKeyBuilder* b) const override { |
| 105 GLProcessor::GenKey(*this, caps, b); | 105 GLProcessor::GenKey(*this, caps, b); |
| 106 } | 106 } |
| 107 | 107 |
| 108 GrGLFragmentProcessor* createGLInstance() const override { | 108 GrGLFragmentProcessor* createGLInstance() const override { |
| 109 return SkNEW_ARGS(GLProcessor, (*this)); | 109 return SkNEW_ARGS(GLProcessor, (*this)); |
| 110 } | 110 } |
| 111 | 111 |
| 112 private: | 112 private: |
| 113 YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture
, | 113 YUVtoRGBEffect(GrTexture* yTexture, GrTexture* uTexture, GrTexture* vTexture
, |
| (...skipping 50 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 |