OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 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 GrEffect_DEFINED | 8 #ifndef GrEffect_DEFINED |
9 #define GrEffect_DEFINED | 9 #define GrEffect_DEFINED |
10 | 10 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 /** | 89 /** |
90 * This function is used to perform optimizations. When called the color and
validFlags params | 90 * This function is used to perform optimizations. When called the color and
validFlags params |
91 * indicate whether the input components to this effect in the FS will have
known values. | 91 * indicate whether the input components to this effect in the FS will have
known values. |
92 * validFlags is a bitfield of GrColorComponentFlags. The function updates b
oth params to | 92 * validFlags is a bitfield of GrColorComponentFlags. The function updates b
oth params to |
93 * indicate known values of its output. A component of the color param only
has meaning if the | 93 * indicate known values of its output. A component of the color param only
has meaning if the |
94 * corresponding bit in validFlags is set. | 94 * corresponding bit in validFlags is set. |
95 */ | 95 */ |
96 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const = 0; | 96 virtual void getConstantColorComponents(GrColor* color, uint32_t* validFlags
) const = 0; |
97 | 97 |
| 98 /** Will this effect read the source color value? */ |
| 99 virtual bool willUseInputColor() const { return true; } |
| 100 |
98 /** This object, besides creating back-end-specific helper objects, is used
for run-time-type- | 101 /** This object, besides creating back-end-specific helper objects, is used
for run-time-type- |
99 identification. The factory should be an instance of templated class, | 102 identification. The factory should be an instance of templated class, |
100 GrTBackendEffectFactory. It is templated on the subclass of GrEffect. Th
e subclass must have | 103 GrTBackendEffectFactory. It is templated on the subclass of GrEffect. Th
e subclass must have |
101 a nested type (or typedef) named GLEffect which will be the subclass of
GrGLEffect created | 104 a nested type (or typedef) named GLEffect which will be the subclass of
GrGLEffect created |
102 by the factory. | 105 by the factory. |
103 | 106 |
104 Example: | 107 Example: |
105 class MyCustomEffect : public GrEffect { | 108 class MyCustomEffect : public GrEffect { |
106 ... | 109 ... |
107 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE
{ | 110 virtual const GrBackendEffectFactory& getFactory() const SK_OVERRIDE
{ |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 };
\ | 347 };
\ |
345 static SkAlignedSStorage<k_##NAME##_StorageSize> g_##NAME##_Storage;
\ | 348 static SkAlignedSStorage<k_##NAME##_StorageSize> g_##NAME##_Storage;
\ |
346 static void* NAME##_RefLocation = (char*)g_##NAME##_Storage.get() + k_##NAME##_E
ffectRefOffset; \ | 349 static void* NAME##_RefLocation = (char*)g_##NAME##_Storage.get() + k_##NAME##_E
ffectRefOffset; \ |
347 static GrEffect* NAME##_Effect SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EF
FECT_CLASS, ARGS);\ | 350 static GrEffect* NAME##_Effect SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EF
FECT_CLASS, ARGS);\ |
348 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME##_Effect);
\ | 351 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME##_Effect);
\ |
349 static GrEffectRef* NAME(GrEffect::CreateStaticEffectRef(NAME##_RefLocation, NAM
E##_Effect)); \ | 352 static GrEffectRef* NAME(GrEffect::CreateStaticEffectRef(NAME##_RefLocation, NAM
E##_Effect)); \ |
350 static SkAutoTDestroy<GrEffectRef> NAME##_Ref_ad(NAME) | 353 static SkAutoTDestroy<GrEffectRef> NAME##_Ref_ad(NAME) |
351 | 354 |
352 | 355 |
353 #endif | 356 #endif |
OLD | NEW |