Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Static Public Member Functions | Private Member Functions | List of all members
GrCopyRenderTask Class Referencefinal

#include <GrCopyRenderTask.h>

Inheritance diagram for GrCopyRenderTask:
GrRenderTask SkRefCnt SkRefCntBase

Static Public Member Functions

static sk_sp< GrRenderTaskMake (GrDrawingManager *, sk_sp< GrSurfaceProxy > dst, SkIRect dstRect, sk_sp< GrSurfaceProxy > src, SkIRect srcRect, GrSamplerState::Filter filter, GrSurfaceOrigin)
 

Private Member Functions

void onMakeSkippable () override
 
bool onIsUsed (GrSurfaceProxy *proxy) const override
 
void gatherProxyIntervals (GrResourceAllocator *) const override
 
ExpectedOutcome onMakeClosed (GrRecordingContext *, SkIRect *targetUpdateBounds) override
 
bool onExecute (GrOpFlushState *) override
 

Additional Inherited Members

- Public Member Functions inherited from GrRenderTask
 GrRenderTask ()
 
 SkDEBUGCODE (~GrRenderTask() override;) void makeClosed(GrRecordingContext *)
 
void prePrepare (GrRecordingContext *context)
 
void prepare (GrOpFlushState *flushState)
 
bool execute (GrOpFlushState *flushState)
 
virtual bool requiresExplicitCleanup () const
 
virtual void endFlush (GrDrawingManager *)
 
virtual void disown (GrDrawingManager *)
 
bool isClosed () const
 
void makeSkippable ()
 
bool isSkippable () const
 
bool blocksReordering () const
 
void addDependency (GrDrawingManager *, GrSurfaceProxy *dependedOn, skgpu::Mipmapped, GrTextureResolveManager, const GrCaps &caps)
 
void addDependenciesFromOtherTask (GrRenderTask *otherTask)
 
SkSpan< GrRenderTask * > dependencies ()
 
SkSpan< GrRenderTask * > dependents ()
 
void replaceDependency (const GrRenderTask *toReplace, GrRenderTask *replaceWith)
 
void replaceDependent (const GrRenderTask *toReplace, GrRenderTask *replaceWith)
 
bool dependsOn (const GrRenderTask *dependedOn) const
 
uint32_t uniqueID () const
 
int numTargets () const
 
GrSurfaceProxytarget (int i) const
 
virtual skgpu::ganesh::OpsTaskasOpsTask ()
 
bool isUsed (GrSurfaceProxy *proxy) const
 
bool isInstantiated () const
 
 SK_DECLARE_INTERNAL_LLIST_INTERFACE (GrRenderTask)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
- Protected Types inherited from GrRenderTask
enum class  ExpectedOutcome : bool { kTargetUnchanged , kTargetDirty }
 
enum  Flags {
  kClosed_Flag = 0x01 , kDisowned_Flag = 0x02 , kSkippable_Flag = 0x04 , kAtlas_Flag = 0x08 ,
  kBlocksReordering_Flag = 0x10 , kWasOutput_Flag = 0x20 , kTempMark_Flag = 0x40
}
 
- Protected Member Functions inherited from GrRenderTask
 SkDEBUGCODE (bool deferredProxiesAreInstantiated() const ;) void addTarget(GrDrawingManager *
 
void addTarget (GrDrawingManager *dm, const GrSurfaceProxyView &view)
 
void setFlag (uint32_t flag)
 
void resetFlag (uint32_t flag)
 
bool isSetFlag (uint32_t flag) const
 
void setIndex (uint32_t index)
 
uint32_t getIndex () const
 
- Protected Attributes inherited from GrRenderTask
 sk_sp< GrSurfaceProxy >
 
skia_private::STArray< 1, sk_sp< GrSurfaceProxy > > fTargets
 
skia_private::TArray< GrTextureProxy *, true > fDeferredProxies
 

Detailed Description

Definition at line 14 of file GrCopyRenderTask.h.

Member Function Documentation

◆ gatherProxyIntervals()

void GrCopyRenderTask::gatherProxyIntervals ( GrResourceAllocator alloc) const
overrideprivatevirtual

Implements GrRenderTask.

Definition at line 53 of file GrCopyRenderTask.cpp.

53 {
54 if (!fSrc) {
55 alloc->incOps();
56 return;
57 }
58 // This renderTask doesn't have "normal" ops. In this case we still need to add an interval (so
59 // fEndOfOpsTaskOpIndices will remain in sync), so we create a fake op# to capture the fact that
60 // we read fSrcView and copy to target view.
61 alloc->addInterval(fSrc.get(), alloc->curOp(), alloc->curOp(),
64 alloc->addInterval(this->target(0), alloc->curOp(), alloc->curOp(),
67 alloc->incOps();
68}
void addInterval(GrSurfaceProxy *, unsigned int start, unsigned int end, ActualUse actualUse, AllowRecycling SkDEBUGCODE(, bool isDirectDstRead=false))
unsigned int curOp() const
T * get() const
Definition SkRefCnt.h:303
uint32_t * target

◆ Make()

sk_sp< GrRenderTask > GrCopyRenderTask::Make ( GrDrawingManager drawingMgr,
sk_sp< GrSurfaceProxy dst,
SkIRect  dstRect,
sk_sp< GrSurfaceProxy src,
SkIRect  srcRect,
GrSamplerState::Filter  filter,
GrSurfaceOrigin  origin 
)
static

Copies pixels from srcRect in src to dstRect in dst. srcRect and dstRect must both be contained in their respective surface dimensions; they do not have to have the same size if the GPU supports scaling and filtering while copying. The src/dst share a common origin.

Definition at line 15 of file GrCopyRenderTask.cpp.

21 {
22 SkASSERT(src);
23 SkASSERT(dst);
24
25 // canCopySurface() should have returned true, guaranteeing this property.
26 SkASSERT(SkIRect::MakeSize(dst->dimensions()).contains(dstRect));
27 SkASSERT(SkIRect::MakeSize(src->dimensions()).contains(srcRect));
28
29 return sk_sp<GrRenderTask>(new GrCopyRenderTask(drawingMgr,
30 std::move(dst),
31 dstRect,
32 std::move(src),
33 srcRect,
34 filter,
35 origin));
36}
#define SkASSERT(cond)
Definition SkAssert.h:116
dst
Definition cp.py:12
static constexpr SkIRect MakeSize(const SkISize &size)
Definition SkRect.h:66
bool contains(int32_t x, int32_t y) const
Definition SkRect.h:463

◆ onExecute()

bool GrCopyRenderTask::onExecute ( GrOpFlushState flushState)
overrideprivatevirtual

Implements GrRenderTask.

Definition at line 81 of file GrCopyRenderTask.cpp.

81 {
82 if (!fSrc) {
83 // Did nothing, just like we're supposed to.
84 return true;
85 }
86 GrSurfaceProxy* dstProxy = this->target(0);
87 if (!fSrc->isInstantiated() || !dstProxy->isInstantiated()) {
88 return false;
89 }
90 GrSurface* srcSurface = fSrc->peekSurface();
91 GrSurface* dstSurface = dstProxy->peekSurface();
92 SkIRect srcRect = GrNativeRect::MakeIRectRelativeTo(fOrigin, srcSurface->height(), fSrcRect);
93 SkIRect dstRect = GrNativeRect::MakeIRectRelativeTo(fOrigin, dstSurface->height(), fDstRect);
94 return flushState->gpu()->copySurface(dstSurface, dstRect, srcSurface, srcRect, fFilter);
95}
bool copySurface(GrSurface *dst, const SkIRect &dstRect, GrSurface *src, const SkIRect &srcRect, GrSamplerState::Filter filter)
Definition GrGpu.cpp:410
GrSurface * peekSurface() const
bool isInstantiated() const
int height() const
Definition GrSurface.h:37
static SkIRect MakeIRectRelativeTo(GrSurfaceOrigin origin, int rtHeight, SkIRect devRect)

◆ onIsUsed()

bool GrCopyRenderTask::onIsUsed ( GrSurfaceProxy proxy) const
inlineoverrideprivatevirtual

Implements GrRenderTask.

Definition at line 39 of file GrCopyRenderTask.h.

39{ return proxy == fSrc.get(); }

◆ onMakeClosed()

GrRenderTask::ExpectedOutcome GrCopyRenderTask::onMakeClosed ( GrRecordingContext ,
SkIRect targetUpdateBounds 
)
overrideprivatevirtual

Implements GrRenderTask.

Definition at line 70 of file GrCopyRenderTask.cpp.

71 {
72 // We don't expect to be marked skippable before being closed.
73 SkASSERT(fSrc);
74 *targetUpdateBounds = GrNativeRect::MakeIRectRelativeTo(
75 fOrigin,
76 this->target(0)->height(),
77 fDstRect);
79}
int32_t height

◆ onMakeSkippable()

void GrCopyRenderTask::onMakeSkippable ( )
inlineoverrideprivatevirtual

Reimplemented from GrRenderTask.

Definition at line 38 of file GrCopyRenderTask.h.

38{ fSrc.reset(); }
void reset(T *ptr=nullptr)
Definition SkRefCnt.h:310

The documentation for this class was generated from the following files: