• 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     SkDeferredDisplayListPriv(const SkDeferredDisplayListPriv&) = delete;
45     SkDeferredDisplayListPriv& operator=(const SkDeferredDisplayListPriv&) = delete;
46 
47     // No taking addresses of this type.
48     const SkDeferredDisplayListPriv* operator&() const;
49     SkDeferredDisplayListPriv* operator&();
50 
51     SkDeferredDisplayList* fDDL;
52 
53     friend class SkDeferredDisplayList; // to construct/copy this type.
54 };
55 
priv()56 inline SkDeferredDisplayListPriv SkDeferredDisplayList::priv() {
57     return SkDeferredDisplayListPriv(this);
58 }
59 
priv()60 inline const SkDeferredDisplayListPriv SkDeferredDisplayList::priv () const {  // NOLINT(readability-const-return-type)
61     return SkDeferredDisplayListPriv(const_cast<SkDeferredDisplayList*>(this));
62 }
63 
64 #endif
65