Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Private Member Functions | Friends | List of all members
skgpu::ganesh::ClearOp Class Referencefinal

#include <ClearOp.h>

Inheritance diagram for skgpu::ganesh::ClearOp:
GrOp SkNoncopyable

Public Member Functions

const char * name () const override
 
const std::array< float, 4 > & color () const
 
bool stencilInsideMask () const
 
- Public Member Functions inherited from GrOp
virtual ~GrOp ()=default
 
virtual void visitProxies (const GrVisitProxyFunc &) const
 
CombineResult combineIfPossible (GrOp *that, SkArenaAlloc *alloc, const GrCaps &caps)
 
const SkRectbounds () const
 
void setClippedBounds (const SkRect &clippedBounds)
 
bool hasAABloat () const
 
bool hasZeroArea () const
 
void operator delete (void *p)
 
template<typename T >
const Tcast () const
 
template<typename T >
Tcast ()
 
uint32_t classID () const
 
uint32_t uniqueID () const
 
void prePrepare (GrRecordingContext *context, const GrSurfaceProxyView &dstView, GrAppliedClip *clip, const GrDstProxyView &dstProxyView, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
 
void prepare (GrOpFlushState *state)
 
void execute (GrOpFlushState *state, const SkRect &chainBounds)
 
void chainConcat (GrOp::Owner)
 
bool isChainHead () const
 
bool isChainTail () const
 
GrOpnextInChain () const
 
GrOpprevInChain () const
 
GrOp::Owner cutChain ()
 
void setBounds (const SkRect &newBounds, HasAABloat aabloat, IsHairline zeroArea)
 
void setTransformedBounds (const SkRect &srcBounds, const SkMatrix &m, HasAABloat aabloat, IsHairline zeroArea)
 
void makeFullScreen (GrSurfaceProxy *proxy)
 

Static Public Member Functions

static DEFINE_OP_CLASS_ID GrOp::Owner MakeColor (GrRecordingContext *context, const GrScissorState &scissor, std::array< float, 4 > color)
 
static GrOp::Owner MakeStencilClip (GrRecordingContext *context, const GrScissorState &scissor, bool insideMask)
 
- Static Public Member Functions inherited from GrOp
template<typename Op , typename... Args>
static Owner Make (GrRecordingContext *context, Args &&... args)
 
template<typename Op , typename... Args>
static Owner MakeWithProcessorSet (GrRecordingContext *context, const SkPMColor4f &color, GrPaint &&paint, Args &&... args)
 
template<typename Op , typename... Args>
static Owner MakeWithExtraMemory (GrRecordingContext *context, size_t extraSize, Args &&... args)
 
static uint32_t GenOpClassID ()
 

Private Member Functions

CombineResult onCombineIfPossible (GrOp *t, SkArenaAlloc *, const GrCaps &caps) override
 
void onPrePrepare (GrRecordingContext *, const GrSurfaceProxyView &writeView, GrAppliedClip *, const GrDstProxyView &, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp) override
 
void onPrepare (GrOpFlushState *) override
 
void onExecute (GrOpFlushState *state, const SkRect &chainBounds) override
 

Friends

class GrOp
 

Additional Inherited Members

- Public Types inherited from GrOp
enum class  CombineResult { kMerged , kMayChain , kCannotCombine }
 
enum class  HasAABloat : bool { kNo = false , kYes = true }
 
enum class  IsHairline : bool { kNo = false , kYes = true }
 
using Owner = std::unique_ptr< GrOp >
 

Detailed Description

Definition at line 20 of file ClearOp.h.

Member Function Documentation

◆ color()

const std::array< float, 4 > & skgpu::ganesh::ClearOp::color ( ) const
inline

Definition at line 35 of file ClearOp.h.

35{ return fColor; }

◆ MakeColor()

GrOp::Owner skgpu::ganesh::ClearOp::MakeColor ( GrRecordingContext context,
const GrScissorState scissor,
std::array< float, 4 >  color 
)
static

Definition at line 27 of file ClearOp.cpp.

29 {
30 return GrOp::Make<ClearOp>(context, Buffer::kColor, scissor, color, false);
31}
const std::array< float, 4 > & color() const
Definition ClearOp.h:35

◆ MakeStencilClip()

GrOp::Owner skgpu::ganesh::ClearOp::MakeStencilClip ( GrRecordingContext context,
const GrScissorState scissor,
bool  insideMask 
)
static

Definition at line 33 of file ClearOp.cpp.

35 {
36 return GrOp::Make<ClearOp>(context,
37 Buffer::kStencilClip,
38 scissor,
39 std::array<float, 4>(),
40 insideMask);
41}

◆ name()

const char * skgpu::ganesh::ClearOp::name ( ) const
inlineoverridevirtual

Implements GrOp.

Definition at line 33 of file ClearOp.h.

33{ return "Clear"; }

◆ onCombineIfPossible()

GrOp::CombineResult skgpu::ganesh::ClearOp::onCombineIfPossible ( GrOp t,
SkArenaAlloc ,
const GrCaps caps 
)
overrideprivatevirtual

Reimplemented from GrOp.

Definition at line 55 of file ClearOp.cpp.

55 {
56 auto other = t->cast<ClearOp>();
57
58 if (other->fBuffer == fBuffer) {
59 // This could be much more complicated. Currently we look at cases where the new clear
60 // contains the old clear, or when the new clear is a subset of the old clear and they clear
61 // to the same value (color or stencil mask depending on target).
62 if (contains_scissor(other->fScissor, fScissor)) {
63 fScissor = other->fScissor;
64 fColor = other->fColor;
65 fStencilInsideMask = other->fStencilInsideMask;
67 } else if (other->fColor == fColor && other->fStencilInsideMask == fStencilInsideMask &&
68 contains_scissor(fScissor, other->fScissor)) {
70 }
71 } else if (other->fScissor == fScissor) {
72 // When the scissors are the exact same but the buffers are different, we can combine and
73 // clear both stencil and clear together in onExecute().
74 if (other->fBuffer & Buffer::kColor) {
75 fColor = other->fColor;
76 }
77 if (other->fBuffer & Buffer::kStencilClip) {
78 fStencilInsideMask = other->fStencilInsideMask;
79 }
80 fBuffer = Buffer::kBoth;
82 }
84}
const T & cast() const
Definition GrOp.h:148

◆ onExecute()

void skgpu::ganesh::ClearOp::onExecute ( GrOpFlushState state,
const SkRect chainBounds 
)
overrideprivatevirtual

Implements GrOp.

Definition at line 86 of file ClearOp.cpp.

86 {
87 SkASSERT(state->opsRenderPass());
88 if (fBuffer & Buffer::kColor) {
89 state->opsRenderPass()->clear(fScissor, fColor);
90 }
91
92 if (fBuffer & Buffer::kStencilClip) {
93 state->opsRenderPass()->clearStencilClip(fScissor, fStencilInsideMask);
94 }
95}
#define SkASSERT(cond)
Definition SkAssert.h:116
AtkStateType state

◆ onPrepare()

void skgpu::ganesh::ClearOp::onPrepare ( GrOpFlushState )
inlineoverrideprivatevirtual

Implements GrOp.

Definition at line 59 of file ClearOp.h.

59{}

◆ onPrePrepare()

void skgpu::ganesh::ClearOp::onPrePrepare ( GrRecordingContext ,
const GrSurfaceProxyView writeView,
GrAppliedClip ,
const GrDstProxyView ,
GrXferBarrierFlags  renderPassXferBarriers,
GrLoadOp  colorLoadOp 
)
inlineoverrideprivatevirtual

Implements GrOp.

Definition at line 55 of file ClearOp.h.

57 {}

◆ stencilInsideMask()

bool skgpu::ganesh::ClearOp::stencilInsideMask ( ) const
inline

Definition at line 36 of file ClearOp.h.

36{ return fStencilInsideMask; }

Friends And Related Symbol Documentation

◆ GrOp

friend class GrOp
friend

Definition at line 38 of file ClearOp.h.


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