SkDeferredDisplayListPriv.h 1.6 KB

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