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

Public Member Functions

 ButtCapDashedCircleOp (GrProcessorSet *processorSet, const SkPMColor4f &color, const SkMatrix &viewMatrix, SkPoint center, SkScalar radius, SkScalar strokeWidth, SkScalar startAngle, SkScalar onAngle, SkScalar offAngle, SkScalar phaseAngle)
 
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, SkPoint center, SkScalar radius, SkScalar strokeWidth, SkScalar startAngle, SkScalar onAngle, SkScalar offAngle, SkScalar phaseAngle)
 
- 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 1500 of file GrOvalOpFactory.cpp.

Constructor & Destructor Documentation

◆ ButtCapDashedCircleOp()

ButtCapDashedCircleOp::ButtCapDashedCircleOp ( GrProcessorSet processorSet,
const SkPMColor4f color,
const SkMatrix viewMatrix,
SkPoint  center,
SkScalar  radius,
SkScalar  strokeWidth,
SkScalar  startAngle,
SkScalar  onAngle,
SkScalar  offAngle,
SkScalar  phaseAngle 
)
inline

Definition at line 1524 of file GrOvalOpFactory.cpp.

1528 : GrMeshDrawOp(ClassID())
1529 , fHelper(processorSet, GrAAType::kCoverage) {
1530 SkASSERT(circle_stays_circle(viewMatrix));
1531 viewMatrix.mapPoints(&center, 1);
1532 radius = viewMatrix.mapRadius(radius);
1533 strokeWidth = viewMatrix.mapRadius(strokeWidth);
1534
1535 // Determine the angle where the circle starts in device space and whether its orientation
1536 // has been reversed.
1538 bool reflection;
1539 if (!startAngle) {
1540 start = {1, 0};
1541 } else {
1544 }
1545 viewMatrix.mapVectors(&start, 1);
1547 reflection = (viewMatrix.getScaleX() * viewMatrix.getScaleY() -
1548 viewMatrix.getSkewX() * viewMatrix.getSkewY()) < 0;
1549
1550 auto totalAngle = onAngle + offAngle;
1551 phaseAngle = SkScalarMod(phaseAngle + totalAngle / 2, totalAngle) - totalAngle / 2;
1552
1553 SkScalar halfWidth = 0;
1555 halfWidth = SK_ScalarHalf;
1556 } else {
1557 halfWidth = SkScalarHalf(strokeWidth);
1558 }
1559
1560 SkScalar outerRadius = radius + halfWidth;
1561 SkScalar innerRadius = radius - halfWidth;
1562
1563 // The radii are outset for two reasons. First, it allows the shader to simply perform
1564 // simpler computation because the computed alpha is zero, rather than 50%, at the radius.
1565 // Second, the outer radius is used to compute the verts of the bounding box that is
1566 // rendered and the outset ensures the box will cover all partially covered by the circle.
1567 outerRadius += SK_ScalarHalf;
1568 innerRadius -= SK_ScalarHalf;
1569 fViewMatrixIfUsingLocalCoords = viewMatrix;
1570
1571 SkRect devBounds = SkRect::MakeLTRB(center.fX - outerRadius, center.fY - outerRadius,
1572 center.fX + outerRadius, center.fY + outerRadius);
1573
1574 // We store whether there is a reflection as a negative total angle.
1575 if (reflection) {
1576 totalAngle = -totalAngle;
1577 }
1578 fCircles.push_back(Circle{
1579 color,
1580 outerRadius,
1581 innerRadius,
1582 onAngle,
1583 totalAngle,
1584 startAngle,
1585 phaseAngle,
1586 devBounds
1587 });
1588 // Use the original radius and stroke radius for the bounds so that it does not include the
1589 // AA bloat.
1590 radius += halfWidth;
1591 this->setBounds(
1592 {center.fX - radius, center.fY - radius, center.fX + radius, center.fY + radius},
1594 fVertCount = circle_type_to_vert_count(true);
1595 fIndexCount = circle_type_to_index_count(true);
1596 }
static const int strokeWidth
Definition: BlurTest.cpp:60
static int circle_type_to_index_count(bool stroked)
static int circle_type_to_vert_count(bool stroked)
#define SkASSERT(cond)
Definition: SkAssert.h:116
#define SkScalarMod(x, y)
Definition: SkScalar.h:41
#define SkScalarATan2(y, x)
Definition: SkScalar.h:50
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition: SkScalar.h:101
#define SkScalarSin(radians)
Definition: SkScalar.h:45
#define SkScalarHalf(a)
Definition: SkScalar.h:75
#define SK_ScalarHalf
Definition: SkScalar.h:19
#define SkScalarCos(radians)
Definition: SkScalar.h:46
static SkScalar center(float pos0, float pos1)
GrMeshDrawOp(uint32_t classID)
void setBounds(const SkRect &newBounds, HasAABloat aabloat, IsHairline zeroArea)
Definition: GrOp.h:279
SkScalar mapRadius(SkScalar radius) const
Definition: SkMatrix.cpp:1170
SkScalar getSkewY() const
Definition: SkMatrix.h:430
void mapVectors(SkVector dst[], const SkVector src[], int count) const
Definition: SkMatrix.cpp:1097
void mapPoints(SkPoint dst[], const SkPoint src[], int count) const
Definition: SkMatrix.cpp:770
SkScalar getSkewX() const
Definition: SkMatrix.h:438
SkScalar getScaleX() const
Definition: SkMatrix.h:415
SkScalar getScaleY() const
Definition: SkMatrix.h:422
DlColor color
float SkScalar
Definition: extension.cpp:12
SkScalar startAngle
Definition: SkRecords.h:250
float fX
x-axis value
Definition: SkPoint_impl.h:164
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

Member Function Documentation

◆ finalize()

GrProcessorSet::Analysis ButtCapDashedCircleOp::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 1608 of file GrOvalOpFactory.cpp.

1609 {
1610 SkPMColor4f* color = &fCircles.front().fColor;
1611 return fHelper.finalizeProcessors(caps, clip, clampType,
1613 &fWideColor);
1614 }
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 ButtCapDashedCircleOp::fixedFunctionFlags ( ) const
inlineoverridevirtual

Reimplemented from GrDrawOp.

Definition at line 1616 of file GrOvalOpFactory.cpp.

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

◆ Make()

static DEFINE_OP_CLASS_ID GrOp::Owner ButtCapDashedCircleOp::Make ( GrRecordingContext context,
GrPaint &&  paint,
const SkMatrix viewMatrix,
SkPoint  center,
SkScalar  radius,
SkScalar  strokeWidth,
SkScalar  startAngle,
SkScalar  onAngle,
SkScalar  offAngle,
SkScalar  phaseAngle 
)
inlinestatic

Definition at line 1507 of file GrOvalOpFactory.cpp.

1516 {
1517 SkASSERT(circle_stays_circle(viewMatrix));
1518 SkASSERT(strokeWidth < 2 * radius);
1519 return Helper::FactoryHelper<ButtCapDashedCircleOp>(context, std::move(paint), viewMatrix,
1520 center, radius, strokeWidth, startAngle,
1521 onAngle, offAngle, phaseAngle);
1522 }
const Paint & paint
Definition: color_source.cc:38

◆ name()

const char * ButtCapDashedCircleOp::name ( ) const
inlineoverridevirtual

Implements GrOp.

Definition at line 1598 of file GrOvalOpFactory.cpp.

1598{ return "ButtCappedDashedCircleOp"; }

◆ visitProxies()

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

Reimplemented from GrOp.

Definition at line 1600 of file GrOvalOpFactory.cpp.

1600 {
1601 if (fProgramInfo) {
1602 fProgramInfo->visitFPProxies(func);
1603 } else {
1604 fHelper.visitProxies(func);
1605 }
1606 }
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: