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

Public Member Functions

 EllipticalRRectOp (GrProcessorSet *processorSet, const SkPMColor4f &color, const SkMatrix &viewMatrix, const SkRect &devRect, float devXRadius, float devYRadius, SkVector devStrokeHalfWidths, 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 devXRadius, float devYRadius, SkVector devStrokeWidths, 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 2877 of file GrOvalOpFactory.cpp.

Constructor & Destructor Documentation

◆ EllipticalRRectOp()

EllipticalRRectOp::EllipticalRRectOp ( GrProcessorSet processorSet,
const SkPMColor4f color,
const SkMatrix viewMatrix,
const SkRect devRect,
float  devXRadius,
float  devYRadius,
SkVector  devStrokeHalfWidths,
bool  strokeOnly 
)
inline

Definition at line 2928 of file GrOvalOpFactory.cpp.

2931 : INHERITED(ClassID())
2932 , fHelper(processorSet, GrAAType::kCoverage)
2933 , fUseScale(false) {
2934 SkScalar innerXRadius = 0.0f;
2935 SkScalar innerYRadius = 0.0f;
2936 SkRect bounds = devRect;
2937 bool stroked = false;
2938 if (devStrokeHalfWidths.fX > 0) {
2939 // this is legit only if scale & translation (which should be the case at the moment)
2940 if (strokeOnly) {
2941 innerXRadius = devXRadius - devStrokeHalfWidths.fX;
2942 innerYRadius = devYRadius - devStrokeHalfWidths.fY;
2943 stroked = (innerXRadius >= 0 && innerYRadius >= 0);
2944 }
2945
2946 devXRadius += devStrokeHalfWidths.fX;
2947 devYRadius += devStrokeHalfWidths.fY;
2948 bounds.outset(devStrokeHalfWidths.fX, devStrokeHalfWidths.fY);
2949 }
2950
2951 fStroked = stroked;
2952 fViewMatrixIfUsingLocalCoords = viewMatrix;
2954 fRRects.emplace_back(
2955 RRect{color, devXRadius, devYRadius, innerXRadius, innerYRadius, bounds});
2956 }
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
float fX
x-axis value
Definition: SkPoint_impl.h:164
float fY
y-axis value
Definition: SkPoint_impl.h:165
void outset(float dx, float dy)
Definition: SkRect.h:1077

Member Function Documentation

◆ finalize()

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

2969 {
2970 fUseScale = !caps.shaderCaps()->fFloatIs32Bits;
2971 SkPMColor4f* color = &fRRects.front().fColor;
2972 return fHelper.finalizeProcessors(caps, clip, clampType,
2974 &fWideColor);
2975 }
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 EllipticalRRectOp::fixedFunctionFlags ( ) const
inlineoverridevirtual

Reimplemented from GrDrawOp.

Definition at line 2977 of file GrOvalOpFactory.cpp.

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

◆ Make()

static DEFINE_OP_CLASS_ID GrOp::Owner EllipticalRRectOp::Make ( GrRecordingContext context,
GrPaint &&  paint,
const SkMatrix viewMatrix,
const SkRect devRect,
float  devXRadius,
float  devYRadius,
SkVector  devStrokeWidths,
bool  strokeOnly 
)
inlinestatic

Definition at line 2886 of file GrOvalOpFactory.cpp.

2893 {
2894 SkASSERT(devXRadius >= 0.5 || strokeOnly);
2895 SkASSERT(devYRadius >= 0.5 || strokeOnly);
2896 SkASSERT((devStrokeWidths.fX > 0) == (devStrokeWidths.fY > 0));
2897 SkASSERT(!(strokeOnly && devStrokeWidths.fX <= 0));
2898 if (devStrokeWidths.fX > 0) {
2899 if (SkScalarNearlyZero(devStrokeWidths.length())) {
2900 devStrokeWidths.set(SK_ScalarHalf, SK_ScalarHalf);
2901 } else {
2902 devStrokeWidths.scale(SK_ScalarHalf);
2903 }
2904
2905 // we only handle thick strokes for near-circular ellipses
2906 if (devStrokeWidths.length() > SK_ScalarHalf &&
2907 (SK_ScalarHalf * devXRadius > devYRadius ||
2908 SK_ScalarHalf * devYRadius > devXRadius)) {
2909 return nullptr;
2910 }
2911
2912 // we don't handle it if curvature of the stroke is less than curvature of the ellipse
2913 if (devStrokeWidths.fX * (devYRadius * devYRadius) <
2914 (devStrokeWidths.fY * devStrokeWidths.fY) * devXRadius) {
2915 return nullptr;
2916 }
2917 if (devStrokeWidths.fY * (devXRadius * devXRadius) <
2918 (devStrokeWidths.fX * devStrokeWidths.fX) * devYRadius) {
2919 return nullptr;
2920 }
2921 }
2922 return Helper::FactoryHelper<EllipticalRRectOp>(context, std::move(paint),
2923 viewMatrix, devRect,
2924 devXRadius, devYRadius, devStrokeWidths,
2925 strokeOnly);
2926 }
#define SkASSERT(cond)
Definition: SkAssert.h:116
static bool SkScalarNearlyZero(SkScalar x, SkScalar tolerance=SK_ScalarNearlyZero)
Definition: SkScalar.h:101
#define SK_ScalarHalf
Definition: SkScalar.h:19
const Paint & paint
Definition: color_source.cc:38
void set(float x, float y)
Definition: SkPoint_impl.h:200
float length() const
Definition: SkPoint_impl.h:282
void scale(float scale, SkPoint *dst) const
Definition: SkPoint.cpp:17

◆ name()

const char * EllipticalRRectOp::name ( ) const
inlineoverridevirtual

Implements GrOp.

Definition at line 2958 of file GrOvalOpFactory.cpp.

2958{ return "EllipticalRRectOp"; }

◆ visitProxies()

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

Reimplemented from GrOp.

Definition at line 2960 of file GrOvalOpFactory.cpp.

2960 {
2961 if (fProgramInfo) {
2962 fProgramInfo->visitFPProxies(func);
2963 } else {
2964 fHelper.visitProxies(func);
2965 }
2966 }
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: