• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
numRenderTasks()21     int numRenderTasks() const {
22         return fDDL->fRenderTasks.count();
23     }
24 
targetProxy()25     GrRenderTargetProxy* targetProxy() const {
26         return fDDL->fTargetProxy.get();
27     }
28 
lazyProxyData()29     const SkDeferredDisplayList::LazyProxyData* lazyProxyData() const {
30         return fDDL->fLazyProxyData.get();
31     }
32 
programData()33     const SkTArray<GrRecordingContext::ProgramData>& programData() const {
34         return fDDL->programData();
35     }
36 
renderTasks()37     const SkTArray<sk_sp<GrRenderTask>>& renderTasks() const {
38         return fDDL->fRenderTasks;
39     }
40 #endif
41 
42 private:
SkDeferredDisplayListPriv(SkDeferredDisplayList * ddl)43     explicit SkDeferredDisplayListPriv(SkDeferredDisplayList* ddl) : fDDL(ddl) {}
44     // Required until C++17 copy elision
45     SkDeferredDisplayListPriv(const SkDeferredDisplayListPriv&) = default;
46     SkDeferredDisplayListPriv& operator=(const SkDeferredDisplayListPriv&) = delete;
47 
48     // No taking addresses of this type.
49     const SkDeferredDisplayListPriv* operator&() const;
50     SkDeferredDisplayListPriv* operator&();
51 
52     SkDeferredDisplayList* fDDL;
53 
54     friend class SkDeferredDisplayList; // to construct/copy this type.
55 };
56 
priv()57 inline SkDeferredDisplayListPriv SkDeferredDisplayList::priv() {
58     return SkDeferredDisplayListPriv(this);
59 }
60 
priv()61 inline const SkDeferredDisplayListPriv SkDeferredDisplayList::priv () const {  // NOLINT(readability-const-return-type)
62     return SkDeferredDisplayListPriv(const_cast<SkDeferredDisplayList*>(this));
63 }
64 
65 #endif
66