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 #ifndef GrBatchBuffer_DEFINED | 8 #ifndef GrBatchBuffer_DEFINED |
9 #define GrBatchBuffer_DEFINED | 9 #define GrBatchBuffer_DEFINED |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 } | 70 } |
71 | 71 |
72 void doUpload(GrDrawBatch::DeferredUploadFn& upload) { | 72 void doUpload(GrDrawBatch::DeferredUploadFn& upload) { |
73 GrDrawBatch::WritePixelsFn wp = [this] (GrSurface* surface, | 73 GrDrawBatch::WritePixelsFn wp = [this] (GrSurface* surface, |
74 int left, int top, int width, int height, | 74 int left, int top, int width, int height, |
75 GrPixelConfig config, const void* buffer, | 75 GrPixelConfig config, const void* buffer, |
76 size_t rowBytes) -> bool { | 76 size_t rowBytes) -> bool { |
77 return this->fGpu->writePixels(surface, left, top, width, height, co
nfig, buffer, | 77 return this->fGpu->writePixels(surface, left, top, width, height, co
nfig, buffer, |
78 rowBytes); | 78 rowBytes); |
79 }; | 79 }; |
80 upload(wp); | 80 GrDrawBatch::TransferPixelsFn tp = [this](GrSurface* surface, |
| 81 int left, int top, int width, in
t height, |
| 82 GrPixelConfig config, GrBuffer*
buffer, |
| 83 size_t offset, size_t rowBytes)
-> bool { |
| 84 return this->fGpu->transferPixels(surface, left, top, width, height,
config, buffer, |
| 85 offset, rowBytes); |
| 86 }; |
| 87 upload(wp, tp); |
81 } | 88 } |
82 | 89 |
83 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } | 90 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } |
84 | 91 |
85 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } | 92 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } |
86 | 93 |
87 GrGpu* gpu() { return fGpu; } | 94 GrGpu* gpu() { return fGpu; } |
88 | 95 |
89 void reset() { | 96 void reset() { |
90 fVertexPool.reset(); | 97 fVertexPool.reset(); |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 void putBackVertices(int vertices, size_t vertexStride) { | 202 void putBackVertices(int vertices, size_t vertexStride) { |
196 this->state()->putBackVertexSpace(vertices * vertexStride); | 203 this->state()->putBackVertexSpace(vertices * vertexStride); |
197 } | 204 } |
198 | 205 |
199 private: | 206 private: |
200 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } | 207 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } |
201 typedef GrDrawBatch::Target INHERITED; | 208 typedef GrDrawBatch::Target INHERITED; |
202 }; | 209 }; |
203 | 210 |
204 #endif | 211 #endif |
OLD | NEW |