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 "SkClipStack.h" | 26 #include "SkClipStack.h" |
27 #include "SkMatrix.h" | 27 #include "SkMatrix.h" |
28 #include "SkPath.h" | 28 #include "SkPath.h" |
29 #include "SkStringUtils.h" | 29 #include "SkStringUtils.h" |
30 #include "SkStrokeRec.h" | 30 #include "SkStrokeRec.h" |
31 #include "SkTArray.h" | 31 #include "SkTArray.h" |
32 #include "SkTLazy.h" | 32 #include "SkTLazy.h" |
33 #include "SkTypes.h" | 33 #include "SkTypes.h" |
34 #include "SkXfermode.h" | 34 #include "SkXfermode.h" |
35 | 35 |
| 36 //#define ENABLE_MDB 1 |
| 37 |
36 class GrBatch; | 38 class GrBatch; |
37 class GrBatchFlushState; | 39 class GrBatchFlushState; |
38 class GrClip; | 40 class GrClip; |
39 class GrCaps; | 41 class GrCaps; |
40 class GrPath; | 42 class GrPath; |
41 class GrDrawPathBatchBase; | 43 class GrDrawPathBatchBase; |
42 class GrPathRangeDraw; | 44 class GrPathRangeDraw; |
43 | 45 |
44 class GrDrawTarget final : public SkRefCnt { | 46 class GrDrawTarget final : public SkRefCnt { |
45 public: | 47 public: |
46 struct Options { | 48 struct Options { |
47 bool fImmediateMode; | 49 bool fImmediateMode; |
48 }; | 50 }; |
49 | 51 |
50 // The context may not be fully constructed and should not be used during Gr
DrawTarget | 52 // The context may not be fully constructed and should not be used during Gr
DrawTarget |
51 // construction. | 53 // construction. |
52 GrDrawTarget(GrGpu* gpu, GrResourceProvider*, const Options& options); | 54 GrDrawTarget(GrRenderTarget* rt, GrGpu* gpu, GrResourceProvider*, const Opti
ons& options); |
53 | 55 |
54 ~GrDrawTarget() override; | 56 ~GrDrawTarget() override; |
55 | 57 |
56 void makeClosed() { | 58 void makeClosed() { |
57 // We only close drawTargets When MDB is enabled. When MDB is disabled t
here is only | 59 // We only close drawTargets When MDB is enabled. When MDB is disabled t
here is only |
58 // ever one drawTarget and all calls will be funnelled into it. | 60 // ever one drawTarget and all calls will be funnelled into it. |
59 #ifdef ENABLE_MDB | 61 #ifdef ENABLE_MDB |
60 this->setFlag(kClosed_Flag); | 62 this->setFlag(kClosed_Flag); |
61 #endif | 63 #endif |
62 } | 64 } |
63 bool isClosed() const { return this->isSetFlag(kClosed_Flag); } | 65 bool isClosed() const { return this->isSetFlag(kClosed_Flag); } |
64 | 66 |
| 67 // TODO: this entry point is only needed in the non-MDB world. Remove when |
| 68 // we make the switch to MDB |
| 69 void clearRT() { fRenderTarget = nullptr; } |
| 70 |
65 /* | 71 /* |
66 * Notify this drawTarget that it relies on the contents of 'dependedOn' | 72 * Notify this drawTarget that it relies on the contents of 'dependedOn' |
67 */ | 73 */ |
68 void addDependency(GrSurface* dependedOn); | 74 void addDependency(GrSurface* dependedOn); |
69 | 75 |
70 /* | 76 /* |
71 * Does this drawTarget depend on 'dependedOn'? | 77 * Does this drawTarget depend on 'dependedOn'? |
72 */ | 78 */ |
73 bool dependsOn(GrDrawTarget* dependedOn) const { | 79 bool dependsOn(GrDrawTarget* dependedOn) const { |
74 return fDependencies.find(dependedOn) >= 0; | 80 return fDependencies.find(dependedOn) >= 0; |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 GrBatchFlushState fFlushState; | 317 GrBatchFlushState fFlushState; |
312 bool fFlushing; | 318 bool fFlushing; |
313 int fFirstUnpreparedBatch; | 319 int fFirstUnpreparedBatch; |
314 | 320 |
315 SkDEBUGCODE(int fDebugID;) | 321 SkDEBUGCODE(int fDebugID;) |
316 uint32_t fFlags; | 322 uint32_t fFlags; |
317 Options fOptions; | 323 Options fOptions; |
318 | 324 |
319 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' | 325 // 'this' drawTarget relies on the output of the drawTargets in 'fDependenci
es' |
320 SkTDArray<GrDrawTarget*> fDependencies; | 326 SkTDArray<GrDrawTarget*> fDependencies; |
| 327 GrRenderTarget* fRenderTarget; |
321 | 328 |
322 typedef SkRefCnt INHERITED; | 329 typedef SkRefCnt INHERITED; |
323 }; | 330 }; |
324 | 331 |
325 #endif | 332 #endif |
OLD | NEW |