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 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
614 } | 614 } |
615 } | 615 } |
616 | 616 |
617 ~AutoGeometryAndStatePush() { fTarget->popGeometrySource(); } | 617 ~AutoGeometryAndStatePush() { fTarget->popGeometrySource(); } |
618 | 618 |
619 private: | 619 private: |
620 AutoStateRestore fState; | 620 AutoStateRestore fState; |
621 GrDrawTarget* fTarget; | 621 GrDrawTarget* fTarget; |
622 }; | 622 }; |
623 | 623 |
| 624 /////////////////////////////////////////////////////////////////////////// |
| 625 // Draw execution tracking (for font atlases and other resources) |
| 626 class DrawToken { |
| 627 public: |
| 628 DrawToken(GrDrawTarget* drawTarget, uint32_t drawID) : |
| 629 fDrawTarget(drawTarget), fDrawID(drawID) {} |
| 630 |
| 631 bool isIssued() { return NULL != fDrawTarget && fDrawTarget->isIssued(fD
rawID); } |
| 632 |
| 633 private: |
| 634 GrDrawTarget* fDrawTarget; |
| 635 uint32_t fDrawID; // this may wrap, but we're doing direct compa
rison |
| 636 // so that should be okay |
| 637 }; |
| 638 |
| 639 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, 0); } |
| 640 |
624 protected: | 641 protected: |
625 | 642 |
626 enum GeometrySrcType { | 643 enum GeometrySrcType { |
627 kNone_GeometrySrcType, //<! src has not been specified | 644 kNone_GeometrySrcType, //<! src has not been specified |
628 kReserved_GeometrySrcType, //<! src was set using reserve*Space | 645 kReserved_GeometrySrcType, //<! src was set using reserve*Space |
629 kArray_GeometrySrcType, //<! src was set using set*SourceToArray | 646 kArray_GeometrySrcType, //<! src was set using set*SourceToArray |
630 kBuffer_GeometrySrcType //<! src was set using set*SourceToBuffer | 647 kBuffer_GeometrySrcType //<! src was set using set*SourceToBuffer |
631 }; | 648 }; |
632 | 649 |
633 struct GeometrySrcState { | 650 struct GeometrySrcState { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
832 int startIndex, int vertexCount, | 849 int startIndex, int vertexCount, |
833 int indexCount) const; | 850 int indexCount) const; |
834 // called when setting a new vert/idx source to unref prev vb/ib | 851 // called when setting a new vert/idx source to unref prev vb/ib |
835 void releasePreviousVertexSource(); | 852 void releasePreviousVertexSource(); |
836 void releasePreviousIndexSource(); | 853 void releasePreviousIndexSource(); |
837 | 854 |
838 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 855 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
839 // but couldn't be made. Otherwise, returns true. | 856 // but couldn't be made. Otherwise, returns true. |
840 bool setupDstReadIfNecessary(DrawInfo* info); | 857 bool setupDstReadIfNecessary(DrawInfo* info); |
841 | 858 |
| 859 // Check to see if this set of draw commands has been sent out |
| 860 virtual bool isIssued(uint32_t drawID) { return true; } |
| 861 |
842 enum { | 862 enum { |
843 kPreallocGeoSrcStateStackCnt = 4, | 863 kPreallocGeoSrcStateStackCnt = 4, |
844 }; | 864 }; |
845 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState
Stack; | 865 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState
Stack; |
846 const GrClipData* fClip; | 866 const GrClipData* fClip; |
847 GrDrawState* fDrawState; | 867 GrDrawState* fDrawState; |
848 GrDrawState fDefaultDraw
State; | 868 GrDrawState fDefaultDraw
State; |
849 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. | 869 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. |
850 GrContext* fContext; | 870 GrContext* fContext; |
851 | 871 |
852 typedef GrRefCnt INHERITED; | 872 typedef GrRefCnt INHERITED; |
853 }; | 873 }; |
854 | 874 |
855 #endif | 875 #endif |
OLD | NEW |