8#ifndef SkPathRef_DEFINED
9#define SkPathRef_DEFINED
75 , fConicWeights(weights)
77 fBoundsIsDirty =
true;
79 fSegmentMask = segmentMask;
82 fRRectOrOvalIsCCW =
false;
83 fRRectOrOvalStartIdx = 0xAC;
85 fArcStartAngle = fArcSweepAngle = 0.0f;
89 this->computeBounds();
96 int incReserveVerbs = 0,
97 int incReservePoints = 0,
98 int incReserveConics = 0);
121 return fPathRef->growForVerb(verb, weight);
134 return fPathRef->growForRepeatedVerb(verb, numVbs, weights);
145 return fPathRef->growForVerbsInPath(
path);
152 void resetToSize(
int newVerbCnt,
int newPointCnt,
int newConicCount) {
153 fPathRef->resetToSize(newVerbCnt, newPointCnt, newConicCount);
162 fPathRef->setIsOval(isCCW,
start, isClosed);
166 fPathRef->setIsRRect(isCCW,
start);
170 fPathRef->setIsArc(arc);
196 uint8_t peek()
const;
202 const uint8_t* fVerbs;
203 const uint8_t* fVerbStop;
218 if (fBoundsIsDirty) {
219 this->computeBounds();
245 if (fType == PathType::kOval) {
247 *
rect = this->getBounds();
250 *isCCW =
SkToBool(fRRectOrOvalIsCCW);
253 *
start = fRRectOrOvalStartIdx;
257 return fType == PathType::kOval;
263 if (fType == PathType::kArc) {
265 *arc =
SkArc::Make(fArcOval, fArcStartAngle, fArcSweepAngle, fArcType);
269 return fType == PathType::kArc;
273 return !fBoundsIsDirty;
282 if (fBoundsIsDirty) {
283 this->computeBounds();
311 size_t approximateBytesUsed()
const;
321 const uint8_t*
verbsEnd()
const {
return fVerbs.end(); }
339 uint8_t
atVerb(
int index)
const {
return fVerbs[index]; }
352 uint32_t genID(uint8_t fillType)
const;
355 int genIDChangeListenerCount();
357 bool dataMatchesVerbs()
const;
358 bool isValid()
const;
367 return fGenerationID == kEmptyGenID;
372 kLegacyRRectOrOvalStartIdx_SerializationShift = 28,
373 kLegacyRRectOrOvalIsCCW_SerializationShift = 27,
374 kLegacyIsRRect_SerializationShift = 26,
375 kIsFinite_SerializationShift = 25,
376 kLegacyIsOval_SerializationShift = 24,
377 kSegmentMask_SerializationShift = 0
380 SkPathRef(
int numVerbs = 0,
int numPoints = 0,
int numConics = 0) {
381 fBoundsIsDirty =
true;
382 fGenerationID = kEmptyGenID;
386 fRRectOrOvalIsCCW =
false;
387 fRRectOrOvalStartIdx = 0xAC;
389 fArcStartAngle = fArcSweepAngle = 0.0f;
392 fPoints.reserve_exact(numPoints);
395 fVerbs.reserve_exact(numVerbs);
398 fConicWeights.reserve_exact(numConics);
404 void copy(const
SkPathRef& ref,
int additionalReserveVerbs,
int additionalReservePoints,
int additionalReserveConics);
408 return bounds->setBoundsCheck(ref.points(), ref.countPoints());
412 void computeBounds()
const {
418 fIsFinite = ComputePtBounds(&
fBounds, *
this);
419 fBoundsIsDirty =
false;
425 fBoundsIsDirty =
false;
430 void incReserve(
int additionalVerbs,
int additionalPoints,
int additionalConics) {
434 if (additionalPoints > 0) {
435 fPoints.reserve(fPoints.size() + additionalPoints);
437 if (additionalVerbs > 0) {
438 fVerbs.reserve(fVerbs.size() + additionalVerbs);
440 if (additionalConics > 0) {
441 fConicWeights.reserve(fConicWeights.size() + additionalConics);
452 this->callGenIDChangeListeners();
453 fBoundsIsDirty =
true;
462 void resetToSize(
int verbCount,
int pointCount,
int conicCount,
463 int reserveVerbs = 0,
int reservePoints = 0,
464 int reserveConics = 0) {
467 fPoints.reserve_exact(pointCount + reservePoints);
468 fPoints.resize_back(pointCount);
470 fVerbs.reserve_exact(verbCount + reserveVerbs);
471 fVerbs.resize_back(verbCount);
473 fConicWeights.reserve_exact(conicCount + reserveConics);
474 fConicWeights.resize_back(conicCount);
484 SkPoint* growForRepeatedVerb(
int verb,
int numVbs,
SkScalar** weights);
499 std::tuple<SkPoint*, SkScalar*> growForVerbsInPath(
const SkPathRef&
path);
504 uint8_t* verbsBeginWritable() {
return fVerbs.begin(); }
511 void setIsOval(
bool isCCW,
unsigned start,
bool isClosed) {
512 fType = isClosed ? PathType::kOval : PathType::kOpenOval;
513 fRRectOrOvalIsCCW = isCCW;
517 void setIsRRect(
bool isCCW,
unsigned start) {
519 fRRectOrOvalIsCCW = isCCW;
523 void setIsArc(
const SkArc& arc) {
524 fType = PathType::kArc;
525 fArcOval = arc.
fOval;
528 fArcType = arc.
fType;
535 return fPoints.begin();
538 const SkPoint* getPoints()
const {
540 return fPoints.begin();
543 void callGenIDChangeListeners();
550 mutable uint32_t fGenerationID;
555 ConicWeightsArray fConicWeights;
559 mutable uint8_t fBoundsIsDirty;
560 mutable bool fIsFinite;
565 bool fRRectOrOvalIsCCW;
566 uint8_t fRRectOrOvalStartIdx;
567 uint8_t fSegmentMask;
static const int points[]
static float next(float f)
static double interpolate(double A, double B, double t)
SkPathVerbAnalysis sk_path_analyze_verbs(const uint8_t verbs[], int count)
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static constexpr bool SkToBool(const T &x)
constexpr uint8_t SkToU8(S x)
void resetToSize(int newVerbCnt, int newPointCnt, int newConicCount)
void setIsOval(bool isCCW, unsigned start, bool isClosed)
std::tuple< SkPoint *, SkScalar * > growForVerbsInPath(const SkPathRef &path)
SkPoint * growForRepeatedVerb(int verb, int numVbs, SkScalar **weights=nullptr)
const SkPoint * points() const
SkPoint * growForVerb(int verb, SkScalar weight=0)
void setIsRRect(bool isCCW, unsigned start)
const SkPoint * atPoint(int i) const
void setBounds(const SkRect &rect)
SkPoint * writablePoints()
void setIsArc(const SkArc &arc)
SkScalar conicWeight() const
SkDEBUGCODE(void validate() const { SkASSERT(this->isValid());}) void reset()
friend SkPathRef * sk_create_empty_pathref()
const SkPoint & atPoint(int index) const
SkPathRef(SkSpan< const SkPoint > points, SkSpan< const uint8_t > verbs, SkSpan< const SkScalar > weights, unsigned segmentMask)
const SkRect & getBounds() const
bool isInitialEmptyPathRef() const
const uint8_t * verbsEnd() const
const SkPoint * pointsEnd() const
const SkScalar * conicWeightsEnd() const
uint8_t atVerb(int index) const
const SkPoint * points() const
bool hasComputedBounds() const
const SkScalar * conicWeights() const
const uint8_t * verbsBegin() const
bool isArc(SkArc *arc) const
bool isOval(SkRect *rect, bool *isCCW, unsigned *start) const
uint32_t getSegmentMasks() const
unsigned useCenter Optional< SkMatrix > matrix
Optional< SkRect > bounds
sk_sp< SkBlender > blender SkRect rect
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
bool operator==(C p1, const scoped_nsprotocol< C > &p2)
static SkArc Make(const SkRect &oval, SkScalar startAngleDegrees, SkScalar sweepAngleDegrees, Type type)