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 15 matching lines...) Expand all Loading... |
26 #include "SkStrokeRec.h" | 26 #include "SkStrokeRec.h" |
27 #include "SkTArray.h" | 27 #include "SkTArray.h" |
28 #include "SkTLazy.h" | 28 #include "SkTLazy.h" |
29 #include "SkTypes.h" | 29 #include "SkTypes.h" |
30 #include "SkXfermode.h" | 30 #include "SkXfermode.h" |
31 | 31 |
32 class GrBatch; | 32 class GrBatch; |
33 class GrClip; | 33 class GrClip; |
34 class GrCaps; | 34 class GrCaps; |
35 class GrPath; | 35 class GrPath; |
36 class GrPathRange; | |
37 class GrDrawBatch; | 36 class GrDrawBatch; |
| 37 class GrDrawPathBatchBase; |
| 38 class GrPathRangeDraw; |
38 | 39 |
39 class GrDrawTarget : public SkRefCnt { | 40 class GrDrawTarget : public SkRefCnt { |
40 public: | 41 public: |
41 | 42 |
42 | 43 |
43 typedef GrPathRange::PathIndexType PathIndexType; | 44 typedef GrPathRange::PathIndexType PathIndexType; |
44 typedef GrPathRendering::PathTransformType PathTransformType; | 45 typedef GrPathRendering::PathTransformType PathTransformType; |
45 | 46 |
46 /////////////////////////////////////////////////////////////////////////// | 47 /////////////////////////////////////////////////////////////////////////// |
47 | 48 |
(...skipping 26 matching lines...) Expand all Loading... |
74 * winding (not inverse or hairline). It will respect the HW antialias flag | 75 * winding (not inverse or hairline). It will respect the HW antialias flag |
75 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve
r have an inverse | 76 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve
r have an inverse |
76 * fill with stencil path | 77 * fill with stencil path |
77 */ | 78 */ |
78 void stencilPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrP
ath*, | 79 void stencilPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrP
ath*, |
79 GrPathRendering::FillType); | 80 GrPathRendering::FillType); |
80 | 81 |
81 /** | 82 /** |
82 * Draws a path. Fill must not be a hairline. It will respect the HW | 83 * Draws a path. Fill must not be a hairline. It will respect the HW |
83 * antialias flag on the GrPipelineBuilder (if possible in the 3D API). | 84 * antialias flag on the GrPipelineBuilder (if possible in the 3D API). |
| 85 * |
| 86 * TODO: Remove this function and construct the batch outside GrDrawTarget. |
84 */ | 87 */ |
85 void drawPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrPath
*, | 88 void drawPath(const GrPipelineBuilder&, const GrPathProcessor*, const GrPath
*, |
86 GrPathRendering::FillType); | 89 GrPathRendering::FillType); |
87 | 90 |
88 /** | 91 /** |
89 * Draws the aggregate path from combining multiple. Note that this will not | 92 * Draws the aggregate path from combining multiple. Note that this will not |
90 * always be equivalent to back-to-back calls to drawPath(). It will respect | 93 * always be equivalent to back-to-back calls to drawPath(). It will respect |
91 * the HW antialias flag on the GrPipelineBuilder (if possible in the 3D API
). | 94 * the HW antialias flag on the GrPipelineBuilder (if possible in the 3D API
). |
92 * | 95 * |
93 * @param pathRange Source paths to draw from | 96 * TODO: Remove this function and construct the batch outside GrDrawTarget. |
94 * @param indices Array of path indices to draw | 97 * |
95 * @param indexType Data type of the array elements in indexBuffer | 98 * @param draw The range, transforms, and indices for the draw. |
96 * @param transformValues Array of transforms for the individual paths | 99 * This object must only be drawn once. The draw |
97 * @param transformType Type of transforms in transformBuffer | 100 * may modify its contents. |
98 * @param count Number of paths to draw | |
99 * @param fill Fill type for drawing all the paths | 101 * @param fill Fill type for drawing all the paths |
100 */ | 102 */ |
101 void drawPaths(const GrPipelineBuilder&, | 103 void drawPathsFromRange(const GrPipelineBuilder&, |
102 const GrPathProcessor*, | 104 const GrPathProcessor*, |
103 const GrPathRange* pathRange, | 105 GrPathRangeDraw* draw, |
104 const void* indices, | 106 GrPathRendering::FillType fill); |
105 PathIndexType indexType, | |
106 const float transformValues[], | |
107 PathTransformType transformType, | |
108 int count, | |
109 GrPathRendering::FillType fill); | |
110 | 107 |
111 /** | 108 /** |
112 * Helper function for drawing rects. | 109 * Helper function for drawing rects. |
113 * | 110 * |
114 * @param rect the rect to draw | 111 * @param rect the rect to draw |
115 * @param localRect optional rect that specifies local coords to map onto | 112 * @param localRect optional rect that specifies local coords to map onto |
116 * rect. If nullptr then rect serves as the local coords. | 113 * rect. If nullptr then rect serves as the local coords. |
117 * @param localMatrix Optional local matrix. The local coordinates are speci
fied by localRect, | 114 * @param localMatrix Optional local matrix. The local coordinates are speci
fied by localRect, |
118 * or if it is nullptr by rect. This matrix applies to th
e coordinate implied by | 115 * or if it is nullptr by rect. This matrix applies to th
e coordinate implied by |
119 * that rectangle before it is input to GrCoordTransforms
that read local | 116 * that rectangle before it is input to GrCoordTransforms
that read local |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 /** | 177 /** |
181 * Release any resources that are cached but not currently in use. This | 178 * Release any resources that are cached but not currently in use. This |
182 * is intended to give an application some recourse when resources are low. | 179 * is intended to give an application some recourse when resources are low. |
183 */ | 180 */ |
184 virtual void purgeResources() {}; | 181 virtual void purgeResources() {}; |
185 | 182 |
186 bool programUnitTest(GrContext* owner, int maxStages); | 183 bool programUnitTest(GrContext* owner, int maxStages); |
187 | 184 |
188 struct PipelineInfo { | 185 struct PipelineInfo { |
189 PipelineInfo(const GrPipelineBuilder* pipelineBuilder, const GrScissorSt
ate* scissor, | 186 PipelineInfo(const GrPipelineBuilder* pipelineBuilder, const GrScissorSt
ate* scissor, |
190 const GrPrimitiveProcessor* primProc, | |
191 const SkRect* devBounds, GrDrawTarget* target); | |
192 | |
193 PipelineInfo(const GrPipelineBuilder* pipelineBuilder, const GrScissorSt
ate* scissor, | |
194 const GrDrawBatch* batch, const SkRect* devBounds, | 187 const GrDrawBatch* batch, const SkRect* devBounds, |
195 GrDrawTarget* target); | 188 GrDrawTarget* target); |
196 | 189 |
197 bool valid() const { return SkToBool(fArgs.fPipelineBuilder); } | 190 bool valid() const { return SkToBool(fArgs.fPipelineBuilder); } |
198 | 191 |
199 const GrPipeline::CreateArgs& pipelineCreateArgs() const { | 192 const GrPipeline::CreateArgs& pipelineCreateArgs() const { |
200 SkASSERT(this->valid()); | 193 SkASSERT(this->valid()); |
201 return fArgs; | 194 return fArgs; |
202 } | 195 } |
203 | 196 |
(...skipping 14 matching lines...) Expand all Loading... |
218 GrXferProcessor::DstTexture*, | 211 GrXferProcessor::DstTexture*, |
219 const SkRect* drawBounds); | 212 const SkRect* drawBounds); |
220 | 213 |
221 virtual void onDrawBatch(GrBatch*) = 0; | 214 virtual void onDrawBatch(GrBatch*) = 0; |
222 | 215 |
223 private: | 216 private: |
224 virtual void onReset() = 0; | 217 virtual void onReset() = 0; |
225 | 218 |
226 virtual void onFlush() = 0; | 219 virtual void onFlush() = 0; |
227 | 220 |
228 virtual void onDrawPaths(const GrPathProcessor*, | 221 void drawPathBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawPathBatch
Base* batch, |
229 const GrPathRange*, | 222 GrPathRendering::FillType fill); |
230 const void* indices, | |
231 PathIndexType, | |
232 const float transformValues[], | |
233 PathTransformType, | |
234 int count, | |
235 const GrStencilSettings&, | |
236 const PipelineInfo&) = 0; | |
237 | |
238 // Check to see if this set of draw commands has been sent out | 223 // Check to see if this set of draw commands has been sent out |
239 virtual bool isIssued(uint32_t drawID) { return true; } | |
240 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, | 224 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, |
241 const GrStencilAttachment*, | 225 const GrStencilAttachment*, |
242 GrStencilSettings*); | 226 GrStencilSettings*); |
243 virtual GrClipMaskManager* clipMaskManager() = 0; | 227 virtual GrClipMaskManager* clipMaskManager() = 0; |
244 virtual bool setupClip(const GrPipelineBuilder&, | 228 virtual bool setupClip(const GrPipelineBuilder&, |
245 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, | 229 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, |
246 GrPipelineBuilder::AutoRestoreStencil*, | 230 GrPipelineBuilder::AutoRestoreStencil*, |
247 GrScissorState*, | 231 GrScissorState*, |
248 const SkRect* devBounds) = 0; | 232 const SkRect* devBounds) = 0; |
249 | 233 |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 bool setupClip(const GrPipelineBuilder&, | 276 bool setupClip(const GrPipelineBuilder&, |
293 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, | 277 GrPipelineBuilder::AutoRestoreFragmentProcessorState*, |
294 GrPipelineBuilder::AutoRestoreStencil*, | 278 GrPipelineBuilder::AutoRestoreStencil*, |
295 GrScissorState* scissorState, | 279 GrScissorState* scissorState, |
296 const SkRect* devBounds) override; | 280 const SkRect* devBounds) override; |
297 | 281 |
298 typedef GrDrawTarget INHERITED; | 282 typedef GrDrawTarget INHERITED; |
299 }; | 283 }; |
300 | 284 |
301 #endif | 285 #endif |
OLD | NEW |