Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Functions
GrOvalEffect Namespace Reference

Functions

GrFPResult Make (std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, const SkRect &, const GrShaderCaps &)
 

Function Documentation

◆ Make()

GrFPResult GrOvalEffect::Make ( std::unique_ptr< GrFragmentProcessor inputFP,
GrClipEdgeType  edgeType,
const SkRect oval,
const GrShaderCaps caps 
)

Creates an effect that performs clipping against an oval.

Definition at line 19 of file GrOvalEffect.cpp.

20 {
21 SkScalar w = oval.width();
22 SkScalar h = oval.height();
23 if (SkScalarNearlyEqual(w, h)) {
24 w /= 2;
25 return GrFragmentProcessor::Circle(std::move(inputFP), edgeType,
26 SkPoint::Make(oval.fLeft + w, oval.fTop + w), w);
27 } else {
28 w /= 2;
29 h /= 2;
30 return GrFragmentProcessor::Ellipse(std::move(inputFP), edgeType,
31 SkPoint::Make(oval.fLeft + w, oval.fTop + h),
32 SkPoint::Make(w, h), caps);
33 }
35}
#define SkUNREACHABLE
Definition SkAssert.h:135
static bool SkScalarNearlyEqual(SkScalar x, SkScalar y, SkScalar tolerance=SK_ScalarNearlyZero)
Definition SkScalar.h:107
static GrFPResult Circle(std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkPoint center, float radius)
static GrFPResult Ellipse(std::unique_ptr< GrFragmentProcessor >, GrClipEdgeType, SkPoint center, SkPoint radii, const GrShaderCaps &)
float SkScalar
Definition extension.cpp:12
SkScalar w
SkScalar h
static constexpr SkPoint Make(float x, float y)
SkScalar fLeft
smaller x-axis bounds
Definition extension.cpp:14
constexpr float height() const
Definition SkRect.h:769
constexpr float width() const
Definition SkRect.h:762
SkScalar fTop
smaller y-axis bounds
Definition extension.cpp:15