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 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 * clip and all other draw state (blend mode, stages, etc). Clears the | 416 * clip and all other draw state (blend mode, stages, etc). Clears the |
417 * whole thing if rect is NULL, otherwise just the rect. If canIgnoreRect | 417 * whole thing if rect is NULL, otherwise just the rect. If canIgnoreRect |
418 * is set then the entire render target can be optionally cleared. | 418 * is set then the entire render target can be optionally cleared. |
419 */ | 419 */ |
420 virtual void clear(const SkIRect* rect, | 420 virtual void clear(const SkIRect* rect, |
421 GrColor color, | 421 GrColor color, |
422 bool canIgnoreRect, | 422 bool canIgnoreRect, |
423 GrRenderTarget* renderTarget = NULL) = 0; | 423 GrRenderTarget* renderTarget = NULL) = 0; |
424 | 424 |
425 /** | 425 /** |
| 426 * instantGpuTraceEvent places a single "sign post" type marker into command
stream. The |
| 427 * argument marker will be the name of the annotation that is added. |
| 428 */ |
| 429 void instantGpuTraceEvent(const char* marker); |
| 430 /** |
| 431 * The following two functions are used for marking groups of commands. Use
pushGpuTraceEvent |
| 432 * to set the beginning of a command set, and popGpuTraceEvent is be called
at end of the |
| 433 * command set. The argument marker is the name for the annotation that is a
dded. The push and |
| 434 * pops can be used hierarchically, but every push must have a match pop. |
| 435 */ |
| 436 void pushGpuTraceEvent(const char* marker); |
| 437 void popGpuTraceEvent(); |
| 438 |
| 439 /** |
426 * Copies a pixel rectangle from one surface to another. This call may final
ize | 440 * Copies a pixel rectangle from one surface to another. This call may final
ize |
427 * reserved vertex/index data (as though a draw call was made). The src pixe
ls | 441 * reserved vertex/index data (as though a draw call was made). The src pixe
ls |
428 * copied are specified by srcRect. They are copied to a rect of the same | 442 * copied are specified by srcRect. They are copied to a rect of the same |
429 * size in dst with top left at dstPoint. If the src rect is clipped by the | 443 * size in dst with top left at dstPoint. If the src rect is clipped by the |
430 * src bounds then pixel values in the dst rect corresponding to area clipp
ed | 444 * src bounds then pixel values in the dst rect corresponding to area clipp
ed |
431 * by the src rect are not overwritten. This method can fail and return fals
e | 445 * by the src rect are not overwritten. This method can fail and return fals
e |
432 * depending on the type of surface, configs, etc, and the backend-specific | 446 * depending on the type of surface, configs, etc, and the backend-specific |
433 * limitations. If rect is clipped out entirely by the src or dst bounds the
n | 447 * limitations. If rect is clipped out entirely by the src or dst bounds the
n |
434 * true is returned since there is no actual copy necessary to succeed. | 448 * true is returned since there is no actual copy necessary to succeed. |
435 */ | 449 */ |
(...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 // drawNonIndexed from reserved vertex space. | 861 // drawNonIndexed from reserved vertex space. |
848 virtual void onDrawRect(const SkRect& rect, | 862 virtual void onDrawRect(const SkRect& rect, |
849 const SkMatrix* matrix, | 863 const SkMatrix* matrix, |
850 const SkRect* localRect, | 864 const SkRect* localRect, |
851 const SkMatrix* localMatrix); | 865 const SkMatrix* localMatrix); |
852 | 866 |
853 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; | 867 virtual void onStencilPath(const GrPath*, SkPath::FillType) = 0; |
854 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 868 virtual void onDrawPath(const GrPath*, SkPath::FillType, |
855 const GrDeviceCoordTexture* dstCopy) = 0; | 869 const GrDeviceCoordTexture* dstCopy) = 0; |
856 | 870 |
| 871 virtual void onInstantGpuTraceEvent(const char* marker) = 0; |
| 872 virtual void onPushGpuTraceEvent(const char* marker) = 0; |
| 873 virtual void onPopGpuTraceEvent() = 0; |
| 874 |
857 // helpers for reserving vertex and index space. | 875 // helpers for reserving vertex and index space. |
858 bool reserveVertexSpace(size_t vertexSize, | 876 bool reserveVertexSpace(size_t vertexSize, |
859 int vertexCount, | 877 int vertexCount, |
860 void** vertices); | 878 void** vertices); |
861 bool reserveIndexSpace(int indexCount, void** indices); | 879 bool reserveIndexSpace(int indexCount, void** indices); |
862 | 880 |
863 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to | 881 // called by drawIndexed and drawNonIndexed. Use a negative indexCount to |
864 // indicate non-indexed drawing. | 882 // indicate non-indexed drawing. |
865 bool checkDraw(GrPrimitiveType type, int startVertex, | 883 bool checkDraw(GrPrimitiveType type, int startVertex, |
866 int startIndex, int vertexCount, | 884 int startIndex, int vertexCount, |
(...skipping 14 matching lines...) Expand all Loading... |
881 | 899 |
882 enum { | 900 enum { |
883 kPreallocGeoSrcStateStackCnt = 4, | 901 kPreallocGeoSrcStateStackCnt = 4, |
884 }; | 902 }; |
885 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState
Stack; | 903 SkSTArray<kPreallocGeoSrcStateStackCnt, GeometrySrcState, true> fGeoSrcState
Stack; |
886 const GrClipData* fClip; | 904 const GrClipData* fClip; |
887 GrDrawState* fDrawState; | 905 GrDrawState* fDrawState; |
888 GrDrawState fDefaultDraw
State; | 906 GrDrawState fDefaultDraw
State; |
889 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. | 907 // The context owns us, not vice-versa, so this ptr is not ref'ed by DrawTar
get. |
890 GrContext* fContext; | 908 GrContext* fContext; |
| 909 // To keep track that we always have at least as many debug marker pushes as
pops |
| 910 int fPushGpuTrac
eCount; |
891 | 911 |
892 typedef SkRefCnt INHERITED; | 912 typedef SkRefCnt INHERITED; |
893 }; | 913 }; |
894 | 914 |
895 #endif | 915 #endif |
OLD | NEW |