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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gLumaEffect, LumaColorFilterEffect,
()); | 66 GR_CREATE_STATIC_FRAGMENT_PROCESSOR(gLumaEffect, LumaColorFilterEffect,
()); |
67 return SkRef(gLumaEffect); | 67 return SkRef(gLumaEffect); |
68 } | 68 } |
69 | 69 |
70 static const char* Name() { return "Luminance-to-Alpha"; } | 70 static const char* Name() { return "Luminance-to-Alpha"; } |
71 | 71 |
72 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE { | 72 virtual const GrBackendFragmentProcessorFactory& getFactory() const SK_OVERR
IDE { |
73 return GrTBackendFragmentProcessorFactory<LumaColorFilterEffect>::getIns
tance(); | 73 return GrTBackendFragmentProcessorFactory<LumaColorFilterEffect>::getIns
tance(); |
74 } | 74 } |
75 | 75 |
| 76 virtual void getConstantColorComponents(GrColor* color, |
| 77 uint32_t* validFlags) const SK_OVERR
IDE { |
| 78 // The output is always black. |
| 79 *color = GrColorPackRGBA(0, 0, 0, GrColorUnpackA(*color)); |
| 80 *validFlags = kRGB_GrColorComponentFlags; |
| 81 } |
| 82 |
76 class GLProcessor : public GrGLFragmentProcessor { | 83 class GLProcessor : public GrGLFragmentProcessor { |
77 public: | 84 public: |
78 GLProcessor(const GrBackendProcessorFactory& factory, | 85 GLProcessor(const GrBackendProcessorFactory& factory, |
79 const GrProcessor&) | 86 const GrProcessor&) |
80 : INHERITED(factory) { | 87 : INHERITED(factory) { |
81 } | 88 } |
82 | 89 |
83 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu
ilder* b) {} | 90 static void GenKey(const GrProcessor&, const GrGLCaps&, GrProcessorKeyBu
ilder* b) {} |
84 | 91 |
85 virtual void emitCode(GrGLProgramBuilder* builder, | 92 virtual void emitCode(GrGLProgramBuilder* builder, |
(...skipping 19 matching lines...) Expand all Loading... |
105 } | 112 } |
106 | 113 |
107 private: | 114 private: |
108 typedef GrGLFragmentProcessor INHERITED; | 115 typedef GrGLFragmentProcessor INHERITED; |
109 }; | 116 }; |
110 | 117 |
111 private: | 118 private: |
112 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { | 119 virtual bool onIsEqual(const GrProcessor&) const SK_OVERRIDE { |
113 return true; | 120 return true; |
114 } | 121 } |
115 | |
116 virtual void onComputeInvariantOutput(InvariantOutput* inout) const SK_OVERR
IDE { | |
117 // The output is always black. | |
118 inout->fColor = GrColorPackRGBA(0, 0, 0, GrColorUnpackA(inout->fColor)); | |
119 inout->fValidFlags = kRGB_GrColorComponentFlags; | |
120 inout->fIsSingleComponent = false; | |
121 } | |
122 }; | 122 }; |
123 | 123 |
124 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const { | 124 GrFragmentProcessor* SkLumaColorFilter::asFragmentProcessor(GrContext*) const { |
125 return LumaColorFilterEffect::Create(); | 125 return LumaColorFilterEffect::Create(); |
126 } | 126 } |
127 #endif | 127 #endif |
OLD | NEW |