OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 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 GrFragmentProcessor_DEFINED | 8 #ifndef GrFragmentProcessor_DEFINED |
9 #define GrFragmentProcessor_DEFINED | 9 #define GrFragmentProcessor_DEFINED |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 class GrFragmentProcessor : public GrProcessor { | 24 class GrFragmentProcessor : public GrProcessor { |
25 public: | 25 public: |
26 /** | 26 /** |
27 * In many instances (e.g. SkShader::asFragmentProcessor() implementations)
it is desirable to | 27 * In many instances (e.g. SkShader::asFragmentProcessor() implementations)
it is desirable to |
28 * only consider the input color's alpha. However, there is a competing desi
re to have reusable | 28 * only consider the input color's alpha. However, there is a competing desi
re to have reusable |
29 * GrFragmentProcessor subclasses that can be used in other scenarios where
the entire input | 29 * GrFragmentProcessor subclasses that can be used in other scenarios where
the entire input |
30 * color is considered. This function exists to filter the input color and p
ass it to a FP. It | 30 * color is considered. This function exists to filter the input color and p
ass it to a FP. It |
31 * does so by returning a parent FP that multiplies the passed in FPs output
by the parent's | 31 * does so by returning a parent FP that multiplies the passed in FPs output
by the parent's |
32 * input alpha. The passed in FP will not receive an input color. | 32 * input alpha. The passed in FP will not receive an input color. |
33 */ | 33 */ |
34 static const GrFragmentProcessor* MulOuputByInputAlpha(const GrFragmentProce
ssor*); | 34 static const GrFragmentProcessor* MulOutputByInputAlpha(const GrFragmentProc
essor*); |
| 35 |
| 36 /** |
| 37 * Similar to the above but it modulates the output r,g,b of the child proc
essor by the input |
| 38 * rgb and then multiplies all the components by the input alpha. This effe
ctively modulates |
| 39 * the child processor's premul color by a unpremul'ed input and produces a
premul output |
| 40 */ |
| 41 static const GrFragmentProcessor* MulOutputByInputUnpremulColor(const GrFrag
mentProcessor*); |
| 42 |
| 43 /** |
| 44 * Returns a parent fragment processor that adopts the passed fragment proce
ssor as a child. The |
| 45 * parent will ignore its input color and instead feed the passed in color a
s input to the |
| 46 * child. |
| 47 */ |
| 48 static const GrFragmentProcessor* OverrideInput(const GrFragmentProcessor*,
GrColor); |
35 | 49 |
36 GrFragmentProcessor() | 50 GrFragmentProcessor() |
37 : INHERITED() | 51 : INHERITED() |
38 , fUsesLocalCoords(false) | 52 , fUsesLocalCoords(false) |
39 , fNumTexturesExclChildren(0) | 53 , fNumTexturesExclChildren(0) |
40 , fNumTransformsExclChildren(0) {} | 54 , fNumTransformsExclChildren(0) {} |
41 | 55 |
42 ~GrFragmentProcessor() override; | 56 ~GrFragmentProcessor() override; |
43 | 57 |
44 GrGLFragmentProcessor* createGLInstance() const; | 58 GrGLFragmentProcessor* createGLInstance() const; |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 int fNumTransformsExclChildren; | 205 int fNumTransformsExclChildren; |
192 | 206 |
193 // TODO: These must convert their processors to pending-execution refs when
the parent is | 207 // TODO: These must convert their processors to pending-execution refs when
the parent is |
194 // converted (do this automatically in GrProgramElement?). | 208 // converted (do this automatically in GrProgramElement?). |
195 SkTArray<const GrFragmentProcessor*, true> fChildProcessors; | 209 SkTArray<const GrFragmentProcessor*, true> fChildProcessors; |
196 | 210 |
197 typedef GrProcessor INHERITED; | 211 typedef GrProcessor INHERITED; |
198 }; | 212 }; |
199 | 213 |
200 #endif | 214 #endif |
OLD | NEW |