25#include <initializer_list>
81 const uint8_t[],
int verbCount,
82 const SkScalar[],
int conicWeightCount,
86 unsigned startIndex = 0);
98 bool isVolatile =
false);
100 static SkPath Polygon(
const std::initializer_list<SkPoint>& list,
bool isClosed,
102 bool isVolatile =
false) {
103 return Polygon(list.begin(),
SkToInt(list.size()), isClosed, fillType, isVolatile);
107 return Polygon({
a,
b},
false);
255 bool isConvex()
const;
268 bool isOval(
SkRect* bounds)
const;
282 bool isRRect(
SkRRect* rrect)
const;
292 bool isArc(
SkArc* arc)
const;
323 bool isEmpty()
const;
333 bool isLastContourClosed()
const;
371 fIsVolatile = isVolatile;
389 static bool IsLineDegenerate(
const SkPoint& p1,
const SkPoint& p2,
bool exact);
402 static bool IsQuadDegenerate(
const SkPoint& p1,
const SkPoint& p2,
403 const SkPoint& p3,
bool exact);
417 static bool IsCubicDegenerate(
const SkPoint& p1,
const SkPoint& p2,
431 bool isLine(
SkPoint line[2])
const;
440 int countPoints()
const;
451 SkPoint getPoint(
int index)
const;
472 int countVerbs()
const;
483 int getVerbs(uint8_t verbs[],
int max)
const;
489 size_t approximateBytesUsed()
const;
514 const SkRect& getBounds()
const;
546 SkRect computeTightBounds()
const;
561 bool conservativelyContainsRect(
const SkRect& rect)
const;
573 void incReserve(
int extraPtCount,
int extraVerbCount = 0,
int extraConicCount = 0);
575#ifdef SK_HIDE_PATH_EDIT_METHODS
595 return this->moveTo(p.fX, p.fY);
635 return this->lineTo(p.fX, p.fY);
687 return this->quadTo(p1.
fX, p1.
fY, p2.
fX, p2.
fY);
760 return this->conicTo(p1.
fX, p1.
fY, p2.
fX, p2.
fY,
w);
824 return this->cubicTo(p1.
fX, p1.
fY, p2.
fX, p2.
fY, p3.
fX, p3.
fY);
916 return this->arcTo(p1.
fX, p1.
fY, p2.
fX, p2.
fY, radius);
980 return this->arcTo(r.
fX, r.
fY, xAxisRotate, largeArc, sweep, xy.
fX, xy.
fY);
1026#ifdef SK_HIDE_PATH_EDIT_METHODS
1075#ifdef SK_HIDE_PATH_EDIT_METHODS
1107 return this->addRect(rect, dir, 0);
1112 return this->addRect({
left, top,
right, bottom}, dir, 0);
1264 return this->addPoly(list.begin(),
SkToInt(list.size()), close);
1267#ifdef SK_HIDE_PATH_EDIT_METHODS
1301 AddPathMode mode = kAppend_AddPathMode);
1316 return this->addPath(src, m, mode);
1332 AddPathMode mode = kAppend_AddPathMode);
1361 this->
offset(dx, dy,
this);
1411 bool getLastPt(
SkPoint* lastPt)
const;
1429 this->setLastPt(p.fX, p.fY);
1451 uint32_t getSegmentMasks()
const;
1464 kDone_Verb = kClose_Verb + 1
1506 void setPath(
const SkPath& path,
bool forceClose);
1548 bool isClosedContour()
const;
1552 const uint8_t* fVerbs;
1553 const uint8_t* fVerbStop;
1573 RangeIter() =
default;
1575 : fVerb(verbs), fPoints(
points), fWeights(weights) {
1578 bool operator!=(
const RangeIter& that)
const {
1579 return fVerb != that.fVerb;
1581 bool operator==(
const RangeIter& that)
const {
1582 return fVerb == that.fVerb;
1584 RangeIter& operator++() {
1585 auto verb =
static_cast<SkPathVerb>(*fVerb++);
1586 fPoints += pts_advance_after_verb(verb);
1592 RangeIter operator++(
int) {
1593 RangeIter
copy = *
this;
1600 std::tuple<SkPathVerb, const SkPoint*, const SkScalar*>
operator*()
const {
1605 int backset = pts_backset_for_verb(verb);
1606 SkASSERT(fPoints + backset >= fInitialPoints);
1607 return {verb, fPoints + backset, fWeights};
1610 constexpr static int pts_advance_after_verb(
SkPathVerb verb) {
1621 constexpr static int pts_backset_for_verb(
SkPathVerb verb) {
1632 const uint8_t* fVerb =
nullptr;
1633 const SkPoint* fPoints =
nullptr;
1634 const SkScalar* fWeights =
nullptr;
1666 void setPath(
const SkPath&);
1682 return (
fIter != fEnd) ?
static_cast<Verb>(std::get<0>(*
fIter)) : kDone_Verb;
1693 return fConicWeight;
1730 void dumpArrays(
SkWStream* stream,
bool dumpAsHex)
const;
1747 size_t writeToMemory(
void*
buffer)
const;
1778 size_t readFromMemory(
const void*
buffer,
size_t length);
1793 uint32_t getGenerationID()
const;
1801 bool isValid()
const;
1810 int fLastMoveToIndex;
1811 mutable std::atomic<uint8_t> fConvexity;
1812 mutable std::atomic<uint8_t> fFirstDirection;
1813 uint8_t fFillType : 2;
1814 uint8_t fIsVolatile : 1;
1827 void copyFields(
const SkPath& that);
1829 size_t writeToMemoryAsRRect(
void*
buffer)
const;
1830 size_t readAsRRect(
const void*,
size_t);
1831 size_t readFromMemory_EQ4Or5(
const void*,
size_t);
1849 inline void injectMoveToIfNeeded();
1851 inline bool hasOnlyMoveTos()
const;
1855 bool isValidImpl()
const;
1860 void validate()
const;
1861 void validateRef()
const;
1865 bool isZeroLengthSincePoint(
int startPtIndex)
const;
1870 bool hasComputedBounds()
const;
1873 void setBounds(
const SkRect& rect);
1877 SkPath& dirtyAfterEdit();
1894 bool isConvexityAccurate()
const;
1916 const uint8_t verbs[],
1923 friend class SkAutoDisableOvalCheck;
1932 friend class FuzzPath;
static bool compare(const SkBitmap &ref, const SkIRect &iref, const SkBitmap &test, const SkIRect &itest)
static bool rewind(EdgeList *activeEdges, Vertex **current, Vertex *dst, const Comparator &c)
static const int points[]
std::unique_ptr< SkLatticeIter > fIter
static bool isFinite(const SkRect &r)
static float next(float f)
static double interpolate(double A, double B, double t)
static std::unique_ptr< SkEncoder > Make(SkWStream *dst, const SkPixmap *src, const SkYUVAPixmaps *srcYUVA, const SkColorSpace *srcYUVAColorSpace, const SkJpegEncoder::Options &options)
@ kYes
Do pre-clip the geometry before applying the (perspective) matrix.
@ kNo
Don't pre-clip the geometry before applying the (perspective) matrix.
static bool contains(const SkRect &r, SkPoint p)
static SkSize operator*(SkISize u, SkScalar s)
@ kCubic_SkPathSegmentMask
@ kConic_SkPathSegmentMask
@ kQuad_SkPathSegmentMask
@ kLine_SkPathSegmentMask
static bool SkPathFillType_IsInverse(SkPathFillType ft)
@ kClose
SkPath::RawIter returns 0 points.
@ kCubic
SkPath::RawIter returns 4 points.
@ kConic
SkPath::RawIter returns 3 points + 1 weight.
@ kQuad
SkPath::RawIter returns 3 points.
@ kMove
SkPath::RawIter returns 1 point.
@ kLine
SkPath::RawIter returns 2 points.
static bool left(const SkPoint &p0, const SkPoint &p1)
static bool right(const SkPoint &p0, const SkPoint &p1)
bool operator!=(const sk_sp< T > &a, const sk_sp< U > &b)
void swap(sk_sp< T > &a, sk_sp< T > &b)
constexpr int SkToInt(S x)
static constexpr bool SkToBool(const T &x)
constexpr uint8_t SkToU8(S x)
static void dump(const float m[20], SkYUVColorSpace cs, bool rgb2yuv)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
SkScalar conicWeight() const
SkScalar conicWeight() const
RawIter(const SkPath &path)
bool isInverseFillType() const
SkPath & transform(const SkMatrix &matrix, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes)
SkPath & lineTo(const SkPoint &p)
SkPathFillType getFillType() const
void setFillType(SkPathFillType ft)
SkPath & addPoly(const std::initializer_list< SkPoint > &list, bool close)
SkPath & addRect(const SkRect &rect, SkPathDirection dir=SkPathDirection::kCW)
SkPath & arcTo(const SkPoint p1, const SkPoint p2, SkScalar radius)
friend bool operator!=(const SkPath &a, const SkPath &b)
void toggleInverseFillType()
void updateBoundsCache() const
SkPath & addRect(SkScalar left, SkScalar top, SkScalar right, SkScalar bottom, SkPathDirection dir=SkPathDirection::kCW)
SkPath & offset(SkScalar dx, SkScalar dy)
std::true_type sk_is_trivially_relocatable
SkPath makeScale(SkScalar sx, SkScalar sy)
SkPath & arcTo(const SkPoint r, SkScalar xAxisRotate, ArcSize largeArc, SkPathDirection sweep, const SkPoint xy)
static SkPath Polygon(const std::initializer_list< SkPoint > &list, bool isClosed, SkPathFillType fillType=SkPathFillType::kWinding, bool isVolatile=false)
void setLastPt(const SkPoint &p)
SkPath & setIsVolatile(bool isVolatile)
@ kSmall_ArcSize
smaller of arc pair
@ kLarge_ArcSize
larger of arc pair
SkPath & quadTo(const SkPoint &p1, const SkPoint &p2)
SkPath & addPath(const SkPath &src, AddPathMode mode=kAppend_AddPathMode)
SkPath & cubicTo(const SkPoint &p1, const SkPoint &p2, const SkPoint &p3)
SkPath & moveTo(const SkPoint &p)
SkPath makeTransform(const SkMatrix &m, SkApplyPerspectiveClip pc=SkApplyPerspectiveClip::kYes) const
SkPath & conicTo(const SkPoint &p1, const SkPoint &p2, SkScalar w)
static SkPath Line(const SkPoint a, const SkPoint b)
bool operator==(const FlutterPoint &a, const FlutterPoint &b)
static const uint8_t buffer[]
static float max(float r, float g, float b)
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)