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