73 , fVerbs(
std::move(verbs))
74 , fConicWeights(
std::move(weights))
76 fBoundsIsDirty =
true;
78 fSegmentMask = segmentMask;
79 fType = PathType::kGeneral;
81 fRRectOrOvalIsCCW =
false;
82 fRRectOrOvalStartIdx = 0xAC;
84 fArcStartAngle = fArcSweepAngle = 0.0f;
85 fArcUseCenter =
false;
88 this->computeBounds();
95 int incReserveVerbs = 0,
96 int incReservePoints = 0,
97 int incReserveConics = 0);
120 return fPathRef->growForVerb(verb, weight);
133 return fPathRef->growForRepeatedVerb(verb, numVbs, weights);
144 return fPathRef->growForVerbsInPath(path);
151 void resetToSize(
int newVerbCnt,
int newPointCnt,
int newConicCount) {
152 fPathRef->resetToSize(newVerbCnt, newPointCnt, newConicCount);
161 fPathRef->setIsOval(isCCW,
start);
165 fPathRef->setIsRRect(isCCW,
start);
169 fPathRef->setIsArc(arc);
195 uint8_t peek()
const;
201 const uint8_t* fVerbs;
202 const uint8_t* fVerbStop;
217 if (fBoundsIsDirty) {
218 this->computeBounds();
244 if (fType == PathType::kOval) {
246 *rect = this->getBounds();
249 *isCCW =
SkToBool(fRRectOrOvalIsCCW);
252 *
start = fRRectOrOvalStartIdx;
256 return fType == PathType::kOval;
259 bool isRRect(
SkRRect* rrect,
bool* isCCW,
unsigned*
start)
const;
262 if (fType == PathType::kArc) {
264 arc->
fOval = fArcOval;
271 return fType == PathType::kArc;
275 return !fBoundsIsDirty;
284 if (fBoundsIsDirty) {
285 this->computeBounds();
313 size_t approximateBytesUsed()
const;
323 const uint8_t*
verbsEnd()
const {
return fVerbs.end(); }
341 uint8_t
atVerb(
int index)
const {
return fVerbs[index]; }
354 uint32_t genID(uint8_t fillType)
const;
357 int genIDChangeListenerCount();
359 bool dataMatchesVerbs()
const;
360 bool isValid()
const;
369 return fGenerationID == kEmptyGenID;
374 kLegacyRRectOrOvalStartIdx_SerializationShift = 28,
375 kLegacyRRectOrOvalIsCCW_SerializationShift = 27,
376 kLegacyIsRRect_SerializationShift = 26,
377 kIsFinite_SerializationShift = 25,
378 kLegacyIsOval_SerializationShift = 24,
379 kSegmentMask_SerializationShift = 0
382 SkPathRef(
int numVerbs = 0,
int numPoints = 0,
int numConics = 0) {
383 fBoundsIsDirty =
true;
384 fGenerationID = kEmptyGenID;
386 fType = PathType::kGeneral;
388 fRRectOrOvalIsCCW =
false;
389 fRRectOrOvalStartIdx = 0xAC;
391 fArcStartAngle = fArcSweepAngle = 0.0f;
392 fArcUseCenter =
false;
394 fPoints.reserve_exact(numPoints);
397 fVerbs.reserve_exact(numVerbs);
400 fConicWeights.reserve_exact(numConics);
406 void copy(
const SkPathRef& ref,
int additionalReserveVerbs,
int additionalReservePoints,
int additionalReserveConics);
414 void computeBounds()
const {
420 fIsFinite = ComputePtBounds(&
fBounds, *
this);
421 fBoundsIsDirty =
false;
424 void setBounds(
const SkRect& rect) {
427 fBoundsIsDirty =
false;
432 void incReserve(
int additionalVerbs,
int additionalPoints,
int additionalConics) {
436 if (additionalPoints > 0) {
437 fPoints.reserve(fPoints.size() + additionalPoints);
439 if (additionalVerbs > 0) {
440 fVerbs.reserve(fVerbs.size() + additionalVerbs);
442 if (additionalConics > 0) {
443 fConicWeights.reserve(fConicWeights.size() + additionalConics);
454 this->callGenIDChangeListeners();
455 fBoundsIsDirty =
true;
459 fType = PathType::kGeneral;
464 void resetToSize(
int verbCount,
int pointCount,
int conicCount,
465 int reserveVerbs = 0,
int reservePoints = 0,
466 int reserveConics = 0) {
469 fPoints.reserve_exact(pointCount + reservePoints);
470 fPoints.resize_back(pointCount);
472 fVerbs.reserve_exact(verbCount + reserveVerbs);
473 fVerbs.resize_back(verbCount);
475 fConicWeights.reserve_exact(conicCount + reserveConics);
476 fConicWeights.resize_back(conicCount);
486 SkPoint* growForRepeatedVerb(
int verb,
int numVbs,
SkScalar** weights);
501 std::tuple<SkPoint*, SkScalar*> growForVerbsInPath(
const SkPathRef& path);
506 uint8_t* verbsBeginWritable() {
return fVerbs.begin(); }
513 void setIsOval(
bool isCCW,
unsigned start) {
514 fType = PathType::kOval;
515 fRRectOrOvalIsCCW = isCCW;
519 void setIsRRect(
bool isCCW,
unsigned start) {
520 fType = PathType::kRRect;
521 fRRectOrOvalIsCCW = isCCW;
525 void setIsArc(
const SkArc& arc) {
526 fType = PathType::kArc;
527 fArcOval = arc.
fOval;
536 fType = PathType::kGeneral;
537 return fPoints.begin();
540 const SkPoint* getPoints()
const {
542 return fPoints.begin();
545 void callGenIDChangeListeners();
552 mutable uint32_t fGenerationID;
557 ConicWeightsArray fConicWeights;
561 mutable uint8_t fBoundsIsDirty;
562 mutable bool fIsFinite;
567 bool fRRectOrOvalIsCCW;
568 uint8_t fRRectOrOvalStartIdx;
569 uint8_t fSegmentMask;