| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 #ifndef GrDrawTarget_DEFINED | 8 #ifndef GrDrawTarget_DEFINED |
| 9 #define GrDrawTarget_DEFINED | 9 #define GrDrawTarget_DEFINED |
| 10 | 10 |
| (...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 801 return static_cast<int>(src.fIndexBuffer->gpuMemorySize() / size
of(uint16_t)); | 801 return static_cast<int>(src.fIndexBuffer->gpuMemorySize() / size
of(uint16_t)); |
| 802 default: | 802 default: |
| 803 SkFAIL("Unexpected Index Source."); | 803 SkFAIL("Unexpected Index Source."); |
| 804 return 0; | 804 return 0; |
| 805 } | 805 } |
| 806 } | 806 } |
| 807 | 807 |
| 808 GrContext* getContext() { return fContext; } | 808 GrContext* getContext() { return fContext; } |
| 809 const GrContext* getContext() const { return fContext; } | 809 const GrContext* getContext() const { return fContext; } |
| 810 | 810 |
| 811 // A subclass may override this function if it wishes to be notified when th
e clip is changed. | |
| 812 // The override should call INHERITED::clipWillBeSet(). | |
| 813 virtual void clipWillBeSet(const GrClipData* clipData); | |
| 814 | |
| 815 // subclasses must call this in their destructors to ensure all vertex | 811 // subclasses must call this in their destructors to ensure all vertex |
| 816 // and index sources have been released (including those held by | 812 // and index sources have been released (including those held by |
| 817 // pushGeometrySource()) | 813 // pushGeometrySource()) |
| 818 void releaseGeometry(); | 814 void releaseGeometry(); |
| 819 | 815 |
| 820 // accessors for derived classes | 816 // accessors for derived classes |
| 821 const GeometrySrcState& getGeomSrc() const { return fGeoSrcStateStack.back()
; } | 817 const GeometrySrcState& getGeomSrc() const { return fGeoSrcStateStack.back()
; } |
| 822 // it is preferable to call this rather than getGeomSrc()->fVertexSize becau
se of the assert. | 818 // it is preferable to call this rather than getGeomSrc()->fVertexSize becau
se of the assert. |
| 823 size_t getVertexSize() const { | 819 size_t getVertexSize() const { |
| 824 // the vertex layout is only valid if a vertex source has been specified
. | 820 // the vertex layout is only valid if a vertex source has been specified
. |
| (...skipping 23 matching lines...) Expand all Loading... |
| 848 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) = 0; | 844 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) = 0; |
| 849 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; | 845 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; |
| 850 // implemented by subclass to handle release of reserved geom space | 846 // implemented by subclass to handle release of reserved geom space |
| 851 virtual void releaseReservedVertexSpace() = 0; | 847 virtual void releaseReservedVertexSpace() = 0; |
| 852 virtual void releaseReservedIndexSpace() = 0; | 848 virtual void releaseReservedIndexSpace() = 0; |
| 853 // subclass overrides to be notified just before geo src state is pushed/pop
ped. | 849 // subclass overrides to be notified just before geo src state is pushed/pop
ped. |
| 854 virtual void geometrySourceWillPush() = 0; | 850 virtual void geometrySourceWillPush() = 0; |
| 855 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; | 851 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; |
| 856 // subclass called to perform drawing | 852 // subclass called to perform drawing |
| 857 virtual void onDraw(const DrawInfo&, const GrClipMaskManager::ScissorState&)
= 0; | 853 virtual void onDraw(const DrawInfo&, const GrClipMaskManager::ScissorState&)
= 0; |
| 858 // Implementation of drawRect. The geometry src and vertex attribs will alre
ady | 854 // TODO copy in order drawbuffer onDrawRect to here |
| 859 // be saved before this is called and restored afterwards. A subclass may ov
erride | |
| 860 // this to perform more optimal rect rendering. Its draws should be funneled
through | |
| 861 // one of the public GrDrawTarget draw methods (e.g. drawNonIndexed, | |
| 862 // drawIndexedInstances, ...). The base class draws a two triangle fan using | |
| 863 // drawNonIndexed from reserved vertex space. | |
| 864 virtual void onDrawRect(const SkRect& rect, | 855 virtual void onDrawRect(const SkRect& rect, |
| 865 const SkRect* localRect, | 856 const SkRect* localRect, |
| 866 const SkMatrix* localMatrix); | 857 const SkMatrix* localMatrix) = 0; |
| 867 | 858 |
| 868 virtual void onStencilPath(const GrPath*, | 859 virtual void onStencilPath(const GrPath*, |
| 869 const GrClipMaskManager::ScissorState&, | 860 const GrClipMaskManager::ScissorState&, |
| 870 const GrStencilSettings&) = 0; | 861 const GrStencilSettings&) = 0; |
| 871 virtual void onDrawPath(const GrPath*, | 862 virtual void onDrawPath(const GrPath*, |
| 872 const GrClipMaskManager::ScissorState&, | 863 const GrClipMaskManager::ScissorState&, |
| 873 const GrStencilSettings&, | 864 const GrStencilSettings&, |
| 874 const GrDeviceCoordTexture* dstCopy) = 0; | 865 const GrDeviceCoordTexture* dstCopy) = 0; |
| 875 virtual void onDrawPaths(const GrPathRange*, | 866 virtual void onDrawPaths(const GrPathRange*, |
| 876 const uint32_t indices[], | 867 const uint32_t indices[], |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 967 | 958 |
| 968 virtual bool setupClip(const SkRect* devBounds, | 959 virtual bool setupClip(const SkRect* devBounds, |
| 969 GrDrawState::AutoRestoreEffects* are, | 960 GrDrawState::AutoRestoreEffects* are, |
| 970 GrDrawState::AutoRestoreStencil* ars, | 961 GrDrawState::AutoRestoreStencil* ars, |
| 971 GrClipMaskManager::ScissorState* scissorState) SK_OVE
RRIDE; | 962 GrClipMaskManager::ScissorState* scissorState) SK_OVE
RRIDE; |
| 972 | 963 |
| 973 typedef GrDrawTarget INHERITED; | 964 typedef GrDrawTarget INHERITED; |
| 974 }; | 965 }; |
| 975 | 966 |
| 976 #endif | 967 #endif |
| OLD | NEW |