2017-08-30 16:06:35 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2017 Google Inc.
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef SkDeferredDisplayList_DEFINED
|
|
|
|
#define SkDeferredDisplayList_DEFINED
|
|
|
|
|
|
|
|
#include "SkSurfaceCharacterization.h"
|
|
|
|
|
2018-02-01 14:10:04 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2018-05-31 16:43:27 +00:00
|
|
|
#include <map>
|
|
|
|
#include "GrCCPerOpListPaths.h"
|
2018-02-01 14:10:04 +00:00
|
|
|
#include "GrOpList.h"
|
|
|
|
#endif
|
|
|
|
|
2017-11-30 13:46:03 +00:00
|
|
|
class SkSurface;
|
2017-08-30 16:06:35 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This class contains pre-processed gpu operations that can be replayed into
|
|
|
|
* an SkSurface via draw(SkDeferredDisplayList*).
|
|
|
|
*
|
|
|
|
* TODO: we probably need to expose this class so users can query it for memory usage.
|
|
|
|
*/
|
2018-05-31 16:43:27 +00:00
|
|
|
class SK_API SkDeferredDisplayList {
|
2017-08-30 16:06:35 +00:00
|
|
|
public:
|
2018-02-01 14:10:04 +00:00
|
|
|
|
|
|
|
#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>);
|
2018-05-31 16:43:27 +00:00
|
|
|
~SkDeferredDisplayList();
|
2018-02-01 14:10:04 +00:00
|
|
|
|
2017-08-30 16:06:35 +00:00
|
|
|
const SkSurfaceCharacterization& characterization() const {
|
|
|
|
return fCharacterization;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
2018-02-01 14:10:04 +00:00
|
|
|
friend class GrDrawingManager; // for access to 'fOpLists' and 'fLazyProxyData'
|
|
|
|
friend class SkDeferredDisplayListRecorder; // for access to 'fLazyProxyData'
|
|
|
|
|
2017-11-30 16:22:14 +00:00
|
|
|
const SkSurfaceCharacterization fCharacterization;
|
2017-08-30 16:06:35 +00:00
|
|
|
|
2018-02-01 14:10:04 +00:00
|
|
|
#if SK_SUPPORT_GPU
|
2018-05-31 16:43:27 +00:00
|
|
|
// This needs to match the same type in GrCoverageCountingPathRenderer.h
|
|
|
|
using PendingPathsMap = std::map<uint32_t, sk_sp<GrCCPerOpListPaths>>;
|
|
|
|
|
2018-02-01 14:10:04 +00:00
|
|
|
SkTArray<sk_sp<GrOpList>> fOpLists;
|
2018-05-31 16:43:27 +00:00
|
|
|
PendingPathsMap fPendingPaths; // This is the path data from CCPR.
|
2018-02-01 14:10:04 +00:00
|
|
|
#endif
|
|
|
|
sk_sp<LazyProxyData> fLazyProxyData;
|
2017-08-30 16:06:35 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|