Flutter Engine
The Flutter Engine
Classes | Public Member Functions | Static Public Member Functions | List of all members
CircularRRectOp Class Referencefinal
Inheritance diagram for CircularRRectOp:
GrMeshDrawOp GrDrawOp GrOp SkNoncopyable

Public Member Functions

 CircularRRectOp (GrProcessorSet *processorSet, const SkPMColor4f &color, const SkMatrix &viewMatrix, const SkRect &devRect, float devRadius, float devStrokeWidth, bool strokeOnly)
 
const char * name () const override
 
void visitProxies (const GrVisitProxyFunc &func) const override
 
GrProcessorSet::Analysis finalize (const GrCaps &caps, const GrAppliedClip *clip, GrClampType clampType) override
 
FixedFunctionFlags fixedFunctionFlags () const override
 
- Public Member Functions inherited from GrDrawOp
 GrDrawOp (uint32_t classID)
 
virtual bool usesMSAA () const
 
virtual ClipResult clipToShape (skgpu::ganesh::SurfaceDrawContext *, SkClipOp, const SkMatrix &, const GrShape &, GrAA)
 
virtual GrProcessorSet::Analysis finalize (const GrCaps &, const GrAppliedClip *, GrClampType)=0
 
virtual bool usesStencil () const
 
- Public Member Functions inherited from GrOp
virtual ~GrOp ()=default
 
virtual const char * name () const =0
 
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 Make (GrRecordingContext *context, GrPaint &&paint, const SkMatrix &viewMatrix, const SkRect &devRect, float devRadius, float devStrokeWidth, bool strokeOnly)
 
- Static Public Member Functions inherited from GrMeshDrawOp
static bool CanUpgradeAAOnMerge (GrAAType aa1, GrAAType aa2)
 
- 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 ()
 

Additional Inherited Members

- Public Types inherited from GrDrawOp
enum class  ClipResult { kFail , kClippedGeometrically , kClippedInShader , kClippedOut }
 
- 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 >
 
- Protected Types inherited from GrDrawOp
enum class  FixedFunctionFlags : uint32_t { kNone = 0x0 , kUsesHWAA = 0x1 , kUsesStencil = 0x2 }
 
- Protected Member Functions inherited from GrMeshDrawOp
 GrMeshDrawOp (uint32_t classID)
 
void createProgramInfo (const GrCaps *caps, SkArenaAlloc *arena, const GrSurfaceProxyView &writeView, bool usesMSAASurface, GrAppliedClip &&appliedClip, const GrDstProxyView &dstProxyView, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
 
void createProgramInfo (GrMeshDrawTarget *)
 
virtual void onPrePrepareDraws (GrRecordingContext *, const GrSurfaceProxyView &writeView, GrAppliedClip *, const GrDstProxyView &, GrXferBarrierFlags renderPassXferBarriers, GrLoadOp colorLoadOp)
 
- Protected Member Functions inherited from GrDrawOp
 GR_DECL_BITFIELD_CLASS_OPS_FRIENDS (FixedFunctionFlags)
 
virtual FixedFunctionFlags fixedFunctionFlags () const
 
- Static Protected Member Functions inherited from GrMeshDrawOp
static bool CombinedQuadCountWillOverflow (GrAAType aaType, bool willBeUpgradedToAA, int combinedQuadCount)
 

Detailed Description

Definition at line 2512 of file GrOvalOpFactory.cpp.

Constructor & Destructor Documentation

◆ CircularRRectOp()

CircularRRectOp::CircularRRectOp ( GrProcessorSet processorSet,
const SkPMColor4f color,
const SkMatrix viewMatrix,
const SkRect devRect,
float  devRadius,
float  devStrokeWidth,
bool  strokeOnly 
)
inline

Definition at line 2532 of file GrOvalOpFactory.cpp.

2535 : INHERITED(ClassID())
2536 , fViewMatrixIfUsingLocalCoords(viewMatrix)
2537 , fHelper(processorSet, GrAAType::kCoverage) {
2538 SkRect bounds = devRect;
2539 SkASSERT(!(devStrokeWidth <= 0 && strokeOnly));
2540 SkScalar innerRadius = 0.0f;
2541 SkScalar outerRadius = devRadius;
2542 SkScalar halfWidth = 0;
2544 if (devStrokeWidth > 0) {
2545 if (SkScalarNearlyZero(devStrokeWidth)) {
2546 halfWidth = SK_ScalarHalf;
2547 } else {
2548 halfWidth = SkScalarHalf(devStrokeWidth);
2549 }
2550
2551 if (strokeOnly) {
2552 // Outset stroke by 1/4 pixel
2553 devStrokeWidth += 0.25f;
2554 // If stroke is greater than width or height, this is still a fill
2555 // Otherwise we compute stroke params
2556 if (devStrokeWidth <= devRect.width() && devStrokeWidth <= devRect.height()) {
2557 innerRadius = devRadius - halfWidth;
2558 type = (innerRadius >= 0) ? kStroke_RRectType : kOverstroke_RRectType;
2559 }
2560 }
2561 outerRadius += halfWidth;
2562 bounds.outset(halfWidth, halfWidth);
2563 }
2564
2565 // The radii are outset for two reasons. First, it allows the shader to simply perform
2566 // simpler computation because the computed alpha is zero, rather than 50%, at the radius.
2567 // Second, the outer radius is used to compute the verts of the bounding box that is
2568 // rendered and the outset ensures the box will cover all partially covered by the rrect
2569 // corners.
2570 outerRadius += SK_ScalarHalf;
2571 innerRadius -= SK_ScalarHalf;
2572
2574
2575 // Expand the rect for aa to generate correct vertices.
2577
2578 fRRects.emplace_back(RRect{color, innerRadius, outerRadius, bounds, type});
2579 fVertCount = rrect_type_to_vert_count(type);
2580 fIndexCount = rrect_type_to_index_count(type);
2581 fAllFill = (kFill_RRectType == type);
2582 }
static int rrect_type_to_vert_count(RRectType type)
static int rrect_type_to_index_count(RRectType type)
@ kOverstroke_RRectType
@ kFill_RRectType
@ kStroke_RRectType
#define SkASSERT(cond)
Definition: SkAssert.h:116
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition: SkScalar.h:101
#define SkScalarHalf(a)
Definition: SkScalar.h:75
#define SK_ScalarHalf
Definition: SkScalar.h:19
GLenum type
const SkRect & bounds() const
Definition: GrOp.h:122
void setBounds(const SkRect &newBounds, HasAABloat aabloat, IsHairline zeroArea)
Definition: GrOp.h:279
T & emplace_back(Args &&... args)
Definition: SkTArray.h:248
DlColor color
float SkScalar
Definition: extension.cpp:12
void outset(float dx, float dy)
Definition: SkRect.h:1077
constexpr float height() const
Definition: SkRect.h:769
constexpr float width() const
Definition: SkRect.h:762

Member Function Documentation

◆ finalize()

GrProcessorSet::Analysis CircularRRectOp::finalize ( const GrCaps ,
const GrAppliedClip ,
GrClampType   
)
inlineoverridevirtual

This is called after the GrAppliedClip has been computed and just prior to recording the op or combining it with a previously recorded op. The op should convert any proxies or resources it owns to "pending io" status so that resource allocation can be more optimal. Additionally, at this time the op must report whether a copy of the destination (or destination texture itself) needs to be provided to the GrXferProcessor when this op executes.

Implements GrDrawOp.

Definition at line 2594 of file GrOvalOpFactory.cpp.

2595 {
2596 SkPMColor4f* color = &fRRects.front().fColor;
2597 return fHelper.finalizeProcessors(caps, clip, clampType,
2599 &fWideColor);
2600 }
static SkPath clip(const SkPath &path, const SkHalfPlane &plane)
Definition: SkPath.cpp:3892
GrProcessorSet::Analysis finalizeProcessors(const GrCaps &caps, const GrAppliedClip *clip, GrClampType clampType, GrProcessorAnalysisCoverage geometryCoverage, GrProcessorAnalysisColor *geometryColor)

◆ fixedFunctionFlags()

FixedFunctionFlags CircularRRectOp::fixedFunctionFlags ( ) const
inlineoverridevirtual

Reimplemented from GrDrawOp.

Definition at line 2602 of file GrOvalOpFactory.cpp.

2602{ return fHelper.fixedFunctionFlags(); }
GrDrawOp::FixedFunctionFlags fixedFunctionFlags() const

◆ Make()

static DEFINE_OP_CLASS_ID GrOp::Owner CircularRRectOp::Make ( GrRecordingContext context,
GrPaint &&  paint,
const SkMatrix viewMatrix,
const SkRect devRect,
float  devRadius,
float  devStrokeWidth,
bool  strokeOnly 
)
inlinestatic

Definition at line 2521 of file GrOvalOpFactory.cpp.

2527 {
2528 return Helper::FactoryHelper<CircularRRectOp>(context, std::move(paint), viewMatrix,
2529 devRect, devRadius,
2530 devStrokeWidth, strokeOnly);
2531 }
const Paint & paint
Definition: color_source.cc:38

◆ name()

const char * CircularRRectOp::name ( ) const
inlineoverridevirtual

Implements GrOp.

Definition at line 2584 of file GrOvalOpFactory.cpp.

2584{ return "CircularRRectOp"; }

◆ visitProxies()

void CircularRRectOp::visitProxies ( const GrVisitProxyFunc func) const
inlineoverridevirtual

Reimplemented from GrOp.

Definition at line 2586 of file GrOvalOpFactory.cpp.

2586 {
2587 if (fProgramInfo) {
2588 fProgramInfo->visitFPProxies(func);
2589 } else {
2590 fHelper.visitProxies(func);
2591 }
2592 }
void visitFPProxies(const GrVisitProxyFunc &func) const
Definition: GrProgramInfo.h:64
void visitProxies(const GrVisitProxyFunc &func) const

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