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" |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 | 52 |
53 static void DeleteTLS(void* pool) { | 53 static void DeleteTLS(void* pool) { |
54 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); | 54 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); |
55 } | 55 } |
56 }; | 56 }; |
57 | 57 |
58 int32_t GrBackendEffectFactory::fCurrEffectClassID = GrBackendEffectFactory::kIl
legalEffectClassID; | 58 int32_t GrBackendEffectFactory::fCurrEffectClassID = GrBackendEffectFactory::kIl
legalEffectClassID; |
59 | 59 |
60 /////////////////////////////////////////////////////////////////////////////// | 60 /////////////////////////////////////////////////////////////////////////////// |
61 | 61 |
62 GrEffectRef::~GrEffectRef() { | 62 GrEffect::~GrEffect() {} |
63 SkASSERT(this->unique()); | |
64 fEffect->EffectRefDestroyed(); | |
65 fEffect->unref(); | |
66 } | |
67 | |
68 void* GrEffectRef::operator new(size_t size) { | |
69 return GrEffect_Globals::GetTLS()->allocate(size); | |
70 } | |
71 | |
72 void GrEffectRef::operator delete(void* target) { | |
73 GrEffect_Globals::GetTLS()->release(target); | |
74 } | |
75 | |
76 /////////////////////////////////////////////////////////////////////////////// | |
77 | |
78 GrEffect::~GrEffect() { | |
79 SkASSERT(NULL == fEffectRef); | |
80 } | |
81 | 63 |
82 const char* GrEffect::name() const { | 64 const char* GrEffect::name() const { |
83 return this->getFactory().name(); | 65 return this->getFactory().name(); |
84 } | 66 } |
85 | 67 |
86 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { | 68 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { |
87 fCoordTransforms.push_back(transform); | 69 fCoordTransforms.push_back(transform); |
88 SkDEBUGCODE(transform->setInEffect();) | 70 SkDEBUGCODE(transform->setInEffect();) |
89 } | 71 } |
90 | 72 |
(...skipping 14 matching lines...) Expand all Loading... |
105 SkASSERT(this->numTransforms() == other.numTransforms()); | 87 SkASSERT(this->numTransforms() == other.numTransforms()); |
106 for (int i = 0; i < this->numTransforms(); ++i) { | 88 for (int i = 0; i < this->numTransforms(); ++i) { |
107 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); | 89 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); |
108 } | 90 } |
109 SkASSERT(this->numTextures() == other.numTextures()); | 91 SkASSERT(this->numTextures() == other.numTextures()); |
110 for (int i = 0; i < this->numTextures(); ++i) { | 92 for (int i = 0; i < this->numTextures(); ++i) { |
111 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | 93 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
112 } | 94 } |
113 } | 95 } |
114 #endif | 96 #endif |
OLD | NEW |