| 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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 public: | 78 public: |
| 79 GLProcessor(const GrBackendProcessorFactory& factory, | 79 GLProcessor(const GrBackendProcessorFactory& factory, |
| 80 const GrProcessor&) | 80 const GrProcessor&) |
| 81 : INHERITED(factory) { | 81 : INHERITED(factory) { |
| 82 } | 82 } |
| 83 | 83 |
| 84 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu
ilder* b) {} | 84 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu
ilder* b) {} |
| 85 | 85 |
| 86 virtual void emitCode(GrGLFPBuilder* builder, | 86 virtual void emitCode(GrGLFPBuilder* builder, |
| 87 const GrFragmentProcessor&, | 87 const GrFragmentProcessor&, |
| 88 const GrProcessorKey&, | |
| 89 const char* outputColor, | 88 const char* outputColor, |
| 90 const char* inputColor, | 89 const char* inputColor, |
| 91 const TransformedCoordsArray&, | 90 const TransformedCoordsArray&, |
| 92 const TextureSamplerArray&) SK_OVERRIDE { | 91 const TextureSamplerArray&) SK_OVERRIDE { |
| 93 if (NULL == inputColor) { | 92 if (NULL == inputColor) { |
| 94 inputColor = "vec4(1)"; | 93 inputColor = "vec4(1)"; |
| 95 } | 94 } |
| 96 | 95 |
| 97 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); | 96 GrGLFPFragmentBuilder* fsBuilder = builder->getFragmentShaderBuilder
(); |
| 98 fsBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb)
;\n", | 97 fsBuilder->codeAppendf("\tfloat luma = dot(vec3(%f, %f, %f), %s.rgb)
;\n", |
| (...skipping 17 matching lines...) Expand all Loading... |
| 116 // The output is always black. The alpha value for the color passed in i
s arbitrary. | 115 // The output is always black. The alpha value for the color passed in i
s arbitrary. |
| 117 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), | 116 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), |
| 118 GrInvariantOutput::kWill_ReadInput); | 117 GrInvariantOutput::kWill_ReadInput); |
| 119 } | 118 } |
| 120 }; | 119 }; |
| 121 | 120 |
| 122 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const { | 121 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const { |
| 123 return LumaColorFilterEffect::Create(); | 122 return LumaColorFilterEffect::Create(); |
| 124 } | 123 } |
| 125 #endif | 124 #endif |
| OLD | NEW |