| 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 GrDrawBatch::TransferPixelsFn tp = [this](GrTexture* texture, | 80 upload(wp); |
| 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(texture, left, top, width, height,
config, buffer, | |
| 85 offset, rowBytes); | |
| 86 }; | |
| 87 upload(wp, tp); | |
| 88 } | 81 } |
| 89 | 82 |
| 90 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } | 83 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } |
| 91 | 84 |
| 92 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } | 85 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } |
| 93 | 86 |
| 94 GrGpu* gpu() { return fGpu; } | 87 GrGpu* gpu() { return fGpu; } |
| 95 | 88 |
| 96 void reset() { | 89 void reset() { |
| 97 fVertexPool.reset(); | 90 fVertexPool.reset(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 void putBackVertices(int vertices, size_t vertexStride) { | 195 void putBackVertices(int vertices, size_t vertexStride) { |
| 203 this->state()->putBackVertexSpace(vertices * vertexStride); | 196 this->state()->putBackVertexSpace(vertices * vertexStride); |
| 204 } | 197 } |
| 205 | 198 |
| 206 private: | 199 private: |
| 207 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } | 200 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } |
| 208 typedef GrDrawBatch::Target INHERITED; | 201 typedef GrDrawBatch::Target INHERITED; |
| 209 }; | 202 }; |
| 210 | 203 |
| 211 #endif | 204 #endif |
| OLD | NEW |