8#ifndef SkPathPriv_DEFINED
9#define SkPathPriv_DEFINED
55 return gOppositeDir[(unsigned)dir];
67 int verbCount = path.countVerbs();
71 auto verbs = path.fPathRef->verbsBegin();
72 for (
int i = 0; i < verbCount; i++) {
81 if (i == verbCount - 1) {
95 int verbCount = path.countVerbs();
96 auto verbs = path.fPathRef->verbsBegin();
97 for (
int i = 0; i < verbCount; i++) {
106 path.fPathRef->addGenIDChangeListener(std::move(listener));
122 SkScalar sweepAngle,
bool useCenter,
bool isFillNoPathEffect);
176 :
Iterate(path.fPathRef->verbsBegin(),
178 (!path.
isFinite()) ? path.fPathRef->verbsBegin()
179 : path.fPathRef->verbsEnd(),
180 path.fPathRef->
points(), path.fPathRef->conicWeights()) {
184 : fVerbsBegin(verbsBegin), fVerbsEnd(verbsEnd), fPoints(
points), fWeights(weights) {
186 SkPath::RangeIter
begin() {
return {fVerbsBegin, fPoints, fWeights}; }
187 SkPath::RangeIter
end() {
return {fVerbsEnd,
nullptr,
nullptr}; }
189 const uint8_t* fVerbsBegin;
190 const uint8_t* fVerbsEnd;
199 return path.fPathRef->verbsBegin();
204 return path.fPathRef->points();
209 return path.fPathRef->countWeights();
214 return path.fPathRef->conicWeights();
219 return path.fPathRef->unique();
224 return path.hasComputedBounds();
247 bool result = path.fPathRef->isOval(rect, &isCCW,
start);
275 bool result = path.fPathRef->isRRect(rrect, &isCCW,
start);
293 constexpr SkScalar scale_down_to_allow_for_small_multiplies = 0.25f;
297 return !(bounds.fLeft >= -
max && bounds.fTop >= -
max &&
298 bounds.fRight <=
max && bounds.fBottom <=
max);
306 static const uint8_t gPtsInVerb[] = {
316 SkASSERT(verb < std::size(gPtsInVerb));
317 return gPtsInVerb[verb];
323 static const uint8_t gPtsInVerb[] = {
333 SkASSERT(verb < std::size(gPtsInVerb));
334 return gPtsInVerb[verb];
340 for (
int i = 1; i <
count; ++i) {
341 if (pts[0] != pts[i]) {
369 return (
static_cast<int>(fill) & 2) != 0;
401 SkASSERT(index < path->countPoints());
404 path->dirtyAfterEdit();
408 return path.getConvexity();
411 return path.getConvexityOrUnknown();
414 path.setConvexity(c);
418 (void)path.isConvex();
422 builder->privateReverseAddPath(reverseMe);
427 const uint8_t verbs[],
432 return SkPath::MakeInternal(analysis,
points, verbs, verbCount, conics, fillType,
443 const uint8_t* fVerbs;
444 const uint8_t* fVerbsStop;
449 bool fNeedsCloseLine;
450 bool fNextIsNewContour;
454 kIllegalEdgeValue = 99
462 return *fConicWeights;
482 explicit operator bool() {
return fPts !=
nullptr; }
486 auto closeline = [&]() {
487 fScratch[0] =
fPts[-1];
488 fScratch[1] = *fMoveToPtr;
489 fNeedsCloseLine =
false;
490 fNextIsNewContour =
true;
491 return Result{ fScratch, Edge::kLine,
false };
496 if (fVerbs == fVerbsStop) {
497 return fNeedsCloseLine
499 :
Result{
nullptr,
Edge(kIllegalEdgeValue),
false };
504 const auto v = *fVerbs++;
507 if (fNeedsCloseLine) {
508 auto res = closeline();
513 fNextIsNewContour =
true;
516 if (fNeedsCloseLine)
return closeline();
520 const int pts_count = (v+2) / 2,
521 cws_count = (v & (v-1)) / 2;
524 fNeedsCloseLine =
true;
526 fConicWeights += cws_count;
529 SkASSERT(fIsConic == (cws_count > 0));
531 bool isNewContour = fNextIsNewContour;
532 fNextIsNewContour =
false;
533 return { &
fPts[-(pts_count + 1)],
Edge(v), isNewContour };
static const int points[]
static bool isFinite(const SkRect &r)
SkScalar conicWeight() const
static SkPath::Verb EdgeToVerb(Edge e)
static bool IsInverseFillType(SkPathFillType fill)
static int PtsInVerb(unsigned verb)
static bool IsClosedSingleContour(const SkPath &path)
static SkPathConvexity GetConvexity(const SkPath &path)
static bool IsRRect(const SkPath &path, SkRRect *rrect, SkPathDirection *dir, unsigned *start)
static bool IsNestedFillRects(const SkPath &, SkRect rect[2], SkPathDirection dirs[2]=nullptr)
static int LastMoveToIndex(const SkPath &path)
static bool TooBigForMath(const SkPath &path)
static bool IsSimpleRect(const SkPath &path, bool isSimpleFill, SkRect *rect, SkPathDirection *direction, unsigned *start)
static int GenIDChangeListenersCount(const SkPath &)
static void SetConvexity(const SkPath &path, SkPathConvexity c)
static bool HasComputedBounds(const SkPath &path)
static bool DrawArcIsConvex(SkScalar sweepAngle, bool useCenter, bool isFillNoPathEffect)
static const uint8_t * VerbData(const SkPath &path)
static SkPath MakePath(const SkPathVerbAnalysis &analysis, const SkPoint points[], const uint8_t verbs[], int verbCount, const SkScalar conics[], SkPathFillType fillType, bool isVolatile)
static void ForceComputeConvexity(const SkPath &path)
static bool IsOval(const SkPath &path, SkRect *rect, SkPathDirection *dir, unsigned *start)
static SkPathFirstDirection AsFirstDirection(SkPathDirection dir)
static bool IsAxisAligned(const SkPath &path)
static int PtsInIter(unsigned verb)
static bool TestingOnly_unique(const SkPath &path)
static void ReverseAddPath(SkPathBuilder *builder, const SkPath &reverseMe)
static SkPathFirstDirection ComputeFirstDirection(const SkPath &)
static int LeadingMoveToCount(const SkPath &path)
static constexpr SkScalar kW0PlaneDistance
static void AddGenIDChangeListener(const SkPath &path, sk_sp< SkIDChangeListener > listener)
static SkPathConvexity GetConvexityOrUnknown(const SkPath &path)
static void ShrinkToFit(SkPath *path)
static bool PerspectiveClip(const SkPath &src, const SkMatrix &, SkPath *result)
static void UpdatePathPoint(SkPath *path, int index, const SkPoint &pt)
static bool IsRectContour(const SkPath &, bool allowPartial, int *currVerb, const SkPoint **ptsPtr, bool *isClosed, SkPathDirection *direction, SkRect *rect)
static const SkScalar * ConicWeightData(const SkPath &path)
static const SkPoint * PointData(const SkPath &path)
static bool TooBigForMath(const SkRect &bounds)
static bool AllPointsEq(const SkPoint pts[], int count)
static int ConicWeightCnt(const SkPath &path)
static void CreateDrawArcPath(SkPath *path, const SkRect &oval, SkScalar startAngle, SkScalar sweepAngle, bool useCenter, bool isFillNoPathEffect)
SkPath::RangeIter RangeIter
static SkPathFirstDirection OppositeFirstDirection(SkPathFirstDirection dir)
static SkPathFillType ConvertToNonInverseFillType(SkPathFillType fill)
SkPoint * writablePoints()
const uint8_t * verbsEnd() const
const uint8_t * verbsBegin() const
static float max(float r, float g, float b)
Iterate(const uint8_t *verbsBegin, const uint8_t *verbsEnd, const SkPoint *points, const SkScalar *weights)
Iterate(const SkPath &path)
SkPath::RangeIter begin()
bool operator!=(const Iter &b)
Verbs(const SkPath &path)