OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 GrInOrderDrawBuffer_DEFINED | 8 #ifndef GrInOrderDrawBuffer_DEFINED |
9 #define GrInOrderDrawBuffer_DEFINED | 9 #define GrInOrderDrawBuffer_DEFINED |
10 | 10 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 * @param gpu the gpu object that this draw buffer flushes to. | 45 * @param gpu the gpu object that this draw buffer flushes to. |
46 * @param vertexPool pool where vertices for queued draws will be saved when | 46 * @param vertexPool pool where vertices for queued draws will be saved when |
47 * the vertex source is either reserved or array. | 47 * the vertex source is either reserved or array. |
48 * @param indexPool pool where indices for queued draws will be saved when | 48 * @param indexPool pool where indices for queued draws will be saved when |
49 * the index source is either reserved or array. | 49 * the index source is either reserved or array. |
50 */ | 50 */ |
51 GrInOrderDrawBuffer(GrGpu* gpu, | 51 GrInOrderDrawBuffer(GrGpu* gpu, |
52 GrVertexBufferAllocPool* vertexPool, | 52 GrVertexBufferAllocPool* vertexPool, |
53 GrIndexBufferAllocPool* indexPool); | 53 GrIndexBufferAllocPool* indexPool); |
54 | 54 |
55 virtual ~GrInOrderDrawBuffer(); | 55 ~GrInOrderDrawBuffer() SK_OVERRIDE; |
56 | 56 |
57 /** | 57 /** |
58 * Empties the draw buffer of any queued up draws. This must not be called w
hile inside an | 58 * Empties the draw buffer of any queued up draws. This must not be called w
hile inside an |
59 * unbalanced pushGeometrySource(). The current draw state and clip are pres
erved. | 59 * unbalanced pushGeometrySource(). The current draw state and clip are pres
erved. |
60 */ | 60 */ |
61 void reset(); | 61 void reset(); |
62 | 62 |
63 /** | 63 /** |
64 * This plays the queued up draws to its GrGpu target. It also resets this o
bject (i.e. flushing | 64 * This plays the queued up draws to its GrGpu target. It also resets this o
bject (i.e. flushing |
65 * is destructive). This buffer must not have an active reserved vertex or i
ndex source. Any | 65 * is destructive). This buffer must not have an active reserved vertex or i
ndex source. Any |
66 * reserved geometry on the target will be finalized because it's geometry s
ource will be pushed | 66 * reserved geometry on the target will be finalized because it's geometry s
ource will be pushed |
67 * before flushing and popped afterwards. | 67 * before flushing and popped afterwards. |
68 */ | 68 */ |
69 void flush(); | 69 void flush(); |
70 | 70 |
71 // tracking for draws | 71 // tracking for draws |
72 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, fDrawID); } | 72 DrawToken getCurrentDrawToken() { return DrawToken(this, fDrawID); } |
73 | 73 |
74 // overrides from GrDrawTarget | 74 // overrides from GrDrawTarget |
75 virtual bool geometryHints(size_t vertexStride, | 75 bool geometryHints(size_t vertexStride, |
76 int* vertexCount, | 76 int* vertexCount, |
77 int* indexCount) const SK_OVERRIDE; | 77 int* indexCount) const SK_OVERRIDE; |
78 | 78 |
79 virtual bool copySurface(GrSurface* dst, | 79 void clearStencilClip(const SkIRect& rect, |
80 GrSurface* src, | 80 bool insideClip, |
81 const SkIRect& srcRect, | 81 GrRenderTarget* renderTarget) SK_OVERRIDE; |
82 const SkIPoint& dstPoint) SK_OVERRIDE; | |
83 | 82 |
84 virtual bool canCopySurface(const GrSurface* dst, | 83 void discard(GrRenderTarget*) SK_OVERRIDE; |
85 const GrSurface* src, | |
86 const SkIRect& srcRect, | |
87 const SkIPoint& dstPoint) SK_OVERRIDE; | |
88 | |
89 virtual void clearStencilClip(const SkIRect& rect, | |
90 bool insideClip, | |
91 GrRenderTarget* renderTarget) SK_OVERRIDE; | |
92 | |
93 virtual void discard(GrRenderTarget*) SK_OVERRIDE; | |
94 | |
95 virtual void initCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* des
c) SK_OVERRIDE; | |
96 | 84 |
97 private: | 85 private: |
98 typedef GrClipMaskManager::ScissorState ScissorState; | 86 typedef GrClipMaskManager::ScissorState ScissorState; |
99 enum { | 87 enum { |
100 kDraw_Cmd = 1, | 88 kDraw_Cmd = 1, |
101 kStencilPath_Cmd = 2, | 89 kStencilPath_Cmd = 2, |
102 kSetState_Cmd = 3, | 90 kSetState_Cmd = 3, |
103 kClear_Cmd = 4, | 91 kClear_Cmd = 4, |
104 kCopySurface_Cmd = 5, | 92 kCopySurface_Cmd = 5, |
105 kDrawPath_Cmd = 6, | 93 kDrawPath_Cmd = 6, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
266 | 254 |
267 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; | 255 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; |
268 bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE; | 256 bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE; |
269 void releaseReservedVertexSpace() SK_OVERRIDE; | 257 void releaseReservedVertexSpace() SK_OVERRIDE; |
270 void releaseReservedIndexSpace() SK_OVERRIDE; | 258 void releaseReservedIndexSpace() SK_OVERRIDE; |
271 void geometrySourceWillPush() SK_OVERRIDE; | 259 void geometrySourceWillPush() SK_OVERRIDE; |
272 void geometrySourceWillPop(const GeometrySrcState& restoredState) SK_OVERRID
E; | 260 void geometrySourceWillPop(const GeometrySrcState& restoredState) SK_OVERRID
E; |
273 void willReserveVertexAndIndexSpace(int vertexCount, | 261 void willReserveVertexAndIndexSpace(int vertexCount, |
274 size_t vertexStride, | 262 size_t vertexStride, |
275 int indexCount) SK_OVERRIDE; | 263 int indexCount) SK_OVERRIDE; |
| 264 bool onCopySurface(GrSurface* dst, |
| 265 GrSurface* src, |
| 266 const SkIRect& srcRect, |
| 267 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 268 bool onCanCopySurface(const GrSurface* dst, |
| 269 const GrSurface* src, |
| 270 const SkIRect& srcRect, |
| 271 const SkIPoint& dstPoint) SK_OVERRIDE; |
| 272 bool onInitCopySurfaceDstDesc(const GrSurface* src, GrSurfaceDesc* desc) SK_
OVERRIDE; |
276 | 273 |
277 // Attempts to concat instances from info onto the previous draw. info must
represent an | 274 // Attempts to concat instances from info onto the previous draw. info must
represent an |
278 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. | 275 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. |
279 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); | 276 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); |
280 | 277 |
281 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so | 278 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so |
282 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is | 279 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is |
283 // recorded. | 280 // recorded. |
284 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, | 281 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, |
285 GrGpu::DrawType, | 282 GrGpu::DrawType, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 SkTDArray<char> fPathIndexBuffer; | 320 SkTDArray<char> fPathIndexBuffer; |
324 SkTDArray<float> fPathTransformBuffer; | 321 SkTDArray<float> fPathTransformBuffer; |
325 GeoPoolStateStack fGeoPoolStateStack; | 322 GeoPoolStateStack fGeoPoolStateStack; |
326 bool fFlushing; | 323 bool fFlushing; |
327 uint32_t fDrawID; | 324 uint32_t fDrawID; |
328 | 325 |
329 typedef GrClipTarget INHERITED; | 326 typedef GrClipTarget INHERITED; |
330 }; | 327 }; |
331 | 328 |
332 #endif | 329 #endif |
OLD | NEW |