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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 * called from the constructor because GrEffects are immutable. | 162 * called from the constructor because GrEffects are immutable. |
163 */ | 163 */ |
164 void addTextureAccess(const GrTextureAccess* textureAccess); | 164 void addTextureAccess(const GrTextureAccess* textureAccess); |
165 | 165 |
166 GrEffect() | 166 GrEffect() |
167 : fWillReadDstColor(false) | 167 : fWillReadDstColor(false) |
168 , fWillReadFragmentPosition(false) | 168 , fWillReadFragmentPosition(false) |
169 , fWillUseInputColor(true) | 169 , fWillUseInputColor(true) |
170 , fHasVertexCode(false) {} | 170 , fHasVertexCode(false) {} |
171 | 171 |
172 /** Helper for down-casting to a GrEffect subclass | 172 /** |
| 173 * Helper for down-casting to a GrEffect subclass |
173 */ | 174 */ |
174 template <typename T> | 175 template <typename T> static const T& CastEffect(const GrEffect& effect) { |
175 static const T& CastEffect(const GrEffect& effectRef) { | 176 return *static_cast<const T*>(&effect); |
176 return *static_cast<const T*>(&effectRef); | |
177 } | 177 } |
178 | 178 |
179 /** | 179 /** |
180 * If the effect subclass will read the destination pixel value then it must
call this function | 180 * If the effect subclass will read the destination pixel value then it must
call this function |
181 * from its constructor. Otherwise, when its generated backend-specific effe
ct class attempts | 181 * from its constructor. Otherwise, when its generated backend-specific effe
ct class attempts |
182 * to generate code that reads the destination pixel it will fail. | 182 * to generate code that reads the destination pixel it will fail. |
183 */ | 183 */ |
184 void setWillReadDstColor() { fWillReadDstColor = true; } | 184 void setWillReadDstColor() { fWillReadDstColor = true; } |
185 | 185 |
186 /** | 186 /** |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 * This creates an effect outside of the effect memory pool. The effect's destru
ctor will be called | 222 * This creates an effect outside of the effect memory pool. The effect's destru
ctor will be called |
223 * at global destruction time. NAME will be the name of the created GrEffect. | 223 * at global destruction time. NAME will be the name of the created GrEffect. |
224 */ | 224 */ |
225 #define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS)
\ | 225 #define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS)
\ |
226 static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage;
\ | 226 static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage;
\ |
227 static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLAS
S, ARGS); \ | 227 static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLAS
S, ARGS); \ |
228 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME); | 228 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME); |
229 | 229 |
230 | 230 |
231 #endif | 231 #endif |
OLD | NEW |