const SkPathVerb gRRectVerbs_ConicStart[] = {
SkPathVerb::kMove,
SkPathVerb::kConic, SkPathVerb::kLine,
SkPathVerb::kConic, SkPathVerb::kLine,
SkPathVerb::kConic, SkPathVerb::kLine,
SkPathVerb::kConic, // we can skip the last line
SkPathVerb::kClose
};
staticvoid set_as_rrect(SkPathRaw* raw, SkSpan<SkPoint> storage, const SkRRect& rrect, SkPathDirection dir, unsigned index) { // we start with a conic on odd indices when moving CW vs. even indices when moving CCW constbool startsWithConic = ((index & 1) == (dir == SkPathDirection::kCW)); // if we start with a conic, we end with a line, which we can skip (relying on close()) const size_t npoints = 13 - startsWithConic; const SkRect& bounds = rrect.getBounds();
SkPath_RRectPointIterator rrectIter(rrect, dir, index); // Corner iterator indices follow the collapsed radii model, // adjusted such that the start pt is "behind" the radii start pt. constunsigned rectStartIndex = index / 2 + (dir == SkPathDirection::kCW ? 0 : 1);
SkPath_RectPointIterator rectIter(bounds, dir, rectStartIndex);
storage[0] = rrectIter.current(); if (startsWithConic) { for (unsigned i = 0; i < 3; ++i) { // conic points
storage[i*3 + 1] = rectIter.next();
storage[i*3 + 2] = rrectIter.next(); // line point
storage[i*3 + 3] = rrectIter.next();
} // last conic points
storage[10] = rectIter.next();
storage[11] = rrectIter.next(); // the final line is accomplished by close()
} else { for (unsigned i = 0; i < 4; ++i) { // line point
storage[i*3 + 1] = rrectIter.next(); // conic points
storage[i*3 + 2] = rectIter.next();
storage[i*3 + 3] = rrectIter.next();
}
} // close
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.