OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 #include "GrInOrderDrawBuffer.h" | 8 #include "GrInOrderDrawBuffer.h" |
9 | 9 |
10 #include "GrBufferAllocPool.h" | 10 #include "GrBufferAllocPool.h" |
(...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
731 | 731 |
732 // Similar to releaseReservedVertexSpace we return any unused portion at | 732 // Similar to releaseReservedVertexSpace we return any unused portion at |
733 // the tail | 733 // the tail |
734 size_t reservedIndexBytes = sizeof(uint16_t) * geoSrc.fIndexCount; | 734 size_t reservedIndexBytes = sizeof(uint16_t) * geoSrc.fIndexCount; |
735 fIndexPool.putBack(reservedIndexBytes - poolState.fUsedPoolIndexBytes); | 735 fIndexPool.putBack(reservedIndexBytes - poolState.fUsedPoolIndexBytes); |
736 poolState.fUsedPoolIndexBytes = 0; | 736 poolState.fUsedPoolIndexBytes = 0; |
737 poolState.fPoolIndexBuffer = NULL; | 737 poolState.fPoolIndexBuffer = NULL; |
738 poolState.fPoolStartIndex = 0; | 738 poolState.fPoolStartIndex = 0; |
739 } | 739 } |
740 | 740 |
741 void GrInOrderDrawBuffer::onSetVertexSourceToArray(const void* vertexArray, int
vertexCount) { | |
742 GeometryPoolState& poolState = fGeoPoolStateStack.back(); | |
743 SkASSERT(0 == poolState.fUsedPoolVertexBytes); | |
744 #ifdef SK_DEBUG | |
745 bool success = | |
746 #endif | |
747 fVertexPool.appendVertices(this->getVertexSize(), | |
748 vertexCount, | |
749 vertexArray, | |
750 &poolState.fPoolVertexBuffer, | |
751 &poolState.fPoolStartVertex); | |
752 GR_DEBUGASSERT(success); | |
753 } | |
754 | |
755 void GrInOrderDrawBuffer::onSetIndexSourceToArray(const void* indexArray, | |
756 int indexCount) { | |
757 GeometryPoolState& poolState = fGeoPoolStateStack.back(); | |
758 SkASSERT(0 == poolState.fUsedPoolIndexBytes); | |
759 #ifdef SK_DEBUG | |
760 bool success = | |
761 #endif | |
762 fIndexPool.appendIndices(indexCount, | |
763 indexArray, | |
764 &poolState.fPoolIndexBuffer, | |
765 &poolState.fPoolStartIndex); | |
766 GR_DEBUGASSERT(success); | |
767 } | |
768 | |
769 void GrInOrderDrawBuffer::releaseVertexArray() { | 741 void GrInOrderDrawBuffer::releaseVertexArray() { |
770 // When the client provides an array as the vertex source we handled it | 742 // When the client provides an array as the vertex source we handled it |
771 // by copying their array into reserved space. | 743 // by copying their array into reserved space. |
772 this->GrInOrderDrawBuffer::releaseReservedVertexSpace(); | 744 this->GrInOrderDrawBuffer::releaseReservedVertexSpace(); |
773 } | 745 } |
774 | 746 |
775 void GrInOrderDrawBuffer::releaseIndexArray() { | 747 void GrInOrderDrawBuffer::releaseIndexArray() { |
776 // When the client provides an array as the index source we handled it | 748 // When the client provides an array as the index source we handled it |
777 // by copying their array into reserved space. | 749 // by copying their array into reserved space. |
778 this->GrInOrderDrawBuffer::releaseReservedIndexSpace(); | 750 this->GrInOrderDrawBuffer::releaseReservedIndexSpace(); |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); | 828 fCmdBuffer.back().fType = add_trace_bit(fCmdBuffer.back().fType); |
857 fGpuCmdMarkers.push_back(activeTraceMarkers); | 829 fGpuCmdMarkers.push_back(activeTraceMarkers); |
858 } | 830 } |
859 } | 831 } |
860 | 832 |
861 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { | 833 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { |
862 INHERITED::clipWillBeSet(newClipData); | 834 INHERITED::clipWillBeSet(newClipData); |
863 fClipSet = true; | 835 fClipSet = true; |
864 fClipProxyState = kUnknown_ClipProxyState; | 836 fClipProxyState = kUnknown_ClipProxyState; |
865 } | 837 } |
OLD | NEW |