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 GrBackendEffectFactory_DEFINED | 8 #ifndef GrBackendEffectFactory_DEFINED |
9 #define GrBackendEffectFactory_DEFINED | 9 #define GrBackendEffectFactory_DEFINED |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 } | 66 } |
67 virtual ~GrBackendEffectFactory() {} | 67 virtual ~GrBackendEffectFactory() {} |
68 | 68 |
69 static EffectKey GenID() { | 69 static EffectKey GenID() { |
70 GR_DEBUGCODE(static const int32_t kClassIDBits = 8 * sizeof(EffectKey) - | 70 GR_DEBUGCODE(static const int32_t kClassIDBits = 8 * sizeof(EffectKey) - |
71 kTextureKeyBits - kEffectKeyBits - kAttribKeyBits); | 71 kTextureKeyBits - kEffectKeyBits - kAttribKeyBits); |
72 // fCurrEffectClassID has been initialized to kIllegalEffectClassID. The | 72 // fCurrEffectClassID has been initialized to kIllegalEffectClassID. The |
73 // atomic inc returns the old value not the incremented value. So we add | 73 // atomic inc returns the old value not the incremented value. So we add |
74 // 1 to the returned value. | 74 // 1 to the returned value. |
75 int32_t id = sk_atomic_inc(&fCurrEffectClassID) + 1; | 75 int32_t id = sk_atomic_inc(&fCurrEffectClassID) + 1; |
76 GrAssert(id < (1 << kClassIDBits)); | 76 SkASSERT(id < (1 << kClassIDBits)); |
77 return static_cast<EffectKey>(id); | 77 return static_cast<EffectKey>(id); |
78 } | 78 } |
79 | 79 |
80 EffectKey fEffectClassID; | 80 EffectKey fEffectClassID; |
81 | 81 |
82 private: | 82 private: |
83 static int32_t fCurrEffectClassID; | 83 static int32_t fCurrEffectClassID; |
84 }; | 84 }; |
85 | 85 |
86 #endif | 86 #endif |
OLD | NEW |