Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
GrDeferredDisplayListRecorder Class Reference

#include <GrDeferredDisplayListRecorder.h>

Public Member Functions

 GrDeferredDisplayListRecorder (const GrSurfaceCharacterization &)
 
 ~GrDeferredDisplayListRecorder ()
 
const GrSurfaceCharacterizationcharacterization () const
 
SkCanvasgetCanvas ()
 
sk_sp< GrDeferredDisplayListdetach ()
 

Detailed Description

Definition at line 33 of file GrDeferredDisplayListRecorder.h.

Constructor & Destructor Documentation

◆ GrDeferredDisplayListRecorder()

GrDeferredDisplayListRecorder::GrDeferredDisplayListRecorder ( const GrSurfaceCharacterization c)

Definition at line 35 of file GrDeferredDisplayListRecorder.cpp.

36 : fCharacterization(c) {
37 if (fCharacterization.isValid()) {
38 fContext = GrRecordingContextPriv::MakeDDL(fCharacterization.refContextInfo());
39 }
40}
static sk_sp< GrRecordingContext > MakeDDL(sk_sp< GrContextThreadSafeProxy >)
sk_sp< GrContextThreadSafeProxy > refContextInfo() const

◆ ~GrDeferredDisplayListRecorder()

GrDeferredDisplayListRecorder::~GrDeferredDisplayListRecorder ( )

Definition at line 42 of file GrDeferredDisplayListRecorder.cpp.

42 {
43 if (fContext) {
44 auto proxyProvider = fContext->priv().proxyProvider();
45
46 // This allows the uniquely keyed proxies to keep their keys but removes their back
47 // pointer to the about-to-be-deleted proxy provider. The proxies will use their
48 // unique key to reattach to cached versions of themselves or to appropriately tag new
49 // resources (if a cached version was not found). This system operates independent of
50 // the replaying context's proxy provider (i.e., these uniquely keyed proxies will not
51 // appear in the replaying proxy providers uniquely keyed proxy map). This should be fine
52 // since no one else should be trying to reconnect to the orphaned proxies and orphaned
53 // proxies from different DDLs that share the same key should simply reconnect to the
54 // same cached resource.
55 proxyProvider->orphanAllUniqueKeys();
56 }
57}
GrProxyProvider * proxyProvider()
GrRecordingContextPriv priv()

Member Function Documentation

◆ characterization()

const GrSurfaceCharacterization & GrDeferredDisplayListRecorder::characterization ( ) const
inline

Definition at line 38 of file GrDeferredDisplayListRecorder.h.

38 {
39 return fCharacterization;
40 }

◆ detach()

sk_sp< GrDeferredDisplayList > GrDeferredDisplayListRecorder::detach ( )

Definition at line 184 of file GrDeferredDisplayListRecorder.cpp.

184 {
185 if (!fContext || !fTargetProxy) {
186 return nullptr;
187 }
188
189 if (fSurface) {
190 SkCanvas* canvas = fSurface->getCanvas();
191
192 canvas->restoreToCount(0);
193 }
194
195 auto ddl = sk_sp<GrDeferredDisplayList>(new GrDeferredDisplayList(fCharacterization,
196 std::move(fTargetProxy),
197 std::move(fLazyProxyData)));
198
199 fContext->priv().moveRenderTasksToDDL(ddl.get());
200
201 // We want a new lazy proxy target for each recorded DDL so force the (lazy proxy-backed)
202 // SkSurface to be regenerated for each DDL.
203 fSurface = nullptr;
204 return ddl;
205}
void moveRenderTasksToDDL(GrDeferredDisplayList *)
void restoreToCount(int saveCount)
Definition SkCanvas.cpp:482
SkCanvas * getCanvas()
Definition SkSurface.cpp:82

◆ getCanvas()

SkCanvas * GrDeferredDisplayListRecorder::getCanvas ( )

Definition at line 172 of file GrDeferredDisplayListRecorder.cpp.

172 {
173 if (!fContext) {
174 return nullptr;
175 }
176
177 if (!fSurface && !this->init()) {
178 return nullptr;
179 }
180
181 return fSurface->getCanvas();
182}

The documentation for this class was generated from the following files: