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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 fDstGpu->ref(); | 33 fDstGpu->ref(); |
34 fCaps.reset(SkRef(fDstGpu->caps())); | 34 fCaps.reset(SkRef(fDstGpu->caps())); |
35 | 35 |
36 SkASSERT(NULL != vertexPool); | 36 SkASSERT(NULL != vertexPool); |
37 SkASSERT(NULL != indexPool); | 37 SkASSERT(NULL != indexPool); |
38 | 38 |
39 GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); | 39 GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); |
40 poolState.fUsedPoolVertexBytes = 0; | 40 poolState.fUsedPoolVertexBytes = 0; |
41 poolState.fUsedPoolIndexBytes = 0; | 41 poolState.fUsedPoolIndexBytes = 0; |
42 #if GR_DEBUG | 42 #if SK_DEBUG |
43 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; | 43 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; |
44 poolState.fPoolStartVertex = ~0; | 44 poolState.fPoolStartVertex = ~0; |
45 poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0; | 45 poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0; |
46 poolState.fPoolStartIndex = ~0; | 46 poolState.fPoolStartIndex = ~0; |
47 #endif | 47 #endif |
48 this->reset(); | 48 this->reset(); |
49 } | 49 } |
50 | 50 |
51 GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { | 51 GrInOrderDrawBuffer::~GrInOrderDrawBuffer() { |
52 this->reset(); | 52 this->reset(); |
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 poolState.fUsedPoolIndexBytes = 0; | 697 poolState.fUsedPoolIndexBytes = 0; |
698 poolState.fPoolIndexBuffer = NULL; | 698 poolState.fPoolIndexBuffer = NULL; |
699 poolState.fPoolStartIndex = 0; | 699 poolState.fPoolStartIndex = 0; |
700 } | 700 } |
701 | 701 |
702 void GrInOrderDrawBuffer::onSetVertexSourceToArray(const void* vertexArray, | 702 void GrInOrderDrawBuffer::onSetVertexSourceToArray(const void* vertexArray, |
703 int vertexCount) { | 703 int vertexCount) { |
704 | 704 |
705 GeometryPoolState& poolState = fGeoPoolStateStack.back(); | 705 GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
706 SkASSERT(0 == poolState.fUsedPoolVertexBytes); | 706 SkASSERT(0 == poolState.fUsedPoolVertexBytes); |
707 #if GR_DEBUG | 707 #if SK_DEBUG |
708 bool success = | 708 bool success = |
709 #endif | 709 #endif |
710 fVertexPool.appendVertices(this->getVertexSize(), | 710 fVertexPool.appendVertices(this->getVertexSize(), |
711 vertexCount, | 711 vertexCount, |
712 vertexArray, | 712 vertexArray, |
713 &poolState.fPoolVertexBuffer, | 713 &poolState.fPoolVertexBuffer, |
714 &poolState.fPoolStartVertex); | 714 &poolState.fPoolStartVertex); |
715 GR_DEBUGASSERT(success); | 715 GR_DEBUGASSERT(success); |
716 } | 716 } |
717 | 717 |
718 void GrInOrderDrawBuffer::onSetIndexSourceToArray(const void* indexArray, | 718 void GrInOrderDrawBuffer::onSetIndexSourceToArray(const void* indexArray, |
719 int indexCount) { | 719 int indexCount) { |
720 GeometryPoolState& poolState = fGeoPoolStateStack.back(); | 720 GeometryPoolState& poolState = fGeoPoolStateStack.back(); |
721 SkASSERT(0 == poolState.fUsedPoolIndexBytes); | 721 SkASSERT(0 == poolState.fUsedPoolIndexBytes); |
722 #if GR_DEBUG | 722 #if SK_DEBUG |
723 bool success = | 723 bool success = |
724 #endif | 724 #endif |
725 fIndexPool.appendIndices(indexCount, | 725 fIndexPool.appendIndices(indexCount, |
726 indexArray, | 726 indexArray, |
727 &poolState.fPoolIndexBuffer, | 727 &poolState.fPoolIndexBuffer, |
728 &poolState.fPoolStartIndex); | 728 &poolState.fPoolStartIndex); |
729 GR_DEBUGASSERT(success); | 729 GR_DEBUGASSERT(success); |
730 } | 730 } |
731 | 731 |
732 void GrInOrderDrawBuffer::releaseVertexArray() { | 732 void GrInOrderDrawBuffer::releaseVertexArray() { |
733 // When the client provides an array as the vertex source we handled it | 733 // When the client provides an array as the vertex source we handled it |
734 // by copying their array into reserved space. | 734 // by copying their array into reserved space. |
735 this->GrInOrderDrawBuffer::releaseReservedVertexSpace(); | 735 this->GrInOrderDrawBuffer::releaseReservedVertexSpace(); |
736 } | 736 } |
737 | 737 |
738 void GrInOrderDrawBuffer::releaseIndexArray() { | 738 void GrInOrderDrawBuffer::releaseIndexArray() { |
739 // When the client provides an array as the index source we handled it | 739 // When the client provides an array as the index source we handled it |
740 // by copying their array into reserved space. | 740 // by copying their array into reserved space. |
741 this->GrInOrderDrawBuffer::releaseReservedIndexSpace(); | 741 this->GrInOrderDrawBuffer::releaseReservedIndexSpace(); |
742 } | 742 } |
743 | 743 |
744 void GrInOrderDrawBuffer::geometrySourceWillPush() { | 744 void GrInOrderDrawBuffer::geometrySourceWillPush() { |
745 GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); | 745 GeometryPoolState& poolState = fGeoPoolStateStack.push_back(); |
746 poolState.fUsedPoolVertexBytes = 0; | 746 poolState.fUsedPoolVertexBytes = 0; |
747 poolState.fUsedPoolIndexBytes = 0; | 747 poolState.fUsedPoolIndexBytes = 0; |
748 #if GR_DEBUG | 748 #if SK_DEBUG |
749 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; | 749 poolState.fPoolVertexBuffer = (GrVertexBuffer*)~0; |
750 poolState.fPoolStartVertex = ~0; | 750 poolState.fPoolStartVertex = ~0; |
751 poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0; | 751 poolState.fPoolIndexBuffer = (GrIndexBuffer*)~0; |
752 poolState.fPoolStartIndex = ~0; | 752 poolState.fPoolStartIndex = ~0; |
753 #endif | 753 #endif |
754 } | 754 } |
755 | 755 |
756 void GrInOrderDrawBuffer::geometrySourceWillPop( | 756 void GrInOrderDrawBuffer::geometrySourceWillPop( |
757 const GeometrySrcState& restoredState) { | 757 const GeometrySrcState& restoredState) { |
758 SkASSERT(fGeoPoolStateStack.count() > 1); | 758 SkASSERT(fGeoPoolStateStack.count() > 1); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 fCmds.push_back(kCopySurface_Cmd); | 820 fCmds.push_back(kCopySurface_Cmd); |
821 return &fCopySurfaces.push_back(); | 821 return &fCopySurfaces.push_back(); |
822 } | 822 } |
823 | 823 |
824 | 824 |
825 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { | 825 void GrInOrderDrawBuffer::clipWillBeSet(const GrClipData* newClipData) { |
826 INHERITED::clipWillBeSet(newClipData); | 826 INHERITED::clipWillBeSet(newClipData); |
827 fClipSet = true; | 827 fClipSet = true; |
828 fClipProxyState = kUnknown_ClipProxyState; | 828 fClipProxyState = kUnknown_ClipProxyState; |
829 } | 829 } |
OLD | NEW |