| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 } | 71 } |
| 72 | 72 |
| 73 void doUpload(GrDrawBatch::DeferredUploadFn& upload) { | 73 void doUpload(GrDrawBatch::DeferredUploadFn& upload) { |
| 74 GrDrawBatch::WritePixelsFn wp = [this] (GrSurface* surface, | 74 GrDrawBatch::WritePixelsFn wp = [this] (GrSurface* surface, |
| 75 int left, int top, int width, int height, | 75 int left, int top, int width, int height, |
| 76 GrPixelConfig config, const void* buffer, | 76 GrPixelConfig config, const void* buffer, |
| 77 size_t rowBytes) -> bool { | 77 size_t rowBytes) -> bool { |
| 78 return this->fGpu->writePixels(surface, left, top, width, height, co
nfig, buffer, | 78 return this->fGpu->writePixels(surface, left, top, width, height, co
nfig, buffer, |
| 79 rowBytes); | 79 rowBytes); |
| 80 }; | 80 }; |
| 81 upload(wp); | 81 GrDrawBatch::TransferPixelsFn tp = [this](GrTexture* texture, |
| 82 int left, int top, int width, in
t height, |
| 83 GrPixelConfig config, GrBuffer*
buffer, |
| 84 size_t offset, size_t rowBytes, |
| 85 GrFence* fence) -> bool { |
| 86 return this->fGpu->transferPixels(texture, left, top, width, height,
config, buffer, |
| 87 offset, rowBytes, fence); |
| 88 }; |
| 89 upload(wp, tp); |
| 82 } | 90 } |
| 83 | 91 |
| 84 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } | 92 void putBackIndices(size_t indices) { fIndexPool.putBack(indices * sizeof(ui
nt16_t)); } |
| 85 | 93 |
| 86 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } | 94 void putBackVertexSpace(size_t sizeInBytes) { fVertexPool.putBack(sizeInByte
s); } |
| 87 | 95 |
| 88 GrGpuCommandBuffer* commandBuffer() { return fCommandBuffer; } | 96 GrGpuCommandBuffer* commandBuffer() { return fCommandBuffer; } |
| 89 void setCommandBuffer(GrGpuCommandBuffer* buffer) { fCommandBuffer = buffer;
} | 97 void setCommandBuffer(GrGpuCommandBuffer* buffer) { fCommandBuffer = buffer;
} |
| 90 | 98 |
| 91 GrGpu* gpu() { return fGpu; } | 99 GrGpu* gpu() { return fGpu; } |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 void putBackVertices(int vertices, size_t vertexStride) { | 209 void putBackVertices(int vertices, size_t vertexStride) { |
| 202 this->state()->putBackVertexSpace(vertices * vertexStride); | 210 this->state()->putBackVertexSpace(vertices * vertexStride); |
| 203 } | 211 } |
| 204 | 212 |
| 205 private: | 213 private: |
| 206 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } | 214 GrVertexBatch* vertexBatch() { return static_cast<GrVertexBatch*>(this->batc
h()); } |
| 207 typedef GrDrawBatch::Target INHERITED; | 215 typedef GrDrawBatch::Target INHERITED; |
| 208 }; | 216 }; |
| 209 | 217 |
| 210 #endif | 218 #endif |
| OLD | NEW |