xref: /aosp_15_r20/external/skia/src/gpu/ganesh/GrDeferredDisplayListPriv.h (revision c8dee2aa9b3f27cf6c858bd81872bdeb2c07ed17)
1 /*
2  * Copyright 2023 Google LLC
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 GrDeferredDisplayListPriv_DEFINED
9 #define GrDeferredDisplayListPriv_DEFINED
10 
11 #include "include/private/chromium/GrDeferredDisplayList.h"
12 
13 /*************************************************************************************************/
14 /** Class that adds methods to GrDeferredDisplayList that are only intended for use internal to
15     Skia. This class is purely a privileged window into GrDeferredDisplayList. It should never have
16     additional data members or virtual methods. */
17 class GrDeferredDisplayListPriv {
18 public:
numRenderTasks()19     int numRenderTasks() const {
20         return fDDL->fRenderTasks.size();
21     }
22 
targetProxy()23     GrRenderTargetProxy* targetProxy() const {
24         return fDDL->fTargetProxy.get();
25     }
26 
lazyProxyData()27     const GrDeferredDisplayList::LazyProxyData* lazyProxyData() const {
28         return fDDL->fLazyProxyData.get();
29     }
30 
programData()31     const skia_private::TArray<GrRecordingContext::ProgramData>& programData() const {
32         return fDDL->programData();
33     }
34 
renderTasks()35     const skia_private::TArray<sk_sp<GrRenderTask>>& renderTasks() const {
36         return fDDL->fRenderTasks;
37     }
38 
39 private:
GrDeferredDisplayListPriv(GrDeferredDisplayList * ddl)40     explicit GrDeferredDisplayListPriv(GrDeferredDisplayList* ddl) : fDDL(ddl) {}
41     GrDeferredDisplayListPriv& operator=(const GrDeferredDisplayListPriv&) = delete;
42 
43     // No taking addresses of this type.
44     const GrDeferredDisplayListPriv* operator&() const;
45     GrDeferredDisplayListPriv* operator&();
46 
47     GrDeferredDisplayList* fDDL;
48 
49     friend class GrDeferredDisplayList; // to construct/copy this type.
50 };
51 
priv()52 inline GrDeferredDisplayListPriv GrDeferredDisplayList::priv() {
53     return GrDeferredDisplayListPriv(this);
54 }
55 
priv()56 inline const GrDeferredDisplayListPriv GrDeferredDisplayList::priv () const {  // NOLINT(readability-const-return-type)
57     return GrDeferredDisplayListPriv(const_cast<GrDeferredDisplayList*>(this));
58 }
59 
60 #endif
61