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 GrEffect::~GrEffect() {} | 62 GrEffectRef::~GrEffectRef() { |
| 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 } |
63 | 81 |
64 const char* GrEffect::name() const { | 82 const char* GrEffect::name() const { |
65 return this->getFactory().name(); | 83 return this->getFactory().name(); |
66 } | 84 } |
67 | 85 |
68 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { | 86 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { |
69 fCoordTransforms.push_back(transform); | 87 fCoordTransforms.push_back(transform); |
70 SkDEBUGCODE(transform->setInEffect();) | 88 SkDEBUGCODE(transform->setInEffect();) |
71 } | 89 } |
72 | 90 |
(...skipping 14 matching lines...) Expand all Loading... |
87 SkASSERT(this->numTransforms() == other.numTransforms()); | 105 SkASSERT(this->numTransforms() == other.numTransforms()); |
88 for (int i = 0; i < this->numTransforms(); ++i) { | 106 for (int i = 0; i < this->numTransforms(); ++i) { |
89 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); | 107 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); |
90 } | 108 } |
91 SkASSERT(this->numTextures() == other.numTextures()); | 109 SkASSERT(this->numTextures() == other.numTextures()); |
92 for (int i = 0; i < this->numTextures(); ++i) { | 110 for (int i = 0; i < this->numTextures(); ++i) { |
93 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | 111 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
94 } | 112 } |
95 } | 113 } |
96 #endif | 114 #endif |
OLD | NEW |