Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
SkSpotShadowTessellator Class Reference
Inheritance diagram for SkSpotShadowTessellator:
SkBaseShadowTessellator

Public Member Functions

 SkSpotShadowTessellator (const SkPath &path, const SkMatrix &ctm, const SkPoint3 &zPlaneParams, const SkPoint3 &lightPos, SkScalar lightRadius, bool transparent, bool directional)
 
- Public Member Functions inherited from SkBaseShadowTessellator
 SkBaseShadowTessellator (const SkPoint3 &zPlaneParams, const SkRect &bounds, bool transparent)
 
virtual ~SkBaseShadowTessellator ()
 
sk_sp< SkVerticesreleaseVertices ()
 

Additional Inherited Members

- Protected Member Functions inherited from SkBaseShadowTessellator
int vertexCount () const
 
int indexCount () const
 
bool accumulateCentroid (const SkPoint &c, const SkPoint &n)
 
bool checkConvexity (const SkPoint &p0, const SkPoint &p1, const SkPoint &p2)
 
void finishPathPolygon ()
 
bool computeConvexShadow (SkScalar inset, SkScalar outset, bool doClip)
 
void computeClipVectorsAndTestCentroid ()
 
bool clipUmbraPoint (const SkPoint &umbraPoint, const SkPoint &centroid, SkPoint *clipPoint)
 
void addEdge (const SkVector &nextPoint, const SkVector &nextNormal, SkColor umbraColor, const SkTDArray< SkPoint > &umbraPolygon, bool lastEdge, bool doClip)
 
bool addInnerPoint (const SkPoint &pathPoint, SkColor umbraColor, const SkTDArray< SkPoint > &umbraPolygon, int *currUmbraIndex)
 
int getClosestUmbraIndex (const SkPoint &point, const SkTDArray< SkPoint > &umbraPolygon)
 
bool computeConcaveShadow (SkScalar inset, SkScalar outset)
 
void stitchConcaveRings (const SkTDArray< SkPoint > &umbraPolygon, SkTDArray< int > *umbraIndices, const SkTDArray< SkPoint > &penumbraPolygon, SkTDArray< int > *penumbraIndices)
 
void handleLine (const SkPoint &p)
 
void handleLine (const SkMatrix &m, SkPoint *p)
 
void handleQuad (const SkPoint pts[3])
 
void handleQuad (const SkMatrix &m, SkPoint pts[3])
 
void handleCubic (const SkMatrix &m, SkPoint pts[4])
 
void handleConic (const SkMatrix &m, SkPoint pts[3], SkScalar w)
 
bool addArc (const SkVector &nextNormal, SkScalar offset, bool finishArc)
 
void appendTriangle (uint16_t index0, uint16_t index1, uint16_t index2)
 
void appendQuad (uint16_t index0, uint16_t index1, uint16_t index2, uint16_t index3)
 
SkScalar heightFunc (SkScalar x, SkScalar y)
 
- Protected Attributes inherited from SkBaseShadowTessellator
SkPoint3 fZPlaneParams
 
SkTDArray< SkPointfPointBuffer
 
SkTDArray< SkPointfPositions
 
SkTDArray< SkColorfColors
 
SkTDArray< uint16_t > fIndices
 
SkTDArray< SkPointfPathPolygon
 
SkTDArray< SkPointfClipPolygon
 
SkTDArray< SkVectorfClipVectors
 
SkRect fPathBounds
 
SkPoint fCentroid
 
SkScalar fArea
 
SkScalar fLastArea
 
SkScalar fLastCross
 
int fFirstVertexIndex
 
SkVector fFirstOutset
 
SkPoint fFirstPoint
 
bool fSucceeded
 
bool fTransparent
 
bool fIsConvex
 
bool fValidUmbra
 
SkScalar fDirection
 
int fPrevUmbraIndex
 
int fCurrUmbraIndex
 
int fCurrClipIndex
 
bool fPrevUmbraOutside
 
bool fFirstUmbraOutside
 
SkVector fPrevOutset
 
SkPoint fPrevPoint
 
- Static Protected Attributes inherited from SkBaseShadowTessellator
static constexpr auto kMinHeight = 0.1f
 
static constexpr auto kPenumbraColor = SK_ColorTRANSPARENT
 
static constexpr auto kUmbraColor = SK_ColorBLACK
 

Detailed Description

Definition at line 1006 of file SkShadowTessellator.cpp.

Constructor & Destructor Documentation

◆ SkSpotShadowTessellator()

SkSpotShadowTessellator::SkSpotShadowTessellator ( const SkPath path,
const SkMatrix ctm,
const SkPoint3 zPlaneParams,
const SkPoint3 lightPos,
SkScalar  lightRadius,
bool  transparent,
bool  directional 
)

Definition at line 1020 of file SkShadowTessellator.cpp.

1024 : INHERITED(zPlaneParams, path.getBounds(), transparent) {
1025
1026 // Compute the blur radius, scale and translation for the spot shadow.
1027 SkMatrix shadowTransform;
1029 if (!SkDrawShadowMetrics::GetSpotShadowTransform(lightPos, lightRadius, ctm, zPlaneParams,
1030 path.getBounds(), directional,
1031 &shadowTransform, &outset)) {
1032 return;
1033 }
1035
1036 // compute rough clip bounds for umbra, plus offset polygon, plus centroid
1037 if (!this->computeClipAndPathPolygons(path, ctm, shadowTransform)) {
1038 return;
1039 }
1040 if (fClipPolygon.size() < 3 || fPathPolygon.size() < 3 || !SkIsFinite(fArea)) {
1041 fSucceeded = true; // We don't want to try to blur these cases, so we will
1042 // return an empty SkVertices instead.
1043 return;
1044 }
1045
1046 // TODO: calculate these reserves better
1047 // Penumbra ring: 3*numPts
1048 // Umbra ring: numPts
1049 // Inner ring: numPts
1050 fPositions.reserve(5 * path.countPoints());
1051 fColors.reserve(5 * path.countPoints());
1052 // Penumbra ring: 12*numPts
1053 // Umbra ring: 3*numPts
1054 fIndices.reserve(15 * path.countPoints());
1055
1056 if (fIsConvex) {
1057 fSucceeded = this->computeConvexShadow(inset, outset, true);
1058 } else {
1059 fSucceeded = this->computeConcaveShadow(inset, outset);
1060 }
1061
1062 if (!fSucceeded) {
1063 return;
1064 }
1065
1066 fSucceeded = true;
1067}
static const int outset
Definition BlurTest.cpp:58
static bool SkIsFinite(T x, Pack... values)
SkTDArray< SkPoint > fClipPolygon
bool computeConcaveShadow(SkScalar inset, SkScalar outset)
bool computeConvexShadow(SkScalar inset, SkScalar outset, bool doClip)
SkTDArray< SkPoint > fPositions
SkTDArray< uint16_t > fIndices
SkTDArray< SkPoint > fPathPolygon
int size() const
Definition SkTDArray.h:138
void reserve(int n)
Definition SkTDArray.h:187
float SkScalar
Definition extension.cpp:12
bool GetSpotShadowTransform(const SkPoint3 &lightPos, SkScalar lightRadius, const SkMatrix &ctm, const SkPoint3 &zPlaneParams, const SkRect &pathBounds, bool directional, SkMatrix *shadowTransform, SkScalar *radius)
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition switches.h:57
static SkRect inset(const SkRect &r)

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