• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
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 skgpu_CopyTask_DEFINED
9 #define skgpu_CopyTask_DEFINED
10 
11 #include "experimental/graphite/src/Task.h"
12 
13 #include "include/core/SkRect.h"
14 
15 namespace skgpu {
16 
17 class Buffer;
18 class CommandBuffer;
19 class Texture;
20 
21 class CopyTextureToBufferTask final : public Task {
22 public:
23     static sk_sp<CopyTextureToBufferTask> Make(sk_sp<Texture>,
24                                                SkIRect srcRect,
25                                                sk_sp<Buffer>,
26                                                size_t bufferOffset,
27                                                size_t bufferRowBytes);
28 
29     ~CopyTextureToBufferTask() override;
30 
31     void addCommands(ResourceProvider*, CommandBuffer*) override;
32 
33 private:
34     CopyTextureToBufferTask(sk_sp<Texture>,
35                             SkIRect srcRect,
36                             sk_sp<Buffer>,
37                             size_t bufferOffset,
38                             size_t bufferRowBytes);
39 
40     sk_sp<Texture> fTexture;
41     SkIRect fSrcRect;
42     sk_sp<Buffer> fBuffer;
43     size_t fBufferOffset;
44     size_t fBufferRowBytes;
45 };
46 
47 } // namespace skgpu
48 
49 #endif // skgpu_CopyTask_DEFINED
50