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