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 21 matching lines...) Expand all Loading... |
32 #include "SkTypes.h" | 32 #include "SkTypes.h" |
33 #include "SkXfermode.h" | 33 #include "SkXfermode.h" |
34 | 34 |
35 //#define ENABLE_MDB 1 | 35 //#define ENABLE_MDB 1 |
36 | 36 |
37 class GrBatch; | 37 class GrBatch; |
38 class GrClip; | 38 class GrClip; |
39 class GrCaps; | 39 class GrCaps; |
40 class GrPath; | 40 class GrPath; |
41 class GrDrawPathBatchBase; | 41 class GrDrawPathBatchBase; |
42 class GrPathRangeDraw; | |
43 | 42 |
44 class GrDrawTarget final : public SkRefCnt { | 43 class GrDrawTarget final : public SkRefCnt { |
45 public: | 44 public: |
46 /** Options for GrDrawTarget behavior. */ | 45 /** Options for GrDrawTarget behavior. */ |
47 struct Options { | 46 struct Options { |
48 Options () : fClipBatchToBounds(false), fDrawBatchBounds(false) {} | 47 Options () : fClipBatchToBounds(false), fDrawBatchBounds(false) {} |
49 bool fClipBatchToBounds; | 48 bool fClipBatchToBounds; |
50 bool fDrawBatchBounds; | 49 bool fDrawBatchBounds; |
51 }; | 50 }; |
52 | 51 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 /** | 104 /** |
106 * Draws path into the stencil buffer. The fill must be either even/odd or | 105 * Draws path into the stencil buffer. The fill must be either even/odd or |
107 * winding (not inverse or hairline). It will respect the HW antialias flag | 106 * winding (not inverse or hairline). It will respect the HW antialias flag |
108 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve
r have an inverse | 107 * on the GrPipelineBuilder (if possible in the 3D API). Note, we will neve
r have an inverse |
109 * fill with stencil path | 108 * fill with stencil path |
110 */ | 109 */ |
111 void stencilPath(const GrPipelineBuilder&, const SkMatrix& viewMatrix, const
GrPath*, | 110 void stencilPath(const GrPipelineBuilder&, const SkMatrix& viewMatrix, const
GrPath*, |
112 GrPathRendering::FillType); | 111 GrPathRendering::FillType); |
113 | 112 |
114 /** | 113 /** |
115 * Draws a path. Fill must not be a hairline. It will respect the HW | 114 * Draws a path batch. Fill must not be a hairline. It will respect the HW a
ntialias flag on |
116 * antialias flag on the GrPipelineBuilder (if possible in the 3D API). | 115 * the GrPipelineBuilder (if possible in the 3D API). This needs to be separ
ate from drawBatch |
| 116 * because we install path stencil settings late. |
117 * | 117 * |
118 * TODO: Remove this function and construct the batch outside GrDrawTarget. | 118 * TODO: Figure out a better model that allows us to roll this method into d
rawBatch. |
119 */ | 119 */ |
120 void drawPath(const GrPipelineBuilder&, const SkMatrix& viewMatrix, GrColor
color, | 120 void drawPathBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawPathBatch
Base* batch); |
121 const GrPath*, GrPathRendering::FillType); | |
122 | |
123 /** | |
124 * Draws the aggregate path from combining multiple. Note that this will not | |
125 * always be equivalent to back-to-back calls to drawPath(). It will respect | |
126 * the HW antialias flag on the GrPipelineBuilder (if possible in the 3D API
). | |
127 * | |
128 * TODO: Remove this function and construct the batch outside GrDrawTarget. | |
129 * | |
130 * @param draw The transforms and indices for the draw. | |
131 * This object must only be drawn once. The draw | |
132 * may modify its contents. | |
133 * @param fill Fill type for drawing all the paths | |
134 */ | |
135 void drawPathsFromRange(const GrPipelineBuilder&, | |
136 const SkMatrix& viewMatrix, | |
137 const SkMatrix& localMatrix, | |
138 GrColor color, | |
139 GrPathRange* range, | |
140 GrPathRangeDraw* draw, | |
141 GrPathRendering::FillType fill, | |
142 const SkRect& bounds); | |
143 | 121 |
144 /** | 122 /** |
145 * Helper function for drawing rects. | 123 * Helper function for drawing rects. |
146 * | 124 * |
147 * @param rect the rect to draw | 125 * @param rect the rect to draw |
148 * @param localRect optional rect that specifies local coords to map onto | 126 * @param localRect optional rect that specifies local coords to map onto |
149 * rect. If nullptr then rect serves as the local coords. | 127 * rect. If nullptr then rect serves as the local coords. |
150 * @param localMatrix Optional local matrix. The local coordinates are speci
fied by localRect, | 128 * @param localMatrix Optional local matrix. The local coordinates are speci
fied by localRect, |
151 * or if it is nullptr by rect. This matrix applies to th
e coordinate implied by | 129 * or if it is nullptr by rect. This matrix applies to th
e coordinate implied by |
152 * that rectangle before it is input to GrCoordTransforms
that read local | 130 * that rectangle before it is input to GrCoordTransforms
that read local |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 GrDrawBatch* batch); | 259 GrDrawBatch* batch); |
282 | 260 |
283 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required | 261 // Makes a copy of the dst if it is necessary for the draw. Returns false if
a copy is required |
284 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it | 262 // but couldn't be made. Otherwise, returns true. This method needs to be p
rotected because it |
285 // needs to be accessed by GLPrograms to setup a correct drawstate | 263 // needs to be accessed by GLPrograms to setup a correct drawstate |
286 bool setupDstReadIfNecessary(const GrPipelineBuilder&, | 264 bool setupDstReadIfNecessary(const GrPipelineBuilder&, |
287 const GrPipelineOptimizations& optimizations, | 265 const GrPipelineOptimizations& optimizations, |
288 GrXferProcessor::DstTexture*, | 266 GrXferProcessor::DstTexture*, |
289 const SkRect& batchBounds); | 267 const SkRect& batchBounds); |
290 | 268 |
291 void drawPathBatch(const GrPipelineBuilder& pipelineBuilder, GrDrawPathBatch
Base* batch, | |
292 GrPathRendering::FillType fill); | |
293 // Check to see if this set of draw commands has been sent out | 269 // Check to see if this set of draw commands has been sent out |
294 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, | 270 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, |
295 const GrStencilAttachment*, | 271 const GrStencilAttachment*, |
296 GrStencilSettings*); | 272 GrStencilSettings*); |
297 bool setupClip(const GrPipelineBuilder&, | 273 bool setupClip(const GrPipelineBuilder&, |
298 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, | 274 GrPipelineBuilder::AutoRestoreFragmentProcessorState*
, |
299 GrPipelineBuilder::AutoRestoreStencil*, | 275 GrPipelineBuilder::AutoRestoreStencil*, |
300 GrScissorState*, | 276 GrScissorState*, |
301 const SkRect* devBounds); | 277 const SkRect* devBounds); |
302 | 278 |
(...skipping 16 matching lines...) Expand all Loading... |
319 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' | 295 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' |
320 SkTDArray<GrDrawTarget*> fDependencies; | 296 SkTDArray<GrDrawTarget*> fDependencies; |
321 GrRenderTarget* fRenderTarget; | 297 GrRenderTarget* fRenderTarget; |
322 | 298 |
323 bool fDrawBatchBounds; | 299 bool fDrawBatchBounds; |
324 | 300 |
325 typedef SkRefCnt INHERITED; | 301 typedef SkRefCnt INHERITED; |
326 }; | 302 }; |
327 | 303 |
328 #endif | 304 #endif |
OLD | NEW |