Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrDeferredDisplayList.cpp
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
9
16
17#include <utility>
18
19GrDeferredDisplayList::GrDeferredDisplayList(const GrSurfaceCharacterization& characterization,
21 sk_sp<LazyProxyData> lazyProxyData)
22 : fCharacterization(characterization)
23 , fArenas(true)
24 , fTargetProxy(std::move(targetProxy))
25 , fLazyProxyData(std::move(lazyProxyData)) {
26 SkASSERT(fTargetProxy->isDDLTarget());
27}
28
30#if defined(SK_DEBUG)
31 for (auto& renderTask : fRenderTasks) {
32 SkASSERT(renderTask->unique());
33 }
34#endif
35}
36
39 : fDContext(dContext)
40 , fProgramData(ddl->programData())
41 , fIndex(0) {
42}
43
45
47 if (!fDContext || fIndex < 0 || fIndex >= (int) fProgramData.size()) {
48 return false;
49 }
50
51 return fDContext->priv().compile(fProgramData[fIndex].desc(), fProgramData[fIndex].info());
52}
53
55 return fIndex >= (int) fProgramData.size();
56}
57
61
62namespace skgpu::ganesh {
63
65 if (!surface || !ddl) {
66 return false;
67 }
68 auto sb = asSB(surface);
69 if (!sb->isGaneshBacked()) {
70 return false;
71 }
72 auto gs = static_cast<SkSurface_Ganesh*>(surface);
73 return gs->draw(ddl);
74}
75
79
80}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition DM.cpp:213
#define SkASSERT(cond)
Definition SkAssert.h:116
static SkSurface_Base * asSB(SkSurface *surface)
GrDirectContext * fDContext
Type::kYUV Type::kRGBA() int(0.7 *637)
ProgramIterator(GrDirectContext *, GrDeferredDisplayList *)
bool compile(const GrProgramDesc &, const GrProgramInfo &)
GrDirectContextPriv priv()
bool draw(sk_sp< const GrDeferredDisplayList >)
int size() const
Definition SkTArray.h:416
VkSurfaceKHR surface
Definition main.cc:49
SK_API bool DrawDDL(SkSurface *, sk_sp< const GrDeferredDisplayList > ddl)
Definition ref_ptr.h:256