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 "GrProcessor.h" | 8 #include "GrProcessor.h" |
9 #include "GrContext.h" | 9 #include "GrContext.h" |
10 #include "GrCoordTransform.h" | 10 #include "GrCoordTransform.h" |
11 #include "GrGeometryData.h" | |
12 #include "GrGeometryProcessor.h" | 11 #include "GrGeometryProcessor.h" |
13 #include "GrInvariantOutput.h" | 12 #include "GrInvariantOutput.h" |
14 #include "GrMemoryPool.h" | 13 #include "GrMemoryPool.h" |
15 #include "GrXferProcessor.h" | 14 #include "GrXferProcessor.h" |
16 #include "SkTLS.h" | 15 #include "SkTLS.h" |
17 | 16 |
18 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS | 17 #if SK_ALLOW_STATIC_GLOBAL_INITIALIZERS |
19 | 18 |
20 class GrFragmentProcessor; | 19 class GrFragmentProcessor; |
21 class GrGeometryProcessor; | 20 class GrGeometryProcessor; |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 } | 164 } |
166 return true; | 165 return true; |
167 } | 166 } |
168 | 167 |
169 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
{ | 168 void GrFragmentProcessor::computeInvariantOutput(GrInvariantOutput* inout) const
{ |
170 this->onComputeInvariantOutput(inout); | 169 this->onComputeInvariantOutput(inout); |
171 } | 170 } |
172 | 171 |
173 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | 172 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
174 | 173 |
175 /* | |
176 * GrGeometryData shares the same pool so it lives in this file too | |
177 */ | |
178 void* GrGeometryData::operator new(size_t size) { | |
179 return GrProcessor_Globals::GetTLS()->allocate(size); | |
180 } | |
181 | |
182 void GrGeometryData::operator delete(void* target) { | |
183 GrProcessor_Globals::GetTLS()->release(target); | |
184 } | |
185 | |
186 ////////////////////////////////////////////////////////////////////////////////
/////////////////// | |
187 | |
188 // Initial static variable from GrXPFactory | 174 // Initial static variable from GrXPFactory |
189 int32_t GrXPFactory::gCurrXPFClassID = | 175 int32_t GrXPFactory::gCurrXPFClassID = |
190 GrXPFactory::kIllegalXPFClassID; | 176 GrXPFactory::kIllegalXPFClassID; |
| 177 |
| 178 |
| 179 ////////////////////////////////////////////////////////////////////////////////
/////////////////// |
| 180 #include "GrBatch.h" |
| 181 // TODO this just lives here to use the memory pool, we should move all the memo
ry pool stuff to |
| 182 // a separate file |
| 183 class GrBatch_Globals { |
| 184 public: |
| 185 static GrMemoryPool* GetTLS() { |
| 186 return (GrMemoryPool*)SkTLS::Get(CreateTLS, DeleteTLS); |
| 187 } |
| 188 |
| 189 private: |
| 190 static void* CreateTLS() { |
| 191 return SkNEW_ARGS(GrMemoryPool, (4096, 4096)); |
| 192 } |
| 193 |
| 194 static void DeleteTLS(void* pool) { |
| 195 SkDELETE(reinterpret_cast<GrMemoryPool*>(pool)); |
| 196 } |
| 197 }; |
| 198 |
| 199 int32_t GrBatch::gCurrBatchClassID = |
| 200 GrBatch::kIllegalBatchClassID; |
| 201 |
| 202 void* GrBatch::operator new(size_t size) { |
| 203 return GrBatch_Globals::GetTLS()->allocate(size); |
| 204 } |
| 205 |
| 206 void GrBatch::operator delete(void* target) { |
| 207 GrBatch_Globals::GetTLS()->release(target); |
| 208 } |
OLD | NEW |