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 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 int count = fTextureAccesses.count(); | 197 int count = fTextureAccesses.count(); |
198 for (int t = 0; t < count; ++t) { | 198 for (int t = 0; t < count; ++t) { |
199 fTextureAccesses[t]->getTexture()->decDeferredRefCount(); | 199 fTextureAccesses[t]->getTexture()->decDeferredRefCount(); |
200 } | 200 } |
201 this->unref(); | 201 this->unref(); |
202 } | 202 } |
203 | 203 |
204 protected: | 204 protected: |
205 /** | 205 /** |
206 * Subclasses call this from their constructor to register GrTextureAccesses
. The effect | 206 * Subclasses call this from their constructor to register GrTextureAccesses
. The effect |
207 * subclass manages the lifetime of the accesses (this function only stores
a pointer). This | 207 * subclass manages the lifetime of the accesses (this function only stores
a pointer). The |
208 * must only be called from the constructor because GrEffects are immutable. | 208 * GrTextureAccess is typically a member field of the GrEffet subclass. This
must only be |
| 209 * called from the constructor because GrEffects are immutable. |
209 */ | 210 */ |
210 void addTextureAccess(const GrTextureAccess* textureAccess); | 211 void addTextureAccess(const GrTextureAccess* textureAccess); |
211 | 212 |
212 /** | 213 /** |
213 * Subclasses call this from their constructor to register vertex attributes
(at most | 214 * Subclasses call this from their constructor to register vertex attributes
(at most |
214 * kMaxVertexAttribs). This must only be called from the constructor because
GrEffects are | 215 * kMaxVertexAttribs). This must only be called from the constructor because
GrEffects are |
215 * immutable. | 216 * immutable. |
216 */ | 217 */ |
217 void addVertexAttrib(GrSLType type); | 218 void addVertexAttrib(GrSLType type); |
218 | 219 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 };
\ | 337 };
\ |
337 static SkAlignedSStorage<k_##NAME##_StorageSize> g_##NAME##_Storage;
\ | 338 static SkAlignedSStorage<k_##NAME##_StorageSize> g_##NAME##_Storage;
\ |
338 static void* NAME##_RefLocation = (char*)g_##NAME##_Storage.get() + k_##NAME##_E
ffectRefOffset; \ | 339 static void* NAME##_RefLocation = (char*)g_##NAME##_Storage.get() + k_##NAME##_E
ffectRefOffset; \ |
339 static GrEffect* NAME##_Effect SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EF
FECT_CLASS, ARGS);\ | 340 static GrEffect* NAME##_Effect SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EF
FECT_CLASS, ARGS);\ |
340 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME##_Effect);
\ | 341 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME##_Effect);
\ |
341 static GrEffectRef* NAME(GrEffect::CreateStaticEffectRef(NAME##_RefLocation, NAM
E##_Effect)); \ | 342 static GrEffectRef* NAME(GrEffect::CreateStaticEffectRef(NAME##_RefLocation, NAM
E##_Effect)); \ |
342 static SkAutoTDestroy<GrEffectRef> NAME##_Ref_ad(NAME) | 343 static SkAutoTDestroy<GrEffectRef> NAME##_Ref_ad(NAME) |
343 | 344 |
344 | 345 |
345 #endif | 346 #endif |
OLD | NEW |