aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/private/SkDeferredDisplayList.h
diff options
context:
space:
mode:
authorGravatar Robert Phillips <robertphillips@google.com>2018-02-01 09:10:04 -0500
committerGravatar Skia Commit-Bot <skia-commit-bot@chromium.org>2018-02-01 15:00:53 +0000
commit620003692923dc6c6df5a1b66288988b6783a69f (patch)
tree5010067f4d26fb23f28964e74b5e37c38e3dddc3 /include/private/SkDeferredDisplayList.h
parent5f9ee7cc53d28c8ff2d000436bfee195c493ccdf (diff)
Implement GPU/OpList DDLs
This relies on https://skia-review.googlesource.com/c/skia/+/102101 (Add SkSurface_Gpu::MakeWrappedRenderTarget method) landing first TBR=bsalomon@google.com Change-Id: I4d2d66af5800407f638ef32d7b19ce49084bd4e4 Reviewed-on: https://skia-review.googlesource.com/102263 Commit-Queue: Robert Phillips <robertphillips@google.com> Reviewed-by: Greg Daniel <egdaniel@google.com>
Diffstat (limited to 'include/private/SkDeferredDisplayList.h')
-rw-r--r--include/private/SkDeferredDisplayList.h54
1 files changed, 46 insertions, 8 deletions
diff --git a/include/private/SkDeferredDisplayList.h b/include/private/SkDeferredDisplayList.h
index 392a952a1d..a3517bb6a0 100644
--- a/include/private/SkDeferredDisplayList.h
+++ b/include/private/SkDeferredDisplayList.h
@@ -10,7 +10,14 @@
#include "SkSurfaceCharacterization.h"
-class SkImage; // TODO: rm this since it is just for the temporary placeholder implementation
+#if SK_SUPPORT_GPU
+#include "GrOpList.h"
+#endif
+
+#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
+class SkImage; // DDL TODO: rm this since it is just for the temporary placeholder implementation
+#endif
+
class SkSurface;
/*
@@ -21,24 +28,55 @@ class SkSurface;
*/
class SkDeferredDisplayList {
public:
- SkDeferredDisplayList(const SkSurfaceCharacterization& characterization,
- sk_sp<SkImage> image) // TODO rm this parameter
+
+#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
+ SkDeferredDisplayList(const SkSurfaceCharacterization& characterization, sk_sp<SkImage> image)
: fCharacterization(characterization)
, fImage(std::move(image)) {
}
+ // DDL TODO: remove this. It is just scaffolding to get something up & running
+ bool draw(SkSurface*) const;
+#endif
+
+#if SK_SUPPORT_GPU
+ // This object is the source from which the lazy proxy backing the DDL will pull its backing
+ // texture when the DDL is replayed. It has to be separately ref counted bc the lazy proxy
+ // can outlive the DDL.
+ class LazyProxyData : public SkRefCnt {
+ public:
+ // Upon being replayed - this field will be filled in (by the DrawingManager) with the proxy
+ // backing the destination SkSurface. Note that, since there is no good place to clear it
+ // it can become a dangling pointer.
+ GrRenderTargetProxy* fReplayDest = nullptr;
+ };
+#else
+ class LazyProxyData : public SkRefCnt {};
+#endif
+
+ SkDeferredDisplayList(const SkSurfaceCharacterization& characterization,
+ sk_sp<LazyProxyData>);
+
const SkSurfaceCharacterization& characterization() const {
return fCharacterization;
}
- // TODO: remove this. It is just scaffolding to get something up & running
- bool draw(SkSurface*) const;
-
private:
+ friend class GrDrawingManager; // for access to 'fOpLists' and 'fLazyProxyData'
+ friend class SkDeferredDisplayListRecorder; // for access to 'fLazyProxyData'
+
const SkSurfaceCharacterization fCharacterization;
- // TODO: actually store the GPU opLists
- sk_sp<SkImage> fImage;
+#ifdef SK_RASTER_RECORDER_IMPLEMENTATION
+ sk_sp<SkImage> fImage;
+#else
+
+#if SK_SUPPORT_GPU
+ SkTArray<sk_sp<GrOpList>> fOpLists;
+#endif
+ sk_sp<LazyProxyData> fLazyProxyData;
+
+#endif
};
#endif