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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 } | 670 } |
671 | 671 |
672 // Subclass must initialize this in its constructor. | 672 // Subclass must initialize this in its constructor. |
673 SkAutoTUnref<const GrDrawTargetCaps> fCaps; | 673 SkAutoTUnref<const GrDrawTargetCaps> fCaps; |
674 | 674 |
675 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } | 675 const GrTraceMarkerSet& getActiveTraceMarkers() { return fActiveTraceMarkers
; } |
676 | 676 |
677 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 677 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
678 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 678 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
679 // needs to be accessed by GLPrograms to setup a correct drawstate | 679 // needs to be accessed by GLPrograms to setup a correct drawstate |
680 bool setupDstReadIfNecessary(GrPipelineBuilder*, | 680 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
681 GrDeviceCoordTexture* dstCopy, | 681 GrDeviceCoordTexture* dstCopy, |
682 const SkRect* drawBounds); | 682 const SkRect* drawBounds); |
683 | 683 |
684 private: | 684 private: |
685 /** | 685 /** |
686 * This will be called before allocating a texture as a dst for copySurface.
This function | 686 * This will be called before allocating a texture as a dst for copySurface.
This function |
687 * populates the dstDesc's config, flags, and origin so as to maximize effic
iency and guarantee | 687 * populates the dstDesc's config, flags, and origin so as to maximize effic
iency and guarantee |
688 * success of the copySurface call. | 688 * success of the copySurface call. |
689 */ | 689 */ |
690 void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* dstDesc) { | 690 void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* dstDesc) { |
(...skipping 22 matching lines...) Expand all Loading... |
713 // implemented by subclass to handle release of reserved geom space | 713 // implemented by subclass to handle release of reserved geom space |
714 virtual void releaseReservedVertexSpace() = 0; | 714 virtual void releaseReservedVertexSpace() = 0; |
715 virtual void releaseReservedIndexSpace() = 0; | 715 virtual void releaseReservedIndexSpace() = 0; |
716 // subclass overrides to be notified just before geo src state is pushed/pop
ped. | 716 // subclass overrides to be notified just before geo src state is pushed/pop
ped. |
717 virtual void geometrySourceWillPush() = 0; | 717 virtual void geometrySourceWillPush() = 0; |
718 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; | 718 virtual void geometrySourceWillPop(const GeometrySrcState& restoredState) =
0; |
719 // subclass called to perform drawing | 719 // subclass called to perform drawing |
720 virtual void onDraw(const GrPipelineBuilder&, | 720 virtual void onDraw(const GrPipelineBuilder&, |
721 const GrGeometryProcessor*, | 721 const GrGeometryProcessor*, |
722 const DrawInfo&, | 722 const DrawInfo&, |
723 const GrScissorState&, | 723 const GrScissorState&) = 0; |
724 const GrDeviceCoordTexture* dstCopy) = 0; | |
725 virtual void onDrawBatch(GrBatch*, | 724 virtual void onDrawBatch(GrBatch*, |
726 const GrPipelineBuilder&, | 725 const GrPipelineBuilder&, |
727 const GrScissorState&, | 726 const GrScissorState&, |
728 const GrDeviceCoordTexture* dstCopy) = 0; | 727 const SkRect* devBounds) = 0; |
729 // TODO copy in order drawbuffer onDrawRect to here | 728 // TODO copy in order drawbuffer onDrawRect to here |
730 virtual void onDrawRect(GrPipelineBuilder*, | 729 virtual void onDrawRect(GrPipelineBuilder*, |
731 GrColor color, | 730 GrColor color, |
732 const SkMatrix& viewMatrix, | 731 const SkMatrix& viewMatrix, |
733 const SkRect& rect, | 732 const SkRect& rect, |
734 const SkRect* localRect, | 733 const SkRect* localRect, |
735 const SkMatrix* localMatrix) = 0; | 734 const SkMatrix* localMatrix) = 0; |
736 | 735 |
737 virtual void onStencilPath(const GrPipelineBuilder&, | 736 virtual void onStencilPath(const GrPipelineBuilder&, |
738 const GrPathProcessor*, | 737 const GrPathProcessor*, |
739 const GrPath*, | 738 const GrPath*, |
740 const GrScissorState&, | 739 const GrScissorState&, |
741 const GrStencilSettings&) = 0; | 740 const GrStencilSettings&) = 0; |
742 virtual void onDrawPath(const GrPipelineBuilder&, | 741 virtual void onDrawPath(const GrPipelineBuilder&, |
743 const GrPathProcessor*, | 742 const GrPathProcessor*, |
744 const GrPath*, | 743 const GrPath*, |
745 const GrScissorState&, | 744 const GrScissorState&, |
746 const GrStencilSettings&, | 745 const GrStencilSettings&, |
747 const GrDeviceCoordTexture* dstCopy) = 0; | 746 const SkRect* devBounds) = 0; |
748 virtual void onDrawPaths(const GrPipelineBuilder&, | 747 virtual void onDrawPaths(const GrPipelineBuilder&, |
749 const GrPathProcessor*, | 748 const GrPathProcessor*, |
750 const GrPathRange*, | 749 const GrPathRange*, |
751 const void* indices, | 750 const void* indices, |
752 PathIndexType, | 751 PathIndexType, |
753 const float transformValues[], | 752 const float transformValues[], |
754 PathTransformType, | 753 PathTransformType, |
755 int count, | 754 int count, |
756 const GrScissorState&, | 755 const GrScissorState&, |
757 const GrStencilSettings&, | 756 const GrStencilSettings&, |
758 const GrDeviceCoordTexture*) = 0; | 757 const SkRect* devBounds) = 0; |
759 | 758 |
760 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect, | 759 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect, |
761 GrRenderTarget* renderTarget) = 0; | 760 GrRenderTarget* renderTarget) = 0; |
762 | 761 |
763 /** The subclass will get a chance to copy the surface for falling back to t
he default | 762 /** The subclass will get a chance to copy the surface for falling back to t
he default |
764 implementation, which simply draws a rectangle (and fails if dst isn't a
render target). It | 763 implementation, which simply draws a rectangle (and fails if dst isn't a
render target). It |
765 should assume that any clipping has already been performed on the rect a
nd point. It won't | 764 should assume that any clipping has already been performed on the rect a
nd point. It won't |
766 be called if the copy can be skipped. */ | 765 be called if the copy can be skipped. */ |
767 virtual bool onCopySurface(GrSurface* dst, | 766 virtual bool onCopySurface(GrSurface* dst, |
768 GrSurface* src, | 767 GrSurface* src, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
872 virtual bool setupClip(GrPipelineBuilder*, | 871 virtual bool setupClip(GrPipelineBuilder*, |
873 GrPipelineBuilder::AutoRestoreEffects* are, | 872 GrPipelineBuilder::AutoRestoreEffects* are, |
874 GrPipelineBuilder::AutoRestoreStencil* ars, | 873 GrPipelineBuilder::AutoRestoreStencil* ars, |
875 GrScissorState* scissorState, | 874 GrScissorState* scissorState, |
876 const SkRect* devBounds) SK_OVERRIDE; | 875 const SkRect* devBounds) SK_OVERRIDE; |
877 | 876 |
878 typedef GrDrawTarget INHERITED; | 877 typedef GrDrawTarget INHERITED; |
879 }; | 878 }; |
880 | 879 |
881 #endif | 880 #endif |
OLD | NEW |