OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 "GrBatch.h" | 8 #include "GrBatch.h" |
9 #include "GrBatchTarget.h" | 9 #include "GrBatchTarget.h" |
10 #include "GrResourceProvider.h" | 10 #include "GrResourceProvider.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 ~MemoryPoolAccessor() { gBatchSpinlock.release(); } | 30 ~MemoryPoolAccessor() { gBatchSpinlock.release(); } |
31 | 31 |
32 GrMemoryPool* pool() const { | 32 GrMemoryPool* pool() const { |
33 static GrMemoryPool gPool(16384, 16384); | 33 static GrMemoryPool gPool(16384, 16384); |
34 return &gPool; | 34 return &gPool; |
35 } | 35 } |
36 }; | 36 }; |
37 } | 37 } |
38 | 38 |
39 int32_t GrBatch::gCurrBatchClassID = GrBatch::kIllegalBatchClassID; | 39 int32_t GrBatch::gCurrBatchClassID = GrBatch::kIllegalBatchID; |
| 40 |
| 41 GrBATCH_SPEW(int32_t GrBatch::gCurrBatchUniqueID = GrBatch::kIllegalBatchID;) |
40 | 42 |
41 void* GrBatch::operator new(size_t size) { | 43 void* GrBatch::operator new(size_t size) { |
42 return MemoryPoolAccessor().pool()->allocate(size); | 44 return MemoryPoolAccessor().pool()->allocate(size); |
43 } | 45 } |
44 | 46 |
45 void GrBatch::operator delete(void* target) { | 47 void GrBatch::operator delete(void* target) { |
46 return MemoryPoolAccessor().pool()->release(target); | 48 return MemoryPoolAccessor().pool()->release(target); |
47 } | 49 } |
48 | 50 |
49 void* GrBatch::InstancedHelper::init(GrBatchTarget* batchTarget, GrPrimitiveType
primType, | 51 void* GrBatch::InstancedHelper::init(GrBatchTarget* batchTarget, GrPrimitiveType
primType, |
(...skipping 26 matching lines...) Expand all Loading... |
76 void* GrBatch::QuadHelper::init(GrBatchTarget* batchTarget, size_t vertexStride,
int quadsToDraw) { | 78 void* GrBatch::QuadHelper::init(GrBatchTarget* batchTarget, size_t vertexStride,
int quadsToDraw) { |
77 SkAutoTUnref<const GrIndexBuffer> quadIndexBuffer( | 79 SkAutoTUnref<const GrIndexBuffer> quadIndexBuffer( |
78 batchTarget->resourceProvider()->refQuadIndexBuffer()); | 80 batchTarget->resourceProvider()->refQuadIndexBuffer()); |
79 if (!quadIndexBuffer) { | 81 if (!quadIndexBuffer) { |
80 SkDebugf("Could not get quad index buffer."); | 82 SkDebugf("Could not get quad index buffer."); |
81 return NULL; | 83 return NULL; |
82 } | 84 } |
83 return this->INHERITED::init(batchTarget, kTriangles_GrPrimitiveType, vertex
Stride, | 85 return this->INHERITED::init(batchTarget, kTriangles_GrPrimitiveType, vertex
Stride, |
84 quadIndexBuffer, kVerticesPerQuad, kIndicesPerQ
uad, quadsToDraw); | 86 quadIndexBuffer, kVerticesPerQuad, kIndicesPerQ
uad, quadsToDraw); |
85 } | 87 } |
OLD | NEW |