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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 GrEffect::~GrEffect() { | 82 GrEffect::~GrEffect() { |
83 SkASSERT(NULL == fEffectRef); | 83 SkASSERT(NULL == fEffectRef); |
84 } | 84 } |
85 | 85 |
86 const char* GrEffect::name() const { | 86 const char* GrEffect::name() const { |
87 return this->getFactory().name(); | 87 return this->getFactory().name(); |
88 } | 88 } |
89 | 89 |
90 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { | 90 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { |
91 fCoordTransforms.push_back(transform); | 91 fCoordTransforms.push_back(transform); |
| 92 SkDEBUGCODE(transform->setInEffect();) |
92 } | 93 } |
93 | 94 |
94 void GrEffect::addTextureAccess(const GrTextureAccess* access) { | 95 void GrEffect::addTextureAccess(const GrTextureAccess* access) { |
95 fTextureAccesses.push_back(access); | 96 fTextureAccesses.push_back(access); |
96 } | 97 } |
97 | 98 |
98 void* GrEffect::operator new(size_t size) { | 99 void* GrEffect::operator new(size_t size) { |
99 return GrEffect_Globals::GetTLS()->allocate(size); | 100 return GrEffect_Globals::GetTLS()->allocate(size); |
100 } | 101 } |
101 | 102 |
102 void GrEffect::operator delete(void* target) { | 103 void GrEffect::operator delete(void* target) { |
103 GrEffect_Globals::GetTLS()->release(target); | 104 GrEffect_Globals::GetTLS()->release(target); |
104 } | 105 } |
105 | 106 |
106 #ifdef SK_DEBUG | 107 #ifdef SK_DEBUG |
107 void GrEffect::assertEquality(const GrEffect& other) const { | 108 void GrEffect::assertEquality(const GrEffect& other) const { |
108 SkASSERT(this->numTransforms() == other.numTransforms()); | 109 SkASSERT(this->numTransforms() == other.numTransforms()); |
109 for (int i = 0; i < this->numTransforms(); ++i) { | 110 for (int i = 0; i < this->numTransforms(); ++i) { |
110 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); | 111 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); |
111 } | 112 } |
112 SkASSERT(this->numTextures() == other.numTextures()); | 113 SkASSERT(this->numTextures() == other.numTextures()); |
113 for (int i = 0; i < this->numTextures(); ++i) { | 114 for (int i = 0; i < this->numTextures(); ++i) { |
114 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); | 115 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
115 } | 116 } |
116 } | 117 } |
117 #endif | 118 #endif |
OLD | NEW |