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 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } | 508 } |
509 | 509 |
510 void GrGpu::releaseReservedIndexSpace() { | 510 void GrGpu::releaseReservedIndexSpace() { |
511 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 511 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
512 SkASSERT(kReserved_GeometrySrcType == geoSrc.fIndexSrc); | 512 SkASSERT(kReserved_GeometrySrcType == geoSrc.fIndexSrc); |
513 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 513 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
514 fIndexPool->putBack(bytes); | 514 fIndexPool->putBack(bytes); |
515 --fIndexPoolUseCnt; | 515 --fIndexPoolUseCnt; |
516 } | 516 } |
517 | 517 |
518 void GrGpu::onSetVertexSourceToArray(const void* vertexArray, int vertexCount) { | |
519 this->prepareVertexPool(); | |
520 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); | |
521 #ifdef SK_DEBUG | |
522 bool success = | |
523 #endif | |
524 fVertexPool->appendVertices(this->getVertexSize(), | |
525 vertexCount, | |
526 vertexArray, | |
527 &geomPoolState.fPoolVertexBuffer, | |
528 &geomPoolState.fPoolStartVertex); | |
529 ++fVertexPoolUseCnt; | |
530 GR_DEBUGASSERT(success); | |
531 } | |
532 | |
533 void GrGpu::onSetIndexSourceToArray(const void* indexArray, int indexCount) { | |
534 this->prepareIndexPool(); | |
535 GeometryPoolState& geomPoolState = fGeomPoolStateStack.back(); | |
536 #ifdef SK_DEBUG | |
537 bool success = | |
538 #endif | |
539 fIndexPool->appendIndices(indexCount, | |
540 indexArray, | |
541 &geomPoolState.fPoolIndexBuffer, | |
542 &geomPoolState.fPoolStartIndex); | |
543 ++fIndexPoolUseCnt; | |
544 GR_DEBUGASSERT(success); | |
545 } | |
546 | |
547 void GrGpu::releaseVertexArray() { | 518 void GrGpu::releaseVertexArray() { |
548 // if vertex source was array, we stowed data in the pool | 519 // if vertex source was array, we stowed data in the pool |
549 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 520 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
550 SkASSERT(kArray_GeometrySrcType == geoSrc.fVertexSrc); | 521 SkASSERT(kArray_GeometrySrcType == geoSrc.fVertexSrc); |
551 size_t bytes = geoSrc.fVertexCount * geoSrc.fVertexSize; | 522 size_t bytes = geoSrc.fVertexCount * geoSrc.fVertexSize; |
552 fVertexPool->putBack(bytes); | 523 fVertexPool->putBack(bytes); |
553 --fVertexPoolUseCnt; | 524 --fVertexPoolUseCnt; |
554 } | 525 } |
555 | 526 |
556 void GrGpu::releaseIndexArray() { | 527 void GrGpu::releaseIndexArray() { |
557 // if index source was array, we stowed data in the pool | 528 // if index source was array, we stowed data in the pool |
558 const GeometrySrcState& geoSrc = this->getGeomSrc(); | 529 const GeometrySrcState& geoSrc = this->getGeomSrc(); |
559 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); | 530 SkASSERT(kArray_GeometrySrcType == geoSrc.fIndexSrc); |
560 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); | 531 size_t bytes = geoSrc.fIndexCount * sizeof(uint16_t); |
561 fIndexPool->putBack(bytes); | 532 fIndexPool->putBack(bytes); |
562 --fIndexPoolUseCnt; | 533 --fIndexPoolUseCnt; |
563 } | 534 } |
OLD | NEW |