28 fSecondHalf = preFetch();
64 if (fUnparseable || !walk()) {
75void SkOpEdgeBuilder::closeContour(
const SkPoint& curveEnd,
const SkPoint& curveStart) {
78 *fPathPts.
append() = curveStart;
80 int verbCount = fPathVerbs.
size();
81 int ptsCount = fPathPts.
size();
83 && fPathPts[ptsCount - 2] == curveStart) {
87 fPathPts[ptsCount - 1] = curveStart;
93int SkOpEdgeBuilder::preFetch() {
100 bool lastCurve =
false;
101 for (
auto [pathVerb, pts,
w] :
SkPathPriv::Iterate(*fPath)) {
105 if (!fAllowOpenContours && lastCurve) {
106 closeContour(curve[0], curveStart);
108 *fPathVerbs.
append() = verb;
110 *fPathPts.
append() = curve[0];
111 curveStart = curve[0];
117 uint8_t lastVerb = fPathVerbs.
back();
119 fPathPts.
back() = curve[0] = curve[1];
152 closeContour(curve[0], curveStart);
158 *fPathVerbs.
append() = verb;
160 fPathPts.
append(ptCount, &curve[1]);
164 curve[0] = curve[ptCount];
167 if (!fAllowOpenContours && lastCurve) {
168 closeContour(curve[0], curveStart);
171 return fPathVerbs.
size() - 1;
174bool SkOpEdgeBuilder::close() {
179bool SkOpEdgeBuilder::walk() {
180 uint8_t* verbPtr = fPathVerbs.
begin();
181 uint8_t* endOfFirstHalf = &verbPtr[fSecondHalf];
186 int moveToPtrBump = 0;
188 if (verbPtr == endOfFirstHalf) {
195 if (fAllowOpenContours) {
197 }
else if (!close()) {
204 contour->init(fGlobalState, fOperand,
206 pointsPtr += moveToPtrBump;
210 fContourBuilder.
addLine(pointsPtr);
214 SkVector vec1 = pointsPtr[1] - pointsPtr[0];
215 SkVector vec2 = pointsPtr[2] - pointsPtr[1];
216 if (vec1.
dot(vec2) < 0) {
221 if (!
SkIsFinite(&pair[0].fX, std::size(pair) * 2)) {
224 for (
unsigned index = 0; index < std::size(pair); ++index) {
233 fContourBuilder.
addCurve(v1, curve1);
240 fContourBuilder.
addQuad(pointsPtr);
243 SkVector vec1 = pointsPtr[1] - pointsPtr[0];
244 SkVector vec2 = pointsPtr[2] - pointsPtr[1];
246 if (vec1.
dot(vec2) < 0) {
249 if (0 < maxCurvature && maxCurvature < 1) {
252 if (!
conic.chopAt(maxCurvature, pair)) {
254 fContourBuilder.
addConic(pointsPtr, weight);
263 fContourBuilder.
addCurve(v1, curve1, pair[0].fW);
264 fContourBuilder.
addCurve(
v2, curve2, pair[1].fW);
269 fContourBuilder.
addConic(pointsPtr, weight);
279 fContourBuilder.
addCubic(pointsPtr);
282 SkASSERT(breaks <= (
int) std::size(splitT));
290 SkASSERT(std::size(splits) == std::size(splitT) + 1);
292 for (
int index = 0; index <= breaks; ++index) {
293 Splitsville* split = &splits[index];
294 split->fT[0] = index ? splitT[index - 1] : 0;
295 split->fT[1] = index < breaks ? splitT[index] : 1;
302 ? split->fPts : split->fReduced;
305 for (
int index = 0; index <= breaks; ++index) {
306 Splitsville* split = &splits[index];
307 if (!split->fCanAdd) {
311 while (prior > 0 && !splits[prior - 1].fCanAdd) {
315 split->fT[0] = splits[prior].fT[0];
316 split->fPts[0] = splits[prior].fPts[0];
319 int breakLimit = std::min(breaks, (
int) std::size(splits) - 1);
320 while (
next < breakLimit && !splits[
next + 1].fCanAdd) {
324 split->fT[1] = splits[
next].fT[1];
325 split->fPts[3] = splits[
next].fPts[3];
327 if (prior < index || next > index) {
331 ? split->fPts : split->fReduced;
335 fContourBuilder.
addCurve(split->fVerb, curve);
356 fContourBuilder.
flush();
357 if (
contour &&
contour->count() &&!fAllowOpenContours && !close()) {
static float next(float f)
#define SkDEBUGFAIL(message)
static bool SkIsFinite(T x, Pack... values)
SkScalar SkFindQuadMaxCurvature(const SkPoint src[3])
int SkChopQuadAtMaxCurvature(const SkPoint src[3], SkPoint dst[5])
static SkPoint force_small_to_zero(const SkPoint &pt)
static bool can_add_curve(SkPath::Verb verb, SkPoint *curve)
const double FLT_EPSILON_ORDERABLE_ERR
int SkPathOpsVerbToPoints(SkPath::Verb verb)
void SkTQSort(T *begin, T *end, const C &lessThan)
Type::kYUV Type::kRGBA() int(0.7 *637)
void addConic(SkPoint pts[3], SkScalar weight)
void addCurve(SkPath::Verb verb, const SkPoint pts[4], SkScalar weight=1)
void setContour(SkOpContour *contour)
void addCubic(SkPoint pts[4])
void addQuad(SkPoint pts[3])
void addLine(const SkPoint pts[2])
SkOpContour * appendContour()
void remove(SkOpContour *contour)
void addOperand(const SkPath &path)
SkPathFillType getFillType() const
bool toFloatPoints(SkPoint *) const
static SkDCubic SubDivide(const SkPoint a[kPointCount], double t1, double t2)
static int ComplexBreak(const SkPoint pts[4], SkScalar *t)
static bool ApproximatelyEqual(const SkPoint &a, const SkPoint &b)
float dot(const SkVector &vec) const
static SkPath::Verb Cubic(const SkPoint pts[4], SkPoint *reducePts)
static SkPath::Verb Conic(const SkConic &conic, SkPoint *reducePts)
static SkPath::Verb Quad(const SkPoint pts[3], SkPoint *reducePts)