| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 | 8 |
| 9 #include "GrBufferAllocPool.h" | 9 #include "GrBufferAllocPool.h" |
| 10 #include "GrBuffer.h" | 10 #include "GrBuffer.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 SkASSERT(!block.fBuffer->isMapped()); | 274 SkASSERT(!block.fBuffer->isMapped()); |
| 275 block.fBuffer->unref(); | 275 block.fBuffer->unref(); |
| 276 fBlocks.pop_back(); | 276 fBlocks.pop_back(); |
| 277 fBufferPtr = nullptr; | 277 fBufferPtr = nullptr; |
| 278 } | 278 } |
| 279 | 279 |
| 280 void* GrBufferAllocPool::resetCpuData(size_t newSize) { | 280 void* GrBufferAllocPool::resetCpuData(size_t newSize) { |
| 281 sk_free(fCpuData); | 281 sk_free(fCpuData); |
| 282 if (newSize) { | 282 if (newSize) { |
| 283 if (fGpu->caps()->mustClearUploadedBufferData()) { | 283 if (fGpu->caps()->mustClearUploadedBufferData()) { |
| 284 fCpuData = sk_calloc(newSize); | 284 fCpuData = sk_calloc_throw(newSize); |
| 285 } else { | 285 } else { |
| 286 fCpuData = sk_malloc_throw(newSize); | 286 fCpuData = sk_malloc_throw(newSize); |
| 287 } | 287 } |
| 288 } else { | 288 } else { |
| 289 fCpuData = nullptr; | 289 fCpuData = nullptr; |
| 290 } | 290 } |
| 291 return fCpuData; | 291 return fCpuData; |
| 292 } | 292 } |
| 293 | 293 |
| 294 | 294 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 size_t offset = 0; // assign to suppress warning | 365 size_t offset = 0; // assign to suppress warning |
| 366 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), | 366 void* ptr = INHERITED::makeSpace(indexCount * sizeof(uint16_t), |
| 367 sizeof(uint16_t), | 367 sizeof(uint16_t), |
| 368 buffer, | 368 buffer, |
| 369 &offset); | 369 &offset); |
| 370 | 370 |
| 371 SkASSERT(0 == offset % sizeof(uint16_t)); | 371 SkASSERT(0 == offset % sizeof(uint16_t)); |
| 372 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); | 372 *startIndex = static_cast<int>(offset / sizeof(uint16_t)); |
| 373 return ptr; | 373 return ptr; |
| 374 } | 374 } |
| OLD | NEW |