Flutter Engine
The Flutter Engine
GrTransferFromRenderTask.h
Go to the documentation of this file.
1/*
2 * Copyright 2019 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 GrTransferFromRenderTask_DEFINED
9#define GrTransferFromRenderTask_DEFINED
10
11#include "include/core/SkRect.h"
20
21#include <cstddef>
22#include <utility>
23
24class GrOpFlushState;
27
29public:
31 const SkIRect& srcRect,
32 GrColorType surfaceColorType,
33 GrColorType dstColorType,
34 sk_sp<GrGpuBuffer> dstBuffer,
35 size_t dstOffset)
36 : GrRenderTask()
37 , fSrcProxy(std::move(srcProxy))
38 , fSrcRect(srcRect)
39 , fSurfaceColorType(surfaceColorType)
40 , fDstColorType(dstColorType)
41 , fDstBuffer(std::move(dstBuffer))
42 , fDstOffset(dstOffset) {}
43
44private:
45 bool onIsUsed(GrSurfaceProxy* proxy) const override {
46 SkASSERT(0 == this->numTargets());
47 return proxy == fSrcProxy.get();
48 }
49 void gatherProxyIntervals(GrResourceAllocator*) const override;
50
51 ExpectedOutcome onMakeClosed(GrRecordingContext*, SkIRect*) override {
53 }
54
55 bool onExecute(GrOpFlushState*) override;
56
57#if defined(GR_TEST_UTILS)
58 const char* name() const final { return "TransferFrom"; }
59#endif
60#ifdef SK_DEBUG
61 void visitProxies_debugOnly(const GrVisitProxyFunc& func) const override {
62 func(fSrcProxy.get(), skgpu::Mipmapped::kNo);
63 }
64#endif
65
66 sk_sp<GrSurfaceProxy> fSrcProxy;
67 SkIRect fSrcRect;
68 GrColorType fSurfaceColorType;
69 GrColorType fDstColorType;
70 sk_sp<GrGpuBuffer> fDstBuffer;
71 size_t fDstOffset;
72
73};
74
75#endif
76
std::function< void(GrSurfaceProxy *, skgpu::Mipmapped)> GrVisitProxyFunc
Definition: GrTypesPriv.h:943
GrColorType
Definition: GrTypesPriv.h:540
#define SkASSERT(cond)
Definition: SkAssert.h:116
int numTargets() const
Definition: GrRenderTask.h:103
GrTransferFromRenderTask(sk_sp< GrSurfaceProxy > srcProxy, const SkIRect &srcRect, GrColorType surfaceColorType, GrColorType dstColorType, sk_sp< GrGpuBuffer > dstBuffer, size_t dstOffset)
T * get() const
Definition: SkRefCnt.h:303
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
Definition: ref_ptr.h:256
Definition: SkRect.h:32