26void SkPathWriter::close() {
31#if DEBUG_PATH_CONSTRUCTION
42#if DEBUG_PATH_CONSTRUCTION
43 SkDebugf(
"path.conicTo(%1.9g,%1.9g, %1.9g,%1.9g, %1.9g);\n",
44 pt1.
fX, pt1.
fY, pt2pt.
fX, pt2pt.
fY, weight);
46 fCurrent.
conicTo(pt1, pt2pt, weight);
51#if DEBUG_PATH_CONSTRUCTION
52 SkDebugf(
"path.cubicTo(%1.9g,%1.9g, %1.9g,%1.9g, %1.9g,%1.9g);\n",
55 fCurrent.
cubicTo(pt1, pt2, pt3pt);
61 if (fDefer[0] == pt) {
69 if (this->matchedLast(pt)) {
72 if (fDefer[1] && this->changedSlopes(pt)) {
74 fDefer[0] = fDefer[1];
82 fFirstPtT = fDefer[0] = pt;
86 if (!this->matchedLast(pt)) {
88 fFirstPtT = fDefer[0] = pt;
93 if (!this->matchedLast(fDefer[0])) {
115 fFirstPtT = fDefer[0] = fDefer[1] =
nullptr;
119 return this->matchedLast(fFirstPtT);
122void SkPathWriter::lineTo() {
126#if DEBUG_PATH_CONSTRUCTION
127 SkDebugf(
"path.lineTo(%1.9g,%1.9g);\n", fDefer[1]->fPt.fX, fDefer[1]->fPt.fY);
129 fCurrent.
lineTo(fDefer[1]->fPt);
132bool SkPathWriter::matchedLast(
const SkOpPtT*
test)
const {
133 if (
test == fDefer[1]) {
142 return test->contains(fDefer[1]);
145void SkPathWriter::moveTo() {
146#if DEBUG_PATH_CONSTRUCTION
154#if DEBUG_PATH_CONSTRUCTION
155 SkDebugf(
"path.quadTo(%1.9g,%1.9g, %1.9g,%1.9g);\n",
156 pt1.
fX, pt1.
fY, pt2pt.
fX, pt2pt.
fY);
158 fCurrent.
quadTo(pt1, pt2pt);
166 }
else if (!this->matchedLast(fDefer[0])) {
173 fDefer[0] = fDefer[1] = pt;
177bool SkPathWriter::someAssemblyRequired() {
179 return !fEndPtTs.
empty();
182bool SkPathWriter::changedSlopes(
const SkOpPtT* ptT)
const {
183 if (matchedLast(fDefer[0])) {
188 return deferDxdy.
fX * lineDxdy.
fY != deferDxdy.
fY * lineDxdy.
fX;
208 if (!this->someAssemblyRequired()) {
211#if DEBUG_PATH_CONSTRUCTION
215 int endCount = fEndPtTs.
size();
219 for (
int index = 0; index < endCount; index += 2) {
220 const SkOpPtT* eStart = runs[index];
221 const SkOpPtT* eEnd = runs[index + 1];
224 SkDebugf(
"%s contour start=(%1.9g,%1.9g) end=(%1.9g,%1.9g)\n", __FUNCTION__,
229 for (
int pIndex = 0; pIndex < endCount; pIndex++) {
239 int step = opPtT->
fT ? 1 : -1;
246 if (
start->starter(opSpanEnd)->alreadyAdded()) {
250 opPtT = opSpanEnd->
ptT();
256 if (partPartials.
empty()) {
260 SkPath& partial =
const_cast<SkPath&
>(fPartials[pIndex >> 1]);
261 const SkPath& part = partPartials[0];
272 int linkCount = endCount / 2;
276 for (rIndex = 0; rIndex < linkCount; ++rIndex) {
277 sLink[rIndex] = eLink[rIndex] =
SK_MaxS32;
279 const int entries = endCount * (endCount - 1) / 2;
285 for (rIndex = 0; rIndex < endCount - 1; ++rIndex) {
286 const SkOpPtT* oPtT = runs[rIndex];
287 for (iIndex = rIndex + 1; iIndex < endCount; ++iIndex) {
288 const SkOpPtT* iPtT = runs[iIndex];
291 double dist =
dx *
dx + dy * dy;
293 distances.push_back(dist);
300 int remaining = linkCount;
301 for (rIndex = 0; rIndex < entries; ++rIndex) {
302 int pair = sortedDist[rIndex];
303 pair = distLookup[pair];
304 int row = pair / endCount;
305 int col = pair - row * endCount;
306 int ndxOne = row >> 1;
307 bool endOne = row & 1;
308 int* linkOne = endOne ? eLink.
begin() : sLink.
begin();
312 int ndxTwo = col >> 1;
313 bool endTwo = col & 1;
314 int* linkTwo = endTwo ? eLink.
begin() : sLink.
begin();
318 SkASSERT(&linkOne[ndxOne] != &linkTwo[ndxTwo]);
319 bool flip = endOne == endTwo;
320 linkOne[ndxOne] = flip ? ~ndxTwo : ndxTwo;
321 linkTwo[ndxTwo] = flip ? ~ndxOne : ndxOne;
328 for (rIndex = 0; rIndex < linkCount; ++rIndex) {
329 int s = sLink[rIndex];
330 int e = eLink[rIndex];
331 SkDebugf(
"%s %c%d <- s%d - e%d -> %c%d\n", __FUNCTION__,
s < 0 ?
's' :
'e',
332 s < 0 ? ~
s :
s, rIndex, rIndex,
e < 0 ?
'e' :
's',
e < 0 ? ~
e :
e);
339 int sIndex = sLink[rIndex];
344 eIndex = sLink[~sIndex];
347 eIndex = eLink[sIndex];
352 SkDebugf(
"%s sIndex=%c%d eIndex=%c%d\n", __FUNCTION__, sIndex < 0 ?
's' :
'e',
353 sIndex < 0 ? ~sIndex : sIndex, eIndex < 0 ?
's' :
'e',
354 eIndex < 0 ? ~eIndex : eIndex);
380 fPathPtr->reversePathTo(
contour);
386 SkDebugf(
"%s rIndex=%d eIndex=%s%d close=%d\n", __FUNCTION__, rIndex,
387 eIndex < 0 ?
"~" :
"", eIndex < 0 ? ~eIndex : eIndex,
388 sIndex == ((rIndex != eIndex) ^ forward ? eIndex : ~eIndex));
390 if (sIndex == ((rIndex != eIndex) ^ forward ? eIndex : ~eIndex)) {
395 eIndex = eLink[rIndex];
402 SkASSERT(eLink[~eIndex] == ~rIndex);
406 eIndex = sLink[rIndex];
413 SkASSERT(sLink[~eIndex] == ~rIndex);
423 for (rIndex = 0; rIndex < linkCount; ++rIndex) {
428 }
while (rIndex < linkCount);
430 for (rIndex = 0; rIndex < linkCount; ++rIndex) {
static int step(int x, SkScalar min, SkScalar max)
SkAssertResult(font.textToGlyphs("Hello", 5, SkTextEncoding::kUTF8, glyphs, std::size(glyphs))==count)
static float next(float f)
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static constexpr int32_t SK_MaxS32
bool zero_or_one(double x)
DistanceLessThan(double *distances)
bool operator()(const int one, const int two) const
const SkOpSpanBase * span() const
bool contains(const SkOpPtT *) const
SkOpSegment * isSimple(SkOpSpanBase **end, int *step) const
bool addCurveTo(const SkOpSpanBase *start, const SkOpSpanBase *end, SkPathWriter *path) const
const SkOpSpan * prev() const
SkOpSegment * segment() const
const SkOpPtT * ptT() const
SkOpSpanBase * next() const
void deferredMove(const SkOpPtT *pt)
void conicTo(const SkPoint &pt1, const SkOpPtT *pt2, SkScalar weight)
void cubicTo(const SkPoint &pt1, const SkPoint &pt2, const SkOpPtT *pt3)
SkPathWriter(SkPath &path)
bool deferredLine(const SkOpPtT *pt)
void quadTo(const SkPoint &pt1, const SkOpPtT *pt2)
SkPath & moveTo(SkScalar x, SkScalar y)
bool getLastPt(SkPoint *lastPt) const
SkPath & lineTo(SkScalar x, SkScalar y)
SkPath & addPath(const SkPath &src, SkScalar dx, SkScalar dy, AddPathMode mode=kAppend_AddPathMode)
SkPath & quadTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2)
SkPath & cubicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar x3, SkScalar y3)
SkPath & conicTo(SkScalar x1, SkScalar y1, SkScalar x2, SkScalar y2, SkScalar w)
void push_back(const T &v)
skia_private::AutoTArray< sk_sp< SkImageFilter > > filters TypedMatrix matrix TypedMatrix matrix SkScalar dx
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