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 "GrMemoryPool.h" | 12 #include "GrMemoryPool.h" |
12 #include "SkTLS.h" | 13 #include "SkTLS.h" |
13 | 14 |
14 SK_DEFINE_INST_COUNT(GrEffect) | 15 SK_DEFINE_INST_COUNT(GrEffect) |
15 | 16 |
16 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 17 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
17 SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() { | 18 SkTArray<GrEffectTestFactory*, true>* GrEffectTestFactory::GetFactories() { |
18 static SkTArray<GrEffectTestFactory*, true> gFactories; | 19 static SkTArray<GrEffectTestFactory*, true> gFactories; |
19 return &gFactories; | 20 return &gFactories; |
20 } | 21 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 /////////////////////////////////////////////////////////////////////////////// | 80 /////////////////////////////////////////////////////////////////////////////// |
80 | 81 |
81 GrEffect::~GrEffect() { | 82 GrEffect::~GrEffect() { |
82 SkASSERT(NULL == fEffectRef); | 83 SkASSERT(NULL == fEffectRef); |
83 } | 84 } |
84 | 85 |
85 const char* GrEffect::name() const { | 86 const char* GrEffect::name() const { |
86 return this->getFactory().name(); | 87 return this->getFactory().name(); |
87 } | 88 } |
88 | 89 |
| 90 void GrEffect::addCoordTransform(const GrCoordTransform* transform) { |
| 91 fCoordTransforms.push_back(transform); |
| 92 } |
| 93 |
89 void GrEffect::addTextureAccess(const GrTextureAccess* access) { | 94 void GrEffect::addTextureAccess(const GrTextureAccess* access) { |
90 fTextureAccesses.push_back(access); | 95 fTextureAccesses.push_back(access); |
91 } | 96 } |
92 | 97 |
93 void* GrEffect::operator new(size_t size) { | 98 void* GrEffect::operator new(size_t size) { |
94 return GrEffect_Globals::GetTLS()->allocate(size); | 99 return GrEffect_Globals::GetTLS()->allocate(size); |
95 } | 100 } |
96 | 101 |
97 void GrEffect::operator delete(void* target) { | 102 void GrEffect::operator delete(void* target) { |
98 GrEffect_Globals::GetTLS()->release(target); | 103 GrEffect_Globals::GetTLS()->release(target); |
99 } | 104 } |
| 105 |
| 106 #ifdef SK_DEBUG |
| 107 void GrEffect::assertEquality(const GrEffect& other) const { |
| 108 SkASSERT(this->numTransforms() == other.numTransforms()); |
| 109 for (int i = 0; i < this->numTransforms(); ++i) { |
| 110 SkASSERT(this->coordTransform(i) == other.coordTransform(i)); |
| 111 } |
| 112 SkASSERT(this->numTextures() == other.numTextures()); |
| 113 for (int i = 0; i < this->numTextures(); ++i) { |
| 114 SkASSERT(this->textureAccess(i) == other.textureAccess(i)); |
| 115 } |
| 116 } |
| 117 #endif |
OLD | NEW |