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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 ... | 64 ... |
65 }; | 65 }; |
66 */ | 66 */ |
67 virtual const GrBackendEffectFactory& getFactory() const = 0; | 67 virtual const GrBackendEffectFactory& getFactory() const = 0; |
68 | 68 |
69 /** Returns true if this and other effect conservatively draw identically. I
t can only return | 69 /** Returns true if this and other effect conservatively draw identically. I
t can only return |
70 true when the two effects are of the same subclass (i.e. they return the
same object from | 70 true when the two effects are of the same subclass (i.e. they return the
same object from |
71 from getFactory()). | 71 from getFactory()). |
72 | 72 |
73 A return value of true from isEqual() should not be used to test whether
the effects would | 73 A return value of true from isEqual() should not be used to test whether
the effects would |
74 generate the same shader code. To test for identical code generation use
the EffectKey | 74 generate the same shader code. To test for identical code generation use
the effects' keys |
75 computed by the GrBackendEffectFactory: | 75 computed by the GrBackendEffectFactory. |
76 effectA.getFactory().glEffectKey(effectA) == effectB.getFactory().gl
EffectKey(effectB). | |
77 */ | 76 */ |
78 bool isEqual(const GrEffect& other) const { | 77 bool isEqual(const GrEffect& other) const { |
79 if (&this->getFactory() != &other.getFactory()) { | 78 if (&this->getFactory() != &other.getFactory()) { |
80 return false; | 79 return false; |
81 } | 80 } |
82 bool result = this->onIsEqual(other); | 81 bool result = this->onIsEqual(other); |
83 #ifdef SK_DEBUG | 82 #ifdef SK_DEBUG |
84 if (result) { | 83 if (result) { |
85 this->assertEquality(other); | 84 this->assertEquality(other); |
86 } | 85 } |
(...skipping 135 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 | 221 * 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. | 222 * at global destruction time. NAME will be the name of the created GrEffect. |
224 */ | 223 */ |
225 #define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS)
\ | 224 #define GR_CREATE_STATIC_EFFECT(NAME, EFFECT_CLASS, ARGS)
\ |
226 static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage;
\ | 225 static SkAlignedSStorage<sizeof(EFFECT_CLASS)> g_##NAME##_Storage;
\ |
227 static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLAS
S, ARGS); \ | 226 static GrEffect* NAME SkNEW_PLACEMENT_ARGS(g_##NAME##_Storage.get(), EFFECT_CLAS
S, ARGS); \ |
228 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME); | 227 static SkAutoTDestroy<GrEffect> NAME##_ad(NAME); |
229 | 228 |
230 | 229 |
231 #endif | 230 #endif |
OLD | NEW |