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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 | 51 |
52 #ifndef SK_IGNORE_TO_STRING | 52 #ifndef SK_IGNORE_TO_STRING |
53 void SkLumaColorFilter::toString(SkString* str) const { | 53 void SkLumaColorFilter::toString(SkString* str) const { |
54 str->append("SkLumaColorFilter "); | 54 str->append("SkLumaColorFilter "); |
55 } | 55 } |
56 #endif | 56 #endif |
57 | 57 |
58 #if SK_SUPPORT_GPU | 58 #if SK_SUPPORT_GPU |
59 class LumaColorFilterEffect : public GrFragmentProcessor { | 59 class LumaColorFilterEffect : public GrFragmentProcessor { |
60 public: | 60 public: |
61 static const GrFragmentProcessor* Create() { | 61 static sk_sp<GrFragmentProcessor> Make() { |
62 return new LumaColorFilterEffect; | 62 return sk_sp<GrFragmentProcessor>(new LumaColorFilterEffect); |
63 } | 63 } |
64 | 64 |
65 const char* name() const override { return "Luminance-to-Alpha"; } | 65 const char* name() const override { return "Luminance-to-Alpha"; } |
66 | 66 |
67 class GLSLProcessor : public GrGLSLFragmentProcessor { | 67 class GLSLProcessor : public GrGLSLFragmentProcessor { |
68 public: | 68 public: |
69 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} | 69 static void GenKey(const GrProcessor&, const GrGLSLCaps&, GrProcessorKey
Builder*) {} |
70 | 70 |
71 void emitCode(EmitArgs& args) override { | 71 void emitCode(EmitArgs& args) override { |
72 if (nullptr == args.fInputColor) { | 72 if (nullptr == args.fInputColor) { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 104 |
105 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } | 105 bool onIsEqual(const GrFragmentProcessor&) const override { return true; } |
106 | 106 |
107 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { | 107 void onComputeInvariantOutput(GrInvariantOutput* inout) const override { |
108 // The output is always black. The alpha value for the color passed in i
s arbitrary. | 108 // The output is always black. The alpha value for the color passed in i
s arbitrary. |
109 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), | 109 inout->setToOther(kRGB_GrColorComponentFlags, GrColorPackRGBA(0, 0, 0, 0
), |
110 GrInvariantOutput::kWill_ReadInput); | 110 GrInvariantOutput::kWill_ReadInput); |
111 } | 111 } |
112 }; | 112 }; |
113 | 113 |
114 const GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) co
nst { | 114 sk_sp<GrFragmentProcessor> SkLumaColorFilter::asFragmentProcessor(GrContext*) co
nst { |
115 | 115 return LumaColorFilterEffect::Make(); |
116 return LumaColorFilterEffect::Create(); | |
117 } | 116 } |
118 #endif | 117 #endif |
OLD | NEW |