1 | /* |
---|---|
2 | * Copyright 2018 Google Inc. |
3 | * |
4 | * Use of this source code is governed by a BSD-style license that can be |
5 | * found in the LICENSE file. |
6 | */ |
7 | |
8 | #ifndef SkDeferredDisplayListPriv_DEFINED |
9 | #define SkDeferredDisplayListPriv_DEFINED |
10 | |
11 | #include "include/core/SkDeferredDisplayList.h" |
12 | |
13 | /*************************************************************************************************/ |
14 | /** Class that adds methods to SkDeferredDisplayList that are only intended for use internal to Skia. |
15 | This class is purely a privileged window into SkDeferredDisplayList. It should never have |
16 | additional data members or virtual methods. */ |
17 | class SkDeferredDisplayListPriv { |
18 | public: |
19 | |
20 | #if SK_SUPPORT_GPU |
21 | int numRenderTasks() const { |
22 | return fDDL->fRenderTasks.count(); |
23 | } |
24 | |
25 | GrRenderTargetProxy* targetProxy() const { |
26 | return fDDL->fTargetProxy.get(); |
27 | } |
28 | |
29 | const SkDeferredDisplayList::LazyProxyData* lazyProxyData() const { |
30 | return fDDL->fLazyProxyData.get(); |
31 | } |
32 | |
33 | const SkTArray<GrRecordingContext::ProgramData>& programData() const { |
34 | return fDDL->programData(); |
35 | } |
36 | #endif |
37 | |
38 | private: |
39 | explicit SkDeferredDisplayListPriv(SkDeferredDisplayList* ddl) : fDDL(ddl) {} |
40 | SkDeferredDisplayListPriv(const SkDeferredDisplayListPriv&) = delete; |
41 | SkDeferredDisplayListPriv& operator=(const SkDeferredDisplayListPriv&) = delete; |
42 | |
43 | // No taking addresses of this type. |
44 | const SkDeferredDisplayListPriv* operator&() const; |
45 | SkDeferredDisplayListPriv* operator&(); |
46 | |
47 | SkDeferredDisplayList* fDDL; |
48 | |
49 | friend class SkDeferredDisplayList; // to construct/copy this type. |
50 | }; |
51 | |
52 | inline SkDeferredDisplayListPriv SkDeferredDisplayList::priv() { |
53 | return SkDeferredDisplayListPriv(this); |
54 | } |
55 | |
56 | inline const SkDeferredDisplayListPriv SkDeferredDisplayList::priv () const { // NOLINT(readability-const-return-type) |
57 | return SkDeferredDisplayListPriv(const_cast<SkDeferredDisplayList*>(this)); |
58 | } |
59 | |
60 | #endif |
61 |