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 #ifndef GrDrawTarget_DEFINED | 10 #ifndef GrDrawTarget_DEFINED |
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
648 void adjustStartVertex(int vertexOffset); | 648 void adjustStartVertex(int vertexOffset); |
649 // shifts the start index | 649 // shifts the start index |
650 void adjustStartIndex(int indexOffset); | 650 void adjustStartIndex(int indexOffset); |
651 | 651 |
652 void setDevBounds(const SkRect& bounds) { | 652 void setDevBounds(const SkRect& bounds) { |
653 fDevBoundsStorage = bounds; | 653 fDevBoundsStorage = bounds; |
654 fDevBounds = &fDevBoundsStorage; | 654 fDevBounds = &fDevBoundsStorage; |
655 } | 655 } |
656 const SkRect* getDevBounds() const { return fDevBounds; } | 656 const SkRect* getDevBounds() const { return fDevBounds; } |
657 | 657 |
658 // NULL if no copy of the dst is needed for the draw. | |
robertphillips
2013/03/29 18:32:57
requiresDstCopy? dstCopyNeeded?
bsalomon
2013/03/29 18:59:38
but it actually returns the copy, not a bool. Chan
| |
659 const GrDeviceCoordTexture* dstCopy() const { | |
660 if (NULL != fDstCopy.texture()) { | |
661 return &fDstCopy; | |
662 } else { | |
663 return NULL; | |
664 } | |
665 } | |
666 | |
658 private: | 667 private: |
659 DrawInfo() { fDevBounds = NULL; } | 668 DrawInfo() { fDevBounds = NULL; } |
660 | 669 |
661 friend class GrDrawTarget; | 670 friend class GrDrawTarget; |
662 | 671 |
663 GrPrimitiveType fPrimitiveType; | 672 GrPrimitiveType fPrimitiveType; |
664 | 673 |
665 int fStartVertex; | 674 int fStartVertex; |
666 int fStartIndex; | 675 int fStartIndex; |
667 int fVertexCount; | 676 int fVertexCount; |
668 int fIndexCount; | 677 int fIndexCount; |
669 | 678 |
670 int fInstanceCount; | 679 int fInstanceCount; |
671 int fVerticesPerInstance; | 680 int fVerticesPerInstance; |
672 int fIndicesPerInstance; | 681 int fIndicesPerInstance; |
673 | 682 |
674 SkRect fDevBoundsStorage; | 683 SkRect fDevBoundsStorage; |
675 SkRect* fDevBounds; | 684 SkRect* fDevBounds; |
685 | |
686 GrDeviceCoordTexture fDstCopy; | |
676 }; | 687 }; |
677 | 688 |
678 private: | 689 private: |
679 // A subclass can optionally overload this function to be notified before | 690 // A subclass can optionally overload this function to be notified before |
680 // vertex and index space is reserved. | 691 // vertex and index space is reserved. |
681 virtual void willReserveVertexAndIndexSpace(int vertexCount, int indexCount) {} | 692 virtual void willReserveVertexAndIndexSpace(int vertexCount, int indexCount) {} |
682 | 693 |
683 // implemented by subclass to allocate space for reserved geom | 694 // implemented by subclass to allocate space for reserved geom |
684 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertices) = 0; | 695 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertices) = 0; |
685 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; | 696 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; |
(...skipping 20 matching lines...) Expand all Loading... | |
706 bool reserveIndexSpace(int indexCount, void** indices); | 717 bool reserveIndexSpace(int indexCount, void** indices); |
707 | 718 |
708 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to | 719 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to |
709 // indicate non-indexed drawing. | 720 // indicate non-indexed drawing. |
710 bool checkDraw(GrPrimitiveType type, int startVertex, | 721 bool checkDraw(GrPrimitiveType type, int startVertex, |
711 int startIndex, int vertexCount, | 722 int startIndex, int vertexCount, |
712 int indexCount) const; | 723 int indexCount) const; |
713 // called when setting a new vert/idx source to unref prev vb/ib | 724 // called when setting a new vert/idx source to unref prev vb/ib |
714 void releasePreviousVertexSource(); | 725 void releasePreviousVertexSource(); |
715 void releasePreviousIndexSource(); | 726 void releasePreviousIndexSource(); |
716 | 727 |
robertphillips
2013/03/29 18:32:57
// Return true on success; false on failure
bsalomon
2013/03/29 18:59:38
Done.
| |
728 bool setupDstReadIfNecessary(DrawInfo* info); | |
729 | |
717 enum { | 730 enum { |
718 kPreallocGeoSrcStateStackCnt = 4, | 731 kPreallocGeoSrcStateStackCnt = 4, |
719 }; | 732 }; |
720 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack; | 733 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState Stack; |
721 const GrClipData* fClip; | 734 const GrClipData* fClip; |
722 GrDrawState* fDrawState; | 735 GrDrawState* fDrawState; |
723 GrDrawState fDefaultDraw State; | 736 GrDrawState fDefaultDraw State; |
724 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. | 737 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar get. |
725 GrContext* fContext; | 738 GrContext* fContext; |
726 | 739 |
727 typedef GrRefCnt INHERITED; | 740 typedef GrRefCnt INHERITED; |
728 }; | 741 }; |
729 | 742 |
730 #endif | 743 #endif |
OLD | NEW |