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 "SkDeferredDisplayList.h" 12 13 /** Class that adds methods to SkDeferredDisplayList that are only intended for use internal to Skia. 14 This class is purely a privileged window into SkDeferredDisplayList. It should never have 15 additional data members or virtual methods. */ 16 class SkDeferredDisplayListPriv { 17 public: numOpLists()18 int numOpLists() const { 19 #if SK_SUPPORT_GPU 20 return fDDL->fOpLists.count(); 21 #else 22 return 0; 23 #endif 24 } 25 lazyProxyData()26 const SkDeferredDisplayList::LazyProxyData* lazyProxyData() const { 27 #if SK_SUPPORT_GPU 28 return fDDL->fLazyProxyData.get(); 29 #else 30 return nullptr; 31 #endif 32 } 33 34 private: SkDeferredDisplayListPriv(SkDeferredDisplayList * ddl)35 explicit SkDeferredDisplayListPriv(SkDeferredDisplayList* ddl) : fDDL(ddl) {} 36 SkDeferredDisplayListPriv(const SkDeferredDisplayListPriv&); // unimpl 37 SkDeferredDisplayListPriv& operator=(const SkDeferredDisplayListPriv&); // unimpl 38 39 // No taking addresses of this type. 40 const SkDeferredDisplayListPriv* operator&() const; 41 SkDeferredDisplayListPriv* operator&(); 42 43 SkDeferredDisplayList* fDDL; 44 45 friend class SkDeferredDisplayList; // to construct/copy this type. 46 }; 47 priv()48inline SkDeferredDisplayListPriv SkDeferredDisplayList::priv() { 49 return SkDeferredDisplayListPriv(this); 50 } 51 priv()52inline const SkDeferredDisplayListPriv SkDeferredDisplayList::priv () const { 53 return SkDeferredDisplayListPriv(const_cast<SkDeferredDisplayList*>(this)); 54 } 55 56 #endif 57