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(const GrPipelineBuilder&, | 680 bool setupDstReadIfNecessary(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&) = 0; | 723 const GrScissorState&, |
| 724 const GrDeviceCoordTexture* dstCopy) = 0; |
724 virtual void onDrawBatch(GrBatch*, | 725 virtual void onDrawBatch(GrBatch*, |
725 const GrPipelineBuilder&, | 726 const GrPipelineBuilder&, |
726 const GrScissorState&, | 727 const GrScissorState&, |
727 const SkRect* devBounds) = 0; | 728 const GrDeviceCoordTexture* dstCopy) = 0; |
728 // TODO copy in order drawbuffer onDrawRect to here | 729 // TODO copy in order drawbuffer onDrawRect to here |
729 virtual void onDrawRect(GrPipelineBuilder*, | 730 virtual void onDrawRect(GrPipelineBuilder*, |
730 GrColor color, | 731 GrColor color, |
731 const SkMatrix& viewMatrix, | 732 const SkMatrix& viewMatrix, |
732 const SkRect& rect, | 733 const SkRect& rect, |
733 const SkRect* localRect, | 734 const SkRect* localRect, |
734 const SkMatrix* localMatrix) = 0; | 735 const SkMatrix* localMatrix) = 0; |
735 | 736 |
736 virtual void onStencilPath(const GrPipelineBuilder&, | 737 virtual void onStencilPath(const GrPipelineBuilder&, |
737 const GrPathProcessor*, | 738 const GrPathProcessor*, |
738 const GrPath*, | 739 const GrPath*, |
739 const GrScissorState&, | 740 const GrScissorState&, |
740 const GrStencilSettings&) = 0; | 741 const GrStencilSettings&) = 0; |
741 virtual void onDrawPath(const GrPipelineBuilder&, | 742 virtual void onDrawPath(const GrPipelineBuilder&, |
742 const GrPathProcessor*, | 743 const GrPathProcessor*, |
743 const GrPath*, | 744 const GrPath*, |
744 const GrScissorState&, | 745 const GrScissorState&, |
745 const GrStencilSettings&, | 746 const GrStencilSettings&, |
746 const SkRect* devBounds) = 0; | 747 const GrDeviceCoordTexture* dstCopy) = 0; |
747 virtual void onDrawPaths(const GrPipelineBuilder&, | 748 virtual void onDrawPaths(const GrPipelineBuilder&, |
748 const GrPathProcessor*, | 749 const GrPathProcessor*, |
749 const GrPathRange*, | 750 const GrPathRange*, |
750 const void* indices, | 751 const void* indices, |
751 PathIndexType, | 752 PathIndexType, |
752 const float transformValues[], | 753 const float transformValues[], |
753 PathTransformType, | 754 PathTransformType, |
754 int count, | 755 int count, |
755 const GrScissorState&, | 756 const GrScissorState&, |
756 const GrStencilSettings&, | 757 const GrStencilSettings&, |
757 const SkRect* devBounds) = 0; | 758 const GrDeviceCoordTexture*) = 0; |
758 | 759 |
759 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect, | 760 virtual void onClear(const SkIRect* rect, GrColor color, bool canIgnoreRect, |
760 GrRenderTarget* renderTarget) = 0; | 761 GrRenderTarget* renderTarget) = 0; |
761 | 762 |
762 /** The subclass will get a chance to copy the surface for falling back to t
he default | 763 /** The subclass will get a chance to copy the surface for falling back to t
he default |
763 implementation, which simply draws a rectangle (and fails if dst isn't a
render target). It | 764 implementation, which simply draws a rectangle (and fails if dst isn't a
render target). It |
764 should assume that any clipping has already been performed on the rect a
nd point. It won't | 765 should assume that any clipping has already been performed on the rect a
nd point. It won't |
765 be called if the copy can be skipped. */ | 766 be called if the copy can be skipped. */ |
766 virtual bool onCopySurface(GrSurface* dst, | 767 virtual bool onCopySurface(GrSurface* dst, |
767 GrSurface* src, | 768 GrSurface* src, |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 virtual bool setupClip(GrPipelineBuilder*, | 872 virtual bool setupClip(GrPipelineBuilder*, |
872 GrPipelineBuilder::AutoRestoreEffects* are, | 873 GrPipelineBuilder::AutoRestoreEffects* are, |
873 GrPipelineBuilder::AutoRestoreStencil* ars, | 874 GrPipelineBuilder::AutoRestoreStencil* ars, |
874 GrScissorState* scissorState, | 875 GrScissorState* scissorState, |
875 const SkRect* devBounds) SK_OVERRIDE; | 876 const SkRect* devBounds) SK_OVERRIDE; |
876 | 877 |
877 typedef GrDrawTarget INHERITED; | 878 typedef GrDrawTarget INHERITED; |
878 }; | 879 }; |
879 | 880 |
880 #endif | 881 #endif |
OLD | NEW |