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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
42 class GrPathRangeDraw; | 42 class GrPathRangeDraw; |
43 | 43 |
44 class GrDrawTarget final : public SkRefCnt { | 44 class GrDrawTarget final : public SkRefCnt { |
45 public: | 45 public: |
46 // The context may not be fully constructed and should not be used during Gr DrawTarget | 46 // The context may not be fully constructed and should not be used during Gr DrawTarget |
47 // construction. | 47 // construction. |
48 GrDrawTarget(GrGpu* gpu, GrResourceProvider*); | 48 GrDrawTarget(GrGpu* gpu, GrResourceProvider*); |
49 | 49 |
50 ~GrDrawTarget() override; | 50 ~GrDrawTarget() override; |
51 | 51 |
52 enum Flags { | |
53 kClosed_Flag = 0x01, //!< This drawTarget can't accept any more bat ches | |
54 | |
55 kWasOutput_Flag = 0x02, //!< Flag for topological sorting | |
56 kTempMark_Flag = 0x04, //!< Flag for topological sorting | |
57 }; | |
58 | |
52 void makeClosed() { | 59 void makeClosed() { |
53 // We only close drawTargets When MDB is enabled. When MDB is disabled t here is only | 60 // We only close drawTargets When MDB is enabled. When MDB is disabled t here is only |
54 // ever one drawTarget and all calls will be funnelled into it. | 61 // ever one drawTarget and all calls will be funnelled into it. |
55 #ifdef ENABLE_MDB | 62 #ifdef ENABLE_MDB |
56 fClosed = true; | 63 this->setFlag(kClosed_Flag); |
57 #endif | 64 #endif |
58 } | 65 } |
59 bool isClosed() const { return fClosed; } | 66 bool isClosed() const { return this->isSetFlag(kClosed_Flag); } |
67 | |
68 void setFlag(uint32_t flag) { | |
bsalomon
2015/10/20 13:57:19
I'm wondering if all this stuff needs to be public
robertphillips
2015/10/20 14:10:49
Done.
| |
69 fFlags |= flag; | |
70 } | |
71 | |
72 void resetFlag(uint32_t flag) { | |
73 fFlags &= ~flag; | |
74 } | |
75 | |
76 bool isSetFlag(uint32_t flag) const { | |
77 return SkToBool(fFlags & flag); | |
78 } | |
79 | |
80 // This drawTarget relies on the contents of 'dependedOn' | |
81 void addDependency(GrSurface* dependedOn); | |
82 | |
83 bool dependsOn(GrDrawTarget* dependedOn) const { | |
84 return fDependencies.find(dependedOn) >= 0; | |
85 } | |
86 | |
87 int numDependencies() const { | |
88 return fDependencies.count(); | |
89 } | |
90 | |
91 GrDrawTarget* dependency(int index) { | |
92 return fDependencies[index]; | |
93 } | |
60 | 94 |
61 /** | 95 /** |
62 * Empties the draw buffer of any queued up draws. | 96 * Empties the draw buffer of any queued up draws. |
63 */ | 97 */ |
64 void reset(); | 98 void reset(); |
65 | 99 |
66 /** | 100 /** |
67 * This plays any queued up draws to its GrGpu target. It also resets this o bject (i.e. flushing | 101 * This plays any queued up draws to its GrGpu target. It also resets this o bject (i.e. flushing |
68 * is destructive). | 102 * is destructive). |
69 */ | 103 */ |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
224 // Check to see if this set of draw commands has been sent out | 258 // Check to see if this set of draw commands has been sent out |
225 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, | 259 void getPathStencilSettingsForFilltype(GrPathRendering::FillType, |
226 const GrStencilAttachment*, | 260 const GrStencilAttachment*, |
227 GrStencilSettings*); | 261 GrStencilSettings*); |
228 bool setupClip(const GrPipelineBuilder&, | 262 bool setupClip(const GrPipelineBuilder&, |
229 GrPipelineBuilder::AutoRestoreFragmentProcessorState* , | 263 GrPipelineBuilder::AutoRestoreFragmentProcessorState* , |
230 GrPipelineBuilder::AutoRestoreStencil*, | 264 GrPipelineBuilder::AutoRestoreStencil*, |
231 GrScissorState*, | 265 GrScissorState*, |
232 const SkRect* devBounds); | 266 const SkRect* devBounds); |
233 | 267 |
268 void addDependency(GrDrawTarget* dependedOn); | |
269 | |
234 // Used only by CMM. | 270 // Used only by CMM. |
235 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); | 271 void clearStencilClip(const SkIRect&, bool insideClip, GrRenderTarget*); |
236 | 272 |
237 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; | 273 SkSTArray<256, SkAutoTUnref<GrBatch>, true> fBatches; |
238 SkAutoTDelete<GrClipMaskManager> fClipMaskManager; | 274 SkAutoTDelete<GrClipMaskManager> fClipMaskManager; |
239 // The context is only in service of the clip mask manager, remove once CMM doesn't need this. | 275 // The context is only in service of the clip mask manager, remove once CMM doesn't need this. |
240 GrContext* fContext; | 276 GrContext* fContext; |
241 GrGpu* fGpu; | 277 GrGpu* fGpu; |
242 GrResourceProvider* fResourceProvider; | 278 GrResourceProvider* fResourceProvider; |
243 GrBatchFlushState fFlushState; | 279 GrBatchFlushState fFlushState; |
244 bool fFlushing; | 280 bool fFlushing; |
245 int fFirstUnpreparedBatch; | 281 int fFirstUnpreparedBatch; |
246 | 282 |
247 bool fClosed; | 283 uint32_t fFlags; |
284 | |
285 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci es' | |
286 SkTDArray<GrDrawTarget*> fDependencies; | |
248 | 287 |
249 typedef SkRefCnt INHERITED; | 288 typedef SkRefCnt INHERITED; |
250 }; | 289 }; |
251 | 290 |
252 #endif | 291 #endif |
OLD | NEW |