Flutter Engine
The Flutter Engine
GrDeferredDisplayListRecorder.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 Google LLC
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 GrDeferredDisplayListRecorder_DEFINED
9#define GrDeferredDisplayListRecorder_DEFINED
10
15
18class SkCanvas;
19class SkSurface;
20
21/*
22 * This class is intended to be used as:
23 * Get a GrSurfaceCharacterization representing the intended gpu-backed destination SkSurface
24 * Create one of these (a GrDeferredDisplayListRecorder) on the stack
25 * Get the canvas and render into it
26 * Snap off and hold on to a GrDeferredDisplayList
27 * Once your app actually needs the pixels, call skgpu::ganesh::DrawDDL(GrDeferredDisplayList*)
28 *
29 * This class never accesses the GPU but performs all the cpu work it can. It
30 * is thread-safe (i.e., one can break a scene into tiles and perform their cpu-side
31 * work in parallel ahead of time).
32 */
34public:
37
39 return fCharacterization;
40 }
41
42 // The backing canvas will become invalid (and this entry point will return
43 // null) once 'detach' is called.
44 // Note: ownership of the SkCanvas is not transferred via this call.
45 SkCanvas* getCanvas();
46
48
49private:
52
53 bool init();
54
55 const GrSurfaceCharacterization fCharacterization;
57 sk_sp<GrRenderTargetProxy> fTargetProxy;
59 sk_sp<SkSurface> fSurface;
60};
61
62#endif
#define SK_API
Definition: SkAPI.h:35
const Context & fContext
const GrSurfaceCharacterization & characterization() const
static bool init()