blob: 9de091f920b732f3a71ac60dfe04218ac9293924 [file] [log] [blame]
Brian Salomonbe1084b2021-01-26 13:29:30 -05001/*
2 * Copyright 2021 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 GrWritePixelsTask_DEFINED
9#define GrWritePixelsTask_DEFINED
10
11#include "src/gpu/GrRenderTask.h"
12
13class GrWritePixelsTask final : public GrRenderTask {
14public:
15 static sk_sp<GrRenderTask> Make(GrDrawingManager*,
16 sk_sp<GrSurfaceProxy>,
17 SkIRect,
18 GrColorType srcColorType,
19 GrColorType dstColorType,
20 const GrMipLevel[],
21 int levelCount,
22 sk_sp<SkData> pixelStorage);
23
24private:
25 GrWritePixelsTask(GrDrawingManager*,
26 sk_sp<GrSurfaceProxy> dst,
27 SkIRect,
28 GrColorType srcColorType,
29 GrColorType dstColorType,
30 const GrMipLevel[],
31 int levelCount,
32 sk_sp<SkData> pixelStorage);
33
34 bool onIsUsed(GrSurfaceProxy* proxy) const override { return false; }
35 // If instantiation failed, at flush time we simply will skip doing the write.
36 void handleInternalAllocationFailure() override {}
37 void gatherProxyIntervals(GrResourceAllocator*) const override;
38 ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect* targetUpdateBounds) override;
39 bool onExecute(GrOpFlushState*) override;
40
41#if GR_TEST_UTILS
42 const char* name() const final { return "WritePixels"; }
43#endif
44#ifdef SK_DEBUG
45 void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {}
46#endif
47
48 SkIRect fRect;
49 GrColorType fSrcColorType;
50 GrColorType fDstColorType;
51 SkAutoSTArray<16, GrMipLevel> fLevels;
52 sk_sp<SkData> fStorage;
53};
54
55#endif
56