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 #include "GrEffect.h" | 8 #include "GrEffect.h" |
9 #include "GrBackendEffectFactory.h" | 9 #include "GrBackendEffectFactory.h" |
10 #include "GrContext.h" | 10 #include "GrContext.h" |
11 #include "GrCoordTransform.h" | 11 #include "GrCoordTransform.h" |
12 #include "GrMemoryPool.h" | 12 #include "GrMemoryPool.h" |
13 #include "SkTLS.h" | 13 #include "SkTLS.h" |
14 | 14 |
15 SK_DEFINE_INST_COUNT(GrEffect) | |
16 | |
17 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 15 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
18 SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() { | 16 SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() { |
19 static SkTArray<GrEffectTestFactory*, true> gFactories; | 17 static SkTArray<GrEffectTestFactory*, true> gFactories; |
20 return &gFactories; | 18 return &gFactories; |
21 } | 19 } |
22 #endif | 20 #endif |
23 | 21 |
24 namespace GrEffectUnitTest { | 22 namespace GrEffectUnitTest { |
25 const SkMatrix& TestMatrix(SkRandom* random) { | 23 const SkMatrix& TestMatrix(SkRandom* random) { |
26 static SkMatrix gMatrices[5]; | 24 static SkMatrix gMatrices[5]; |
(...skipping 27 matching lines...) Expand all Loading... |
54 | 52 |
55 static void DeleteTLS(void* pool) { | 53 static void DeleteTLS(void* pool) { |
56 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); | 54 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); |
57 } | 55 } |
58 }; | 56 }; |
59 | 57 |
60 int32_t GrBackendEffectFactory::fCurrEffectClassID = GrBackendEffectFactory::kIl
legalEffectClassID; | 58 int32_t GrBackendEffectFactory::fCurrEffectClassID = GrBackendEffectFactory::kIl
legalEffectClassID; |
61 | 59 |
62 /////////////////////////////////////////////////////////////////////////////// | 60 /////////////////////////////////////////////////////////////////////////////// |
63 | 61 |
64 SK_DEFINE_INST_COUNT(GrEffectRef) | |
65 | |
66 GrEffectRef::~GrEffectRef() { | 62 GrEffectRef::~GrEffectRef() { |
67 SkASSERT(this->unique()); | 63 SkASSERT(this->unique()); |
68 fEffect->EffectRefDestroyed(); | 64 fEffect->EffectRefDestroyed(); |
69 fEffect->unref(); | 65 fEffect->unref(); |
70 } | 66 } |
71 | 67 |
72 void* GrEffectRef::operator new(size_t size) { | 68 void* GrEffectRef::operator new(size_t size) { |
73 return GrEffect_Globals::GetTLS()->allocate(size); | 69 return GrEffect_Globals::GetTLS()->allocate(size); |
74 } | 70 } |
75 | 71 |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 SkASSERT(this->numTransforms() == other.numTransforms()); | 105 SkASSERT(this->numTransforms() == other.numTransforms()); |
110 for (int i = 0; i < this->numTransforms(); ++i) { | 106 for (int i = 0; i < this->numTransforms(); ++i) { |
111 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); | 107 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); |
112 } | 108 } |
113 SkASSERT(this->numTextures() == other.numTextures()); | 109 SkASSERT(this->numTextures() == other.numTextures()); |
114 for (int i = 0; i < this->numTextures(); ++i) { | 110 for (int i = 0; i < this->numTextures(); ++i) { |
115 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | 111 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
116 } | 112 } |
117 } | 113 } |
118 #endif | 114 #endif |
OLD | NEW |