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 |
11 #include "GrDrawTarget.h" | 11 #include "GrDrawTarget.h" |
12 #include "GrAllocPool.h" | 12 #include "GrAllocPool.h" |
13 #include "GrAllocator.h" | 13 #include "GrAllocator.h" |
14 #include "GrPath.h" | 14 #include "GrPath.h" |
15 | 15 |
16 #include "SkClipStack.h" | 16 #include "SkClipStack.h" |
17 #include "SkTemplates.h" | 17 #include "SkTemplates.h" |
18 #include "SkTypes.h" | 18 #include "SkTypes.h" |
19 | 19 |
20 class GrGpu; | 20 class GrGpu; |
21 class GrIndexBufferAllocPool; | 21 class GrIndexBufferAllocPool; |
| 22 class GrPathRange; |
22 class GrVertexBufferAllocPool; | 23 class GrVertexBufferAllocPool; |
23 | 24 |
24 /** | 25 /** |
25 * GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up draws
for eventual | 26 * GrInOrderDrawBuffer is an implementation of GrDrawTarget that queues up draws
for eventual |
26 * playback into a GrGpu. In theory one draw buffer could playback into another.
When index or | 27 * playback into a GrGpu. In theory one draw buffer could playback into another.
When index or |
27 * vertex buffers are used as geometry sources it is the callers the draw buffer
only holds | 28 * vertex buffers are used as geometry sources it is the callers the draw buffer
only holds |
28 * references to the buffers. It is the callers responsibility to ensure that th
e data is still | 29 * references to the buffers. It is the callers responsibility to ensure that th
e data is still |
29 * valid when the draw buffer is played back into a GrGpu. Similarly, it is the
caller's | 30 * valid when the draw buffer is played back into a GrGpu. Similarly, it is the
caller's |
30 * responsibility to ensure that all referenced textures, buffers, and render-ta
rgets are associated | 31 * responsibility to ensure that all referenced textures, buffers, and render-ta
rgets are associated |
31 * in the GrGpu object that the buffer is played back into. The buffer requires
VB and IB pools to | 32 * in the GrGpu object that the buffer is played back into. The buffer requires
VB and IB pools to |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 113 |
113 SkAutoTUnref<const GrPath> fPath; | 114 SkAutoTUnref<const GrPath> fPath; |
114 SkPath::FillType fFill; | 115 SkPath::FillType fFill; |
115 GrDeviceCoordTexture fDstCopy; | 116 GrDeviceCoordTexture fDstCopy; |
116 }; | 117 }; |
117 | 118 |
118 struct DrawPaths : public ::SkNoncopyable { | 119 struct DrawPaths : public ::SkNoncopyable { |
119 DrawPaths(); | 120 DrawPaths(); |
120 ~DrawPaths(); | 121 ~DrawPaths(); |
121 | 122 |
122 int fPathCount; | 123 SkAutoTUnref<const GrPathRange> fPathRange; |
123 const GrPath** fPaths; | 124 uint32_t* fIndices; |
124 SkMatrix* fTransforms; | 125 size_t fCount; |
| 126 float* fTransforms; |
| 127 PathTransformType fTransformsType; |
125 SkPath::FillType fFill; | 128 SkPath::FillType fFill; |
126 SkStrokeRec::Style fStroke; | |
127 GrDeviceCoordTexture fDstCopy; | 129 GrDeviceCoordTexture fDstCopy; |
128 }; | 130 }; |
129 | 131 |
130 // This is also used to record a discard by setting the color to GrColor_ILL
EGAL | 132 // This is also used to record a discard by setting the color to GrColor_ILL
EGAL |
131 struct Clear : public ::SkNoncopyable { | 133 struct Clear : public ::SkNoncopyable { |
132 Clear() : fRenderTarget(NULL) {} | 134 Clear() : fRenderTarget(NULL) {} |
133 ~Clear() { SkSafeUnref(fRenderTarget); } | 135 ~Clear() { SkSafeUnref(fRenderTarget); } |
134 | 136 |
135 SkIRect fRect; | 137 SkIRect fRect; |
136 GrColor fColor; | 138 GrColor fColor; |
(...skipping 16 matching lines...) Expand all Loading... |
153 // overrides from GrDrawTarget | 155 // overrides from GrDrawTarget |
154 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; | 156 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; |
155 virtual void onDrawRect(const SkRect& rect, | 157 virtual void onDrawRect(const SkRect& rect, |
156 const SkMatrix* matrix, | 158 const SkMatrix* matrix, |
157 const SkRect* localRect, | 159 const SkRect* localRect, |
158 const SkMatrix* localMatrix) SK_OVERRIDE; | 160 const SkMatrix* localMatrix) SK_OVERRIDE; |
159 | 161 |
160 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; | 162 virtual void onStencilPath(const GrPath*, SkPath::FillType) SK_OVERRIDE; |
161 virtual void onDrawPath(const GrPath*, SkPath::FillType, | 163 virtual void onDrawPath(const GrPath*, SkPath::FillType, |
162 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 164 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; |
163 virtual void onDrawPaths(int, const GrPath**, const SkMatrix*, | 165 virtual void onDrawPaths(const GrPathRange*, |
164 SkPath::FillType, SkStrokeRec::Style, | 166 const uint32_t indices[], int count, |
165 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE; | 167 const float transforms[], PathTransformType, |
| 168 SkPath::FillType, const GrDeviceCoordTexture*) SK_O
VERRIDE; |
166 | 169 |
167 virtual bool onReserveVertexSpace(size_t vertexSize, | 170 virtual bool onReserveVertexSpace(size_t vertexSize, |
168 int vertexCount, | 171 int vertexCount, |
169 void** vertices) SK_OVERRIDE; | 172 void** vertices) SK_OVERRIDE; |
170 virtual bool onReserveIndexSpace(int indexCount, | 173 virtual bool onReserveIndexSpace(int indexCount, |
171 void** indices) SK_OVERRIDE; | 174 void** indices) SK_OVERRIDE; |
172 virtual void releaseReservedVertexSpace() SK_OVERRIDE; | 175 virtual void releaseReservedVertexSpace() SK_OVERRIDE; |
173 virtual void releaseReservedIndexSpace() SK_OVERRIDE; | 176 virtual void releaseReservedIndexSpace() SK_OVERRIDE; |
174 virtual void onSetVertexSourceToArray(const void* vertexArray, | 177 virtual void onSetVertexSourceToArray(const void* vertexArray, |
175 int vertexCount) SK_OVERRIDE; | 178 int vertexCount) SK_OVERRIDE; |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 | 286 |
284 void addToCmdBuffer(uint8_t cmd); | 287 void addToCmdBuffer(uint8_t cmd); |
285 | 288 |
286 bool fFlushing; | 289 bool fFlushing; |
287 uint32_t fDrawID; | 290 uint32_t fDrawID; |
288 | 291 |
289 typedef GrDrawTarget INHERITED; | 292 typedef GrDrawTarget INHERITED; |
290 }; | 293 }; |
291 | 294 |
292 #endif | 295 #endif |
OLD | NEW |