OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 #ifndef GrExtractAlphaFragmentProcessor_DEFINED | 8 #ifndef GrExtractAlphaFragmentProcessor_DEFINED |
9 #define GrExtractAlphaFragmentProcessor_DEFINED | 9 #define GrExtractAlphaFragmentProcessor_DEFINED |
10 | 10 |
11 #include "GrFragmentProcessor.h" | 11 #include "GrFragmentProcessor.h" |
12 | 12 |
13 /** This processor extracts the incoming color's alpha, ignores r, g, and b, and
feeds | 13 /** This processor extracts the incoming color's alpha, ignores r, g, and b, and
feeds |
14 the replicated alpha to it's inner processor. */ | 14 the replicated alpha to it's inner processor. */ |
15 class GrExtractAlphaFragmentProcessor : public GrFragmentProcessor { | 15 class GrExtractAlphaFragmentProcessor : public GrFragmentProcessor { |
16 public: | 16 public: |
17 static GrFragmentProcessor* Create(const GrFragmentProcessor* processor) { | 17 static GrFragmentProcessor* Create(const GrFragmentProcessor* processor) { |
18 if (!processor) { | 18 if (!processor) { |
19 return nullptr; | 19 return nullptr; |
20 } | 20 } |
21 return SkNEW_ARGS(GrExtractAlphaFragmentProcessor, (processor)); | 21 return new GrExtractAlphaFragmentProcessor(processor); |
22 } | 22 } |
23 | 23 |
24 ~GrExtractAlphaFragmentProcessor() override {} | 24 ~GrExtractAlphaFragmentProcessor() override {} |
25 | 25 |
26 const char* name() const override { return "Extract Alpha"; } | 26 const char* name() const override { return "Extract Alpha"; } |
27 | 27 |
28 private: | 28 private: |
29 GrExtractAlphaFragmentProcessor(const GrFragmentProcessor* processor) { | 29 GrExtractAlphaFragmentProcessor(const GrFragmentProcessor* processor) { |
30 this->initClassID<GrExtractAlphaFragmentProcessor>(); | 30 this->initClassID<GrExtractAlphaFragmentProcessor>(); |
31 this->registerChildProcessor(processor); | 31 this->registerChildProcessor(processor); |
32 } | 32 } |
33 | 33 |
34 GrGLFragmentProcessor* onCreateGLInstance() const override; | 34 GrGLFragmentProcessor* onCreateGLInstance() const override; |
35 | 35 |
36 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov
erride; | 36 void onGetGLProcessorKey(const GrGLSLCaps&, GrProcessorKeyBuilder*) const ov
erride; |
37 | 37 |
38 bool onIsEqual(const GrFragmentProcessor&) const override; | 38 bool onIsEqual(const GrFragmentProcessor&) const override; |
39 | 39 |
40 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; | 40 void onComputeInvariantOutput(GrInvariantOutput* inout) const override; |
41 | 41 |
42 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; | 42 GR_DECLARE_FRAGMENT_PROCESSOR_TEST; |
43 | 43 |
44 typedef GrFragmentProcessor INHERITED; | 44 typedef GrFragmentProcessor INHERITED; |
45 }; | 45 }; |
46 | 46 |
47 #endif | 47 #endif |
OLD | NEW |