blob: a2a49ae135eb9153bb99baa4ce98fdc5d8a23f30 [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; }
Brian Salomonbe1084b2021-01-26 13:29:30 -050035 void gatherProxyIntervals(GrResourceAllocator*) const override;
36 ExpectedOutcome onMakeClosed(const GrCaps&, SkIRect* targetUpdateBounds) override;
37 bool onExecute(GrOpFlushState*) override;
38
39#if GR_TEST_UTILS
40 const char* name() const final { return "WritePixels"; }
41#endif
42#ifdef SK_DEBUG
43 void visitProxies_debugOnly(const GrOp::VisitProxyFunc& fn) const override {}
44#endif
45
46 SkIRect fRect;
47 GrColorType fSrcColorType;
48 GrColorType fDstColorType;
49 SkAutoSTArray<16, GrMipLevel> fLevels;
50 sk_sp<SkData> fStorage;
51};
52
53#endif
54