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 693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 | 704 |
705 GrPipelineBuilder* fPipelineBuilder; | 705 GrPipelineBuilder* fPipelineBuilder; |
706 GrScissorState* fScissor; | 706 GrScissorState* fScissor; |
707 GrProcOptInfo fColorPOI; | 707 GrProcOptInfo fColorPOI; |
708 GrProcOptInfo fCoveragePOI; | 708 GrProcOptInfo fCoveragePOI; |
709 GrDeviceCoordTexture fDstCopy; | 709 GrDeviceCoordTexture fDstCopy; |
710 }; | 710 }; |
711 | 711 |
712 void setupPipeline(const PipelineInfo& pipelineInfo, GrPipeline* pipeline); | 712 void setupPipeline(const PipelineInfo& pipelineInfo, GrPipeline* pipeline); |
713 | 713 |
| 714 // A subclass can optionally overload this function to be notified before |
| 715 // vertex and index space is reserved. |
| 716 virtual void willReserveVertexAndIndexSpace(int vertexCount, |
| 717 size_t vertexStride, |
| 718 int indexCount) {} |
| 719 |
714 private: | 720 private: |
715 /** | 721 /** |
716 * This will be called before allocating a texture as a dst for copySurface.
This function | 722 * This will be called before allocating a texture as a dst for copySurface.
This function |
717 * populates the dstDesc's config, flags, and origin so as to maximize effic
iency and guarantee | 723 * populates the dstDesc's config, flags, and origin so as to maximize effic
iency and guarantee |
718 * success of the copySurface call. | 724 * success of the copySurface call. |
719 */ | 725 */ |
720 void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* dstDesc) { | 726 void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* dstDesc) { |
721 if (!this->onInitCopySurfaceDstDesc(src, dstDesc)) { | 727 if (!this->onInitCopySurfaceDstDesc(src, dstDesc)) { |
722 dstDesc->fOrigin = kDefault_GrSurfaceOrigin; | 728 dstDesc->fOrigin = kDefault_GrSurfaceOrigin; |
723 dstDesc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurface
Flag; | 729 dstDesc->fFlags = kRenderTarget_GrSurfaceFlag | kNoStencil_GrSurface
Flag; |
724 dstDesc->fConfig = src->config(); | 730 dstDesc->fConfig = src->config(); |
725 } | 731 } |
726 } | 732 } |
727 | 733 |
728 /** Internal implementation of canCopySurface. */ | 734 /** Internal implementation of canCopySurface. */ |
729 bool internalCanCopySurface(const GrSurface* dst, | 735 bool internalCanCopySurface(const GrSurface* dst, |
730 const GrSurface* src, | 736 const GrSurface* src, |
731 const SkIRect& clippedSrcRect, | 737 const SkIRect& clippedSrcRect, |
732 const SkIPoint& clippedDstRect); | 738 const SkIPoint& clippedDstRect); |
733 | 739 |
734 // A subclass can optionally overload this function to be notified before | |
735 // vertex and index space is reserved. | |
736 virtual void willReserveVertexAndIndexSpace(int vertexCount, | |
737 size_t vertexStride, | |
738 int indexCount) {} | |
739 | |
740 // implemented by subclass to allocate space for reserved geom | 740 // implemented by subclass to allocate space for reserved geom |
741 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) = 0; | 741 virtual bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void**
vertices) = 0; |
742 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; | 742 virtual bool onReserveIndexSpace(int indexCount, void** indices) = 0; |
743 // implemented by subclass to handle release of reserved geom space | 743 // implemented by subclass to handle release of reserved geom space |
744 virtual void releaseReservedVertexSpace() = 0; | 744 virtual void releaseReservedVertexSpace() = 0; |
745 virtual void releaseReservedIndexSpace() = 0; | 745 virtual void releaseReservedIndexSpace() = 0; |
746 // subclass overrides to be notified just before geo src state is pushed/pop
ped. | 746 // subclass overrides to be notified just before geo src state is pushed/pop
ped. |
747 virtual void geometrySourceWillPush() = 0; | 747 virtual void geometrySourceWillPush() = 0; |
748 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; | 748 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; |
749 // subclass called to perform drawing | 749 // subclass called to perform drawing |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
891 virtual bool setupClip(GrPipelineBuilder*, | 891 virtual bool setupClip(GrPipelineBuilder*, |
892 GrPipelineBuilder::AutoRestoreEffects* are, | 892 GrPipelineBuilder::AutoRestoreEffects* are, |
893 GrPipelineBuilder::AutoRestoreStencil* ars, | 893 GrPipelineBuilder::AutoRestoreStencil* ars, |
894 GrScissorState* scissorState, | 894 GrScissorState* scissorState, |
895 const SkRect* devBounds) SK_OVERRIDE; | 895 const SkRect* devBounds) SK_OVERRIDE; |
896 | 896 |
897 typedef GrDrawTarget INHERITED; | 897 typedef GrDrawTarget INHERITED; |
898 }; | 898 }; |
899 | 899 |
900 #endif | 900 #endif |
OLD | NEW |