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

Public Member Functions

 DIEllipseOp (GrProcessorSet *processorSet, const SkPMColor4f &color, const DeviceSpaceParams &params, const SkMatrix &viewMatrix)
 
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 &ellipse, const SkStrokeRec &stroke)
 
- 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 2113 of file GrOvalOpFactory.cpp.

Constructor & Destructor Documentation

◆ DIEllipseOp()

DIEllipseOp::DIEllipseOp ( GrProcessorSet processorSet,
const SkPMColor4f color,
const DeviceSpaceParams &  params,
const SkMatrix viewMatrix 
)
inline

Definition at line 2201 of file GrOvalOpFactory.cpp.

2203 : INHERITED(ClassID())
2204 , fHelper(processorSet, GrAAType::kCoverage)
2205 , fUseScale(false) {
2206 // This expands the outer rect so that after CTM we end up with a half-pixel border
2207 SkScalar a = viewMatrix[SkMatrix::kMScaleX];
2208 SkScalar b = viewMatrix[SkMatrix::kMSkewX];
2209 SkScalar c = viewMatrix[SkMatrix::kMSkewY];
2210 SkScalar d = viewMatrix[SkMatrix::kMScaleY];
2211 SkScalar geoDx = 1.f / SkScalarSqrt(a * a + c * c);
2212 SkScalar geoDy = 1.f / SkScalarSqrt(b * b + d * d);
2213
2214 fEllipses.emplace_back(
2215 Ellipse{viewMatrix, color, params.fXRadius, params.fYRadius, params.fInnerXRadius,
2216 params.fInnerYRadius, geoDx, geoDy, params.fStyle,
2217 SkRect::MakeLTRB(params.fCenter.fX - params.fXRadius,
2218 params.fCenter.fY - params.fYRadius,
2219 params.fCenter.fX + params.fXRadius,
2220 params.fCenter.fY + params.fYRadius)});
2221 this->setTransformedBounds(fEllipses[0].fBounds, viewMatrix, HasAABloat::kYes,
2223 }
#define SkScalarSqrt(x)
Definition: SkScalar.h:42
void setTransformedBounds(const SkRect &srcBounds, const SkMatrix &m, HasAABloat aabloat, IsHairline zeroArea)
Definition: GrOp.h:283
static constexpr int kMScaleX
horizontal scale factor
Definition: SkMatrix.h:353
static constexpr int kMSkewY
vertical skew factor
Definition: SkMatrix.h:356
static constexpr int kMScaleY
vertical scale factor
Definition: SkMatrix.h:357
static constexpr int kMSkewX
horizontal skew factor
Definition: SkMatrix.h:354
T & emplace_back(Args &&... args)
Definition: SkTArray.h:248
DlColor color
const EmbeddedViewParams * params
VULKAN_HPP_DEFAULT_DISPATCH_LOADER_DYNAMIC_STORAGE auto & d
Definition: main.cc:19
float SkScalar
Definition: extension.cpp:12
static bool b
struct MyStruct a[10]
static constexpr SkRect MakeLTRB(float l, float t, float r, float b)
Definition: SkRect.h:646

Member Function Documentation

◆ finalize()

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

2236 {
2237 fUseScale = !caps.shaderCaps()->fFloatIs32Bits &&
2238 !caps.shaderCaps()->fHasLowFragmentPrecision;
2239 SkPMColor4f* color = &fEllipses.front().fColor;
2240 return fHelper.finalizeProcessors(caps, clip, clampType,
2242 &fWideColor);
2243 }
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 DIEllipseOp::fixedFunctionFlags ( ) const
inlineoverridevirtual

Reimplemented from GrDrawOp.

Definition at line 2245 of file GrOvalOpFactory.cpp.

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

◆ Make()

static DEFINE_OP_CLASS_ID GrOp::Owner DIEllipseOp::Make ( GrRecordingContext context,
GrPaint &&  paint,
const SkMatrix viewMatrix,
const SkRect ellipse,
const SkStrokeRec stroke 
)
inlinestatic

Definition at line 2129 of file GrOvalOpFactory.cpp.

2133 {
2134 DeviceSpaceParams params;
2135 params.fCenter = SkPoint::Make(ellipse.centerX(), ellipse.centerY());
2136 params.fXRadius = SkScalarHalf(ellipse.width());
2137 params.fYRadius = SkScalarHalf(ellipse.height());
2138
2139 SkStrokeRec::Style style = stroke.getStyle();
2140 params.fStyle = (SkStrokeRec::kStroke_Style == style)
2142 : (SkStrokeRec::kHairline_Style == style)
2145
2146 params.fInnerXRadius = 0;
2147 params.fInnerYRadius = 0;
2148 if (SkStrokeRec::kFill_Style != style && SkStrokeRec::kHairline_Style != style) {
2149 SkScalar strokeWidth = stroke.getWidth();
2150
2153 } else {
2155 }
2156
2157 // we only handle thick strokes for near-circular ellipses
2158 if (strokeWidth > SK_ScalarHalf &&
2159 (SK_ScalarHalf * params.fXRadius > params.fYRadius ||
2160 SK_ScalarHalf * params.fYRadius > params.fXRadius)) {
2161 return nullptr;
2162 }
2163
2164 // we don't handle it if curvature of the stroke is less than curvature of the ellipse
2165 if (strokeWidth * (params.fYRadius * params.fYRadius) <
2166 (strokeWidth * strokeWidth) * params.fXRadius) {
2167 return nullptr;
2168 }
2169 if (strokeWidth * (params.fXRadius * params.fXRadius) <
2170 (strokeWidth * strokeWidth) * params.fYRadius) {
2171 return nullptr;
2172 }
2173
2174 // set inner radius (if needed)
2175 if (SkStrokeRec::kStroke_Style == style) {
2176 params.fInnerXRadius = params.fXRadius - strokeWidth;
2177 params.fInnerYRadius = params.fYRadius - strokeWidth;
2178 }
2179
2180 params.fXRadius += strokeWidth;
2181 params.fYRadius += strokeWidth;
2182 }
2183
2184 // For large ovals with low precision floats, we fall back to the path renderer.
2185 // To compute the AA at the edge we divide by the gradient, which is clamped to a
2186 // minimum value to avoid divides by zero. With large ovals and low precision this
2187 // leads to blurring at the edge of the oval.
2188 const SkScalar kMaxOvalRadius = 16384;
2189 if (!context->priv().caps()->shaderCaps()->fFloatIs32Bits &&
2190 (params.fXRadius >= kMaxOvalRadius || params.fYRadius >= kMaxOvalRadius)) {
2191 return nullptr;
2192 }
2193
2194 if (DIEllipseStyle::kStroke == params.fStyle &&
2195 (params.fInnerXRadius <= 0 || params.fInnerYRadius <= 0)) {
2197 }
2198 return Helper::FactoryHelper<DIEllipseOp>(context, std::move(paint), params, viewMatrix);
2199 }
static const int strokeWidth
Definition: BlurTest.cpp:60
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
const GrCaps * caps() const
const GrShaderCaps * shaderCaps() const
Definition: GrCaps.h:63
GrRecordingContextPriv priv()
const Paint & paint
Definition: color_source.cc:38
static constexpr SkPoint Make(float x, float y)
Definition: SkPoint_impl.h:173
constexpr float centerX() const
Definition: SkRect.h:776
constexpr float height() const
Definition: SkRect.h:769
constexpr float centerY() const
Definition: SkRect.h:785
constexpr float width() const
Definition: SkRect.h:762
bool fFloatIs32Bits
Definition: SkSLUtil.h:100

◆ name()

const char * DIEllipseOp::name ( ) const
inlineoverridevirtual

Implements GrOp.

Definition at line 2225 of file GrOvalOpFactory.cpp.

2225{ return "DIEllipseOp"; }

◆ visitProxies()

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

Reimplemented from GrOp.

Definition at line 2227 of file GrOvalOpFactory.cpp.

2227 {
2228 if (fProgramInfo) {
2229 fProgramInfo->visitFPProxies(func);
2230 } else {
2231 fHelper.visitProxies(func);
2232 }
2233 }
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: