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 19 matching lines...) Expand all Loading... |
30 virtual void getConstantColorComponents(GrColor* color, | 30 virtual void getConstantColorComponents(GrColor* color, |
31 uint32_t* validFlags) const SK_OVERR
IDE { | 31 uint32_t* validFlags) const SK_OVERR
IDE { |
32 // YUV is opaque | 32 // YUV is opaque |
33 *color = 0xFF; | 33 *color = 0xFF; |
34 *validFlags = kA_GrColorComponentFlag; | 34 *validFlags = kA_GrColorComponentFlag; |
35 } | 35 } |
36 | 36 |
37 class GLEffect : public GrGLEffect { | 37 class GLEffect : public GrGLEffect { |
38 public: | 38 public: |
39 // this class always generates the same code. | 39 // this class always generates the same code. |
40 static EffectKey GenKey(const GrDrawEffect&, const GrGLCaps&) { return 0
; } | 40 static void GenKey(const GrDrawEffect&, const GrGLCaps&, GrEffectKeyBuil
der*) {} |
41 | 41 |
42 GLEffect(const GrBackendEffectFactory& factory, | 42 GLEffect(const GrBackendEffectFactory& factory, |
43 const GrDrawEffect&) | 43 const GrDrawEffect&) |
44 : INHERITED(factory) { | 44 : INHERITED(factory) { |
45 } | 45 } |
46 | 46 |
47 virtual void emitCode(GrGLShaderBuilder* builder, | 47 virtual void emitCode(GrGLShaderBuilder* builder, |
48 const GrDrawEffect&, | 48 const GrDrawEffect&, |
49 EffectKey, | 49 const GrEffectKey&, |
50 const char* outputColor, | 50 const char* outputColor, |
51 const char* inputColor, | 51 const char* inputColor, |
52 const TransformedCoordsArray& coords, | 52 const TransformedCoordsArray& coords, |
53 const TextureSamplerArray& samplers) SK_OVERRIDE { | 53 const TextureSamplerArray& samplers) SK_OVERRIDE { |
54 const char* yuvMatrix = "yuvMatrix"; | 54 const char* yuvMatrix = "yuvMatrix"; |
55 builder->fsCodeAppendf("\tconst mat4 %s = mat4(1.0, 0.0, 1.402,
-0.701,\n\t\t\t" | 55 builder->fsCodeAppendf("\tconst mat4 %s = mat4(1.0, 0.0, 1.402,
-0.701,\n\t\t\t" |
56 "1.0, -0.344, -0.714,
0.529,\n\t\t\t" | 56 "1.0, -0.344, -0.714,
0.529,\n\t\t\t" |
57 "1.0, 1.772, 0.0,
-0.886,\n\t\t\t" | 57 "1.0, 1.772, 0.0,
-0.886,\n\t\t\t" |
58 "0.0, 0.0, 0.0,
1.0);\n", | 58 "0.0, 0.0, 0.0,
1.0);\n", |
59 yuvMatrix); | 59 yuvMatrix); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 typedef GrEffect INHERITED; | 97 typedef GrEffect INHERITED; |
98 }; | 98 }; |
99 | 99 |
100 } | 100 } |
101 | 101 |
102 ////////////////////////////////////////////////////////////////////////////// | 102 ////////////////////////////////////////////////////////////////////////////// |
103 | 103 |
104 GrEffect* GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrT
exture* vTexture) { | 104 GrEffect* GrYUVtoRGBEffect::Create(GrTexture* yTexture, GrTexture* uTexture, GrT
exture* vTexture) { |
105 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture); | 105 return YUVtoRGBEffect::Create(yTexture, uTexture, vTexture); |
106 } | 106 } |
OLD | NEW |