| 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. | 
|  | 659         const GrDeviceCoordTexture* getDstCopy() 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 21 matching lines...) Expand all  Loading... | 
| 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 | 
|  | 728     // Makes a copy of the dst if it is necessary for the draw. Returns false if
      a copy is required | 
|  | 729     // but couldn't be made. Otherwise, returns true. | 
|  | 730     bool setupDstReadIfNecessary(DrawInfo* info); | 
|  | 731 | 
| 717     enum { | 732     enum { | 
| 718         kPreallocGeoSrcStateStackCnt = 4, | 733         kPreallocGeoSrcStateStackCnt = 4, | 
| 719     }; | 734     }; | 
| 720     SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState
     Stack; | 735     SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState
     Stack; | 
| 721     const GrClipData*                                               fClip; | 736     const GrClipData*                                               fClip; | 
| 722     GrDrawState*                                                    fDrawState; | 737     GrDrawState*                                                    fDrawState; | 
| 723     GrDrawState                                                     fDefaultDraw
     State; | 738     GrDrawState                                                     fDefaultDraw
     State; | 
| 724     // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
     get. | 739     // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
     get. | 
| 725     GrContext*                                                      fContext; | 740     GrContext*                                                      fContext; | 
| 726 | 741 | 
| 727     typedef GrRefCnt INHERITED; | 742     typedef GrRefCnt INHERITED; | 
| 728 }; | 743 }; | 
| 729 | 744 | 
| 730 #endif | 745 #endif | 
| OLD | NEW | 
|---|