OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "GrGpu.h" | 10 #include "GrGpu.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 if (NULL == fQuadIndexBuffer) { | 269 if (NULL == fQuadIndexBuffer) { |
270 static const int SIZE = sizeof(uint16_t) * 6 * MAX_QUADS; | 270 static const int SIZE = sizeof(uint16_t) * 6 * MAX_QUADS; |
271 GrGpu* me = const_cast<GrGpu*>(this); | 271 GrGpu* me = const_cast<GrGpu*>(this); |
272 fQuadIndexBuffer = me->createIndexBuffer(SIZE, false); | 272 fQuadIndexBuffer = me->createIndexBuffer(SIZE, false); |
273 if (NULL != fQuadIndexBuffer) { | 273 if (NULL != fQuadIndexBuffer) { |
274 uint16_t* indices = (uint16_t*)fQuadIndexBuffer->lock(); | 274 uint16_t* indices = (uint16_t*)fQuadIndexBuffer->lock(); |
275 if (NULL != indices) { | 275 if (NULL != indices) { |
276 fill_indices(indices, MAX_QUADS); | 276 fill_indices(indices, MAX_QUADS); |
277 fQuadIndexBuffer->unlock(); | 277 fQuadIndexBuffer->unlock(); |
278 } else { | 278 } else { |
279 indices = (uint16_t*)GrMalloc(SIZE); | 279 indices = (uint16_t*)sk_malloc_throw(SIZE); |
280 fill_indices(indices, MAX_QUADS); | 280 fill_indices(indices, MAX_QUADS); |
281 if (!fQuadIndexBuffer->updateData(indices, SIZE)) { | 281 if (!fQuadIndexBuffer->updateData(indices, SIZE)) { |
282 fQuadIndexBuffer->unref(); | 282 fQuadIndexBuffer->unref(); |
283 fQuadIndexBuffer = NULL; | 283 fQuadIndexBuffer = NULL; |
284 GrCrash("Can't get indices into buffer!"); | 284 GrCrash("Can't get indices into buffer!"); |
285 } | 285 } |
286 GrFree(indices); | 286 sk_free(indices); |
287 } | 287 } |
288 } | 288 } |
289 } | 289 } |
290 | 290 |
291 return fQuadIndexBuffer; | 291 return fQuadIndexBuffer; |
292 } | 292 } |
293 | 293 |
294 //////////////////////////////////////////////////////////////////////////////// | 294 //////////////////////////////////////////////////////////////////////////////// |
295 | 295 |
296 bool GrGpu::setupClipAndFlushState(DrawType type, const GrDeviceCoordTexture* ds
tCopy, | 296 bool GrGpu::setupClipAndFlushState(DrawType type, const GrDeviceCoordTexture* ds
tCopy, |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 } | 491 } |
492 | 492 |
493 void GrGpu::releaseIndexArray() { | 493 void GrGpu::releaseIndexArray() { |
494 // if index source was array, we stowed data in the pool | 494 // if index source was array, we stowed data in the pool |
495 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 495 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
496 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 496 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
497 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 497 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
498 fIndexPool->putBack(bytes); | 498 fIndexPool->putBack(bytes); |
499 --fIndexPoolUseCnt; | 499 --fIndexPoolUseCnt; |
500 } | 500 } |
OLD | NEW |