Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
GrMockRenderTask.h
Go to the documentation of this file.
1/*
2 * Copyright 2021 Google Inc.
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 GrMockRenderTask_DEFINED
9#define GrMockRenderTask_DEFINED
10
17
18#include <utility>
19
20class GrOpFlushState;
23struct SkIRect;
24
25class GrMockRenderTask final : public GrRenderTask {
26public:
28 // Mock tasks are never "owned" by a drawmgr in the first place.
30 }
31
32 void addTarget(sk_sp<GrSurfaceProxy> proxy) { fTargets.push_back(std::move(proxy)); }
33 void addDependency(GrRenderTask* dep) { fDependencies.push_back(dep); }
34 void addUsed(sk_sp<GrSurfaceProxy> proxy) { fUsed.push_back(std::move(proxy)); }
35
36 // Overrides.
37#ifdef SK_DEBUG
38 void visitProxies_debugOnly(const GrVisitProxyFunc&) const override { return; }
39#endif
42 bool onIsUsed(GrSurfaceProxy* proxy) const override {
43 for (const auto& entry : fUsed) {
44 if (entry.get() == proxy) {
45 return true;
46 }
47 }
48 return false;
49 }
50 bool onExecute(GrOpFlushState*) override { return true; }
51
52#if defined(GR_TEST_UTILS)
53 const char* name() const final { return "Mock"; }
54#endif
55
56private:
58};
59
60#endif
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
#define SkUNREACHABLE
Definition SkAssert.h:135
bool onExecute(GrOpFlushState *) override
void gatherProxyIntervals(GrResourceAllocator *) const override
bool onIsUsed(GrSurfaceProxy *proxy) const override
void addUsed(sk_sp< GrSurfaceProxy > proxy)
void addDependency(GrRenderTask *dep)
void addTarget(sk_sp< GrSurfaceProxy > proxy)
ExpectedOutcome onMakeClosed(GrRecordingContext *, SkIRect *) override
void setFlag(uint32_t flag)
skia_private::STArray< 1, sk_sp< GrSurfaceProxy > > fTargets
@ kDisowned_Flag
This task is disowned by its GrDrawingManager.
const char * name
Definition fuchsia.cc:50