• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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 GrBufferUpdateRenderTask_DEFINED
9 #define GrBufferUpdateRenderTask_DEFINED
10 
11 #include "src/gpu/ganesh/GrRenderTask.h"
12 
13 class GrGpuBuffer;
14 
15 class GrBufferUpdateRenderTask final : public GrRenderTask {
16 public:
17     static sk_sp<GrRenderTask> Make(sk_sp<SkData> src, sk_sp<GrGpuBuffer> dst, size_t dstOffset);
18 
19     ~GrBufferUpdateRenderTask() override;
20 
21 private:
22     GrBufferUpdateRenderTask(sk_sp<SkData> src, sk_sp<GrGpuBuffer> dst, size_t dstOffset);
23 
onIsUsed(GrSurfaceProxy * proxy)24     bool onIsUsed(GrSurfaceProxy* proxy) const override { return false; }
gatherProxyIntervals(GrResourceAllocator *)25     void gatherProxyIntervals(GrResourceAllocator*) const override {}  // no proxies
onMakeClosed(GrRecordingContext *,SkIRect * targetUpdateBounds)26     ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect* targetUpdateBounds) override {
27         return ExpectedOutcome::kTargetUnchanged;  // no target
28     }
29     bool onExecute(GrOpFlushState*) override;
30 
31 #if GR_TEST_UTILS
name()32     const char* name() const final { return "BufferUpdate"; }
33 #endif
34 #ifdef SK_DEBUG
visitProxies_debugOnly(const GrVisitProxyFunc &)35     void visitProxies_debugOnly(const GrVisitProxyFunc&) const override {}
36 #endif
37 
38     sk_sp<SkData>      fSrc;
39     sk_sp<GrGpuBuffer> fDst;
40     size_t             fDstOffset;
41 };
42 
43 #endif
44