| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkLumaColorFilter.h" | 8 #include "SkLumaColorFilter.h" |
| 9 | 9 |
| 10 #include "SkColorPriv.h" | 10 #include "SkColorPriv.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 virtual void emitCode(GrGLFPBuilder* builder, | 83 virtual void emitCode(GrGLFPBuilder* builder, |
| 84 const GrFragmentProcessor&, | 84 const GrFragmentProcessor&, |
| 85 const char* outputColor, | 85 const char* outputColor, |
| 86 const char* inputColor, | 86 const char* inputColor, |
| 87 const TransformedCoordsArray&, | 87 const TransformedCoordsArray&, |
| 88 const TextureSamplerArray&) override { | 88 const TextureSamplerArray&) override { |
| 89 if (NULL == inputColor) { | 89 if (NULL == inputColor) { |
| 90 inputColor = "vec4(1)"; | 90 inputColor = "vec4(1)"; |
| 91 } | 91 } |
| 92 | 92 |
| 93 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); | 93 GrGLFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder()
; |
| 94 fsBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb)
;\n", | 94 fsBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb)
;\n", |
| 95 SK_ITU_BT709_LUM_COEFF_R, | 95 SK_ITU_BT709_LUM_COEFF_R, |
| 96 SK_ITU_BT709_LUM_COEFF_G, | 96 SK_ITU_BT709_LUM_COEFF_G, |
| 97 SK_ITU_BT709_LUM_COEFF_B, | 97 SK_ITU_BT709_LUM_COEFF_B, |
| 98 inputColor); | 98 inputColor); |
| 99 fsBuilder->codeAppendf("\t%s = vec4(0, 0, 0, luma);\n", | 99 fsBuilder->codeAppendf("\t%s = vec4(0, 0, 0, luma);\n", |
| 100 outputColor); | 100 outputColor); |
| 101 | 101 |
| 102 } | 102 } |
| 103 | 103 |
| (...skipping 21 matching lines...) Expand all Loading... |
| 125 GrFragmentProcessor* frag = LumaColorFilterEffect::Create(); | 125 GrFragmentProcessor* frag = LumaColorFilterEffect::Create(); |
| 126 if (frag) { | 126 if (frag) { |
| 127 if (array) { | 127 if (array) { |
| 128 *array->append() = frag; | 128 *array->append() = frag; |
| 129 } | 129 } |
| 130 return true; | 130 return true; |
| 131 } | 131 } |
| 132 return false; | 132 return false; |
| 133 } | 133 } |
| 134 #endif | 134 #endif |
| OLD | NEW |