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 ~GrInOrderDrawBuffer() SK_OVERRIDE; | 55 virtual ~GrInOrderDrawBuffer(); |
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 DrawToken getCurrentDrawToken() { return DrawToken(this, fDrawID); } | 72 virtual DrawToken getCurrentDrawToken() { return DrawToken(this, fDrawID); } |
73 | 73 |
74 // overrides from GrDrawTarget | 74 // overrides from GrDrawTarget |
75 bool geometryHints(size_t vertexStride, | 75 virtual 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 void clearStencilClip(const SkIRect& rect, | 79 virtual bool copySurface(GrSurface* dst, |
80 bool insideClip, | 80 GrSurface* src, |
81 GrRenderTarget* renderTarget) SK_OVERRIDE; | 81 const SkIRect& srcRect, |
| 82 const SkIPoint& dstPoint) SK_OVERRIDE; |
82 | 83 |
83 void discard(GrRenderTarget*) SK_OVERRIDE; | 84 virtual bool canCopySurface(const GrSurface* dst, |
| 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; |
84 | 96 |
85 private: | 97 private: |
86 typedef GrClipMaskManager::ScissorState ScissorState; | 98 typedef GrClipMaskManager::ScissorState ScissorState; |
87 enum { | 99 enum { |
88 kDraw_Cmd = 1, | 100 kDraw_Cmd = 1, |
89 kStencilPath_Cmd = 2, | 101 kStencilPath_Cmd = 2, |
90 kSetState_Cmd = 3, | 102 kSetState_Cmd = 3, |
91 kClear_Cmd = 4, | 103 kClear_Cmd = 4, |
92 kCopySurface_Cmd = 5, | 104 kCopySurface_Cmd = 5, |
93 kDrawPath_Cmd = 6, | 105 kDrawPath_Cmd = 6, |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 | 266 |
255 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; | 267 bool onReserveVertexSpace(size_t vertexSize, int vertexCount, void** vertice
s) SK_OVERRIDE; |
256 bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE; | 268 bool onReserveIndexSpace(int indexCount, void** indices) SK_OVERRIDE; |
257 void releaseReservedVertexSpace() SK_OVERRIDE; | 269 void releaseReservedVertexSpace() SK_OVERRIDE; |
258 void releaseReservedIndexSpace() SK_OVERRIDE; | 270 void releaseReservedIndexSpace() SK_OVERRIDE; |
259 void geometrySourceWillPush() SK_OVERRIDE; | 271 void geometrySourceWillPush() SK_OVERRIDE; |
260 void geometrySourceWillPop(const GeometrySrcState& restoredState) SK_OVERRID
E; | 272 void geometrySourceWillPop(const GeometrySrcState& restoredState) SK_OVERRID
E; |
261 void willReserveVertexAndIndexSpace(int vertexCount, | 273 void willReserveVertexAndIndexSpace(int vertexCount, |
262 size_t vertexStride, | 274 size_t vertexStride, |
263 int indexCount) SK_OVERRIDE; | 275 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; | |
273 | 276 |
274 // Attempts to concat instances from info onto the previous draw. info must
represent an | 277 // Attempts to concat instances from info onto the previous draw. info must
represent an |
275 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. | 278 // instanced draw. The caller must have already recorded a new draw state an
d clip if necessary. |
276 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); | 279 int concatInstancedDraw(const GrDrawState&, const DrawInfo&); |
277 | 280 |
278 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so | 281 // Determines whether the current draw operation requires a new GrOptDrawSta
te and if so |
279 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is | 282 // records it. If the draw can be skipped false is returned and no new GrOpt
DrawState is |
280 // recorded. | 283 // recorded. |
281 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, | 284 bool SK_WARN_UNUSED_RESULT recordStateAndShouldDraw(const GrDrawState&, |
282 GrGpu::DrawType, | 285 GrGpu::DrawType, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 SkTDArray<char> fPathIndexBuffer; | 323 SkTDArray<char> fPathIndexBuffer; |
321 SkTDArray<float> fPathTransformBuffer; | 324 SkTDArray<float> fPathTransformBuffer; |
322 GeoPoolStateStack fGeoPoolStateStack; | 325 GeoPoolStateStack fGeoPoolStateStack; |
323 bool fFlushing; | 326 bool fFlushing; |
324 uint32_t fDrawID; | 327 uint32_t fDrawID; |
325 | 328 |
326 typedef GrClipTarget INHERITED; | 329 typedef GrClipTarget INHERITED; |
327 }; | 330 }; |
328 | 331 |
329 #endif | 332 #endif |
OLD | NEW |