blob: f1ed1697ded50d21c1bb359db2c7c498291acff3 [file] [log] [blame]
caryclark@google.com07393ca2013-04-08 11:47:37 +00001/*
2 * Copyright 2012 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7#include "SkOpEdgeBuilder.h"
8#include "SkPathOpsCommon.h"
9#include "SkPathWriter.h"
commit-bot@chromium.orgb76d3b62013-04-22 19:55:19 +000010#include "SkTSort.h"
caryclark@google.com07393ca2013-04-08 11:47:37 +000011
12static int contourRangeCheckY(const SkTDArray<SkOpContour*>& contourList, SkOpSegment** currentPtr,
13 int* indexPtr, int* endIndexPtr, double* bestHit, SkScalar* bestDx,
14 bool* tryAgain, double* midPtr, bool opp) {
15 const int index = *indexPtr;
16 const int endIndex = *endIndexPtr;
17 const double mid = *midPtr;
18 const SkOpSegment* current = *currentPtr;
19 double tAtMid = current->tAtMid(index, endIndex, mid);
20 SkPoint basePt = current->xyAtT(tAtMid);
21 int contourCount = contourList.count();
22 SkScalar bestY = SK_ScalarMin;
23 SkOpSegment* bestSeg = NULL;
caryclark@google.com3e475dc2013-04-11 14:09:50 +000024 int bestTIndex = 0;
caryclark@google.com07393ca2013-04-08 11:47:37 +000025 bool bestOpp;
26 bool hitSomething = false;
27 for (int cTest = 0; cTest < contourCount; ++cTest) {
28 SkOpContour* contour = contourList[cTest];
29 bool testOpp = contour->operand() ^ current->operand() ^ opp;
30 if (basePt.fY < contour->bounds().fTop) {
31 continue;
32 }
33 if (bestY > contour->bounds().fBottom) {
34 continue;
35 }
36 int segmentCount = contour->segments().count();
37 for (int test = 0; test < segmentCount; ++test) {
38 SkOpSegment* testSeg = &contour->segments()[test];
39 SkScalar testY = bestY;
40 double testHit;
41 int testTIndex = testSeg->crossedSpanY(basePt, &testY, &testHit, &hitSomething, tAtMid,
42 testOpp, testSeg == current);
43 if (testTIndex < 0) {
44 if (testTIndex == SK_MinS32) {
45 hitSomething = true;
46 bestSeg = NULL;
47 goto abortContours; // vertical encountered, return and try different point
48 }
49 continue;
50 }
51 if (testSeg == current && current->betweenTs(index, testHit, endIndex)) {
52 double baseT = current->t(index);
53 double endT = current->t(endIndex);
54 double newMid = (testHit - baseT) / (endT - baseT);
55#if DEBUG_WINDING
56 double midT = current->tAtMid(index, endIndex, mid);
57 SkPoint midXY = current->xyAtT(midT);
58 double newMidT = current->tAtMid(index, endIndex, newMid);
59 SkPoint newXY = current->xyAtT(newMidT);
60 SkDebugf("%s [%d] mid=%1.9g->%1.9g s=%1.9g (%1.9g,%1.9g) m=%1.9g (%1.9g,%1.9g)"
61 " n=%1.9g (%1.9g,%1.9g) e=%1.9g (%1.9g,%1.9g)\n", __FUNCTION__,
62 current->debugID(), mid, newMid,
63 baseT, current->xAtT(index), current->yAtT(index),
64 baseT + mid * (endT - baseT), midXY.fX, midXY.fY,
65 baseT + newMid * (endT - baseT), newXY.fX, newXY.fY,
66 endT, current->xAtT(endIndex), current->yAtT(endIndex));
67#endif
68 *midPtr = newMid * 2; // calling loop with divide by 2 before continuing
69 return SK_MinS32;
70 }
71 bestSeg = testSeg;
72 *bestHit = testHit;
73 bestOpp = testOpp;
74 bestTIndex = testTIndex;
75 bestY = testY;
76 }
77 }
78abortContours:
79 int result;
80 if (!bestSeg) {
81 result = hitSomething ? SK_MinS32 : 0;
82 } else {
83 if (bestSeg->windSum(bestTIndex) == SK_MinS32) {
84 *currentPtr = bestSeg;
85 *indexPtr = bestTIndex;
86 *endIndexPtr = bestSeg->nextSpan(bestTIndex, 1);
87 SkASSERT(*indexPtr != *endIndexPtr && *indexPtr >= 0 && *endIndexPtr >= 0);
88 *tryAgain = true;
89 return 0;
90 }
91 result = bestSeg->windingAtT(*bestHit, bestTIndex, bestOpp, bestDx);
caryclark@google.comf11a5af2013-04-10 18:55:11 +000092 SkASSERT(result == SK_MinS32 || *bestDx);
caryclark@google.com07393ca2013-04-08 11:47:37 +000093 }
94 double baseT = current->t(index);
95 double endT = current->t(endIndex);
96 *bestHit = baseT + mid * (endT - baseT);
97 return result;
98}
99
100SkOpSegment* FindUndone(SkTDArray<SkOpContour*>& contourList, int* start, int* end) {
101 int contourCount = contourList.count();
102 SkOpSegment* result;
103 for (int cIndex = 0; cIndex < contourCount; ++cIndex) {
104 SkOpContour* contour = contourList[cIndex];
105 result = contour->undoneSegment(start, end);
106 if (result) {
107 return result;
108 }
109 }
110 return NULL;
111}
112
113SkOpSegment* FindChase(SkTDArray<SkOpSpan*>& chase, int& tIndex, int& endIndex) {
114 while (chase.count()) {
115 SkOpSpan* span;
116 chase.pop(&span);
117 const SkOpSpan& backPtr = span->fOther->span(span->fOtherIndex);
118 SkOpSegment* segment = backPtr.fOther;
119 tIndex = backPtr.fOtherIndex;
120 SkTDArray<SkOpAngle> angles;
121 int done = 0;
122 if (segment->activeAngle(tIndex, &done, &angles)) {
123 SkOpAngle* last = angles.end() - 1;
124 tIndex = last->start();
125 endIndex = last->end();
126 #if TRY_ROTATE
127 *chase.insert(0) = span;
128 #else
129 *chase.append() = span;
130 #endif
131 return last->segment();
132 }
133 if (done == angles.count()) {
134 continue;
135 }
136 SkTDArray<SkOpAngle*> sorted;
137 bool sortable = SkOpSegment::SortAngles(angles, &sorted);
138 int angleCount = sorted.count();
139#if DEBUG_SORT
140 sorted[0]->segment()->debugShowSort(__FUNCTION__, sorted, 0, 0, 0);
141#endif
142 if (!sortable) {
143 continue;
144 }
145 // find first angle, initialize winding to computed fWindSum
146 int firstIndex = -1;
147 const SkOpAngle* angle;
148 int winding;
149 do {
150 angle = sorted[++firstIndex];
151 segment = angle->segment();
152 winding = segment->windSum(angle);
153 } while (winding == SK_MinS32);
154 int spanWinding = segment->spanSign(angle->start(), angle->end());
155 #if DEBUG_WINDING
156 SkDebugf("%s winding=%d spanWinding=%d\n",
157 __FUNCTION__, winding, spanWinding);
158 #endif
159 // turn span winding into contour winding
160 if (spanWinding * winding < 0) {
161 winding += spanWinding;
162 }
163 #if DEBUG_SORT
164 segment->debugShowSort(__FUNCTION__, sorted, firstIndex, winding, 0);
165 #endif
166 // we care about first sign and whether wind sum indicates this
167 // edge is inside or outside. Maybe need to pass span winding
168 // or first winding or something into this function?
169 // advance to first undone angle, then return it and winding
170 // (to set whether edges are active or not)
171 int nextIndex = firstIndex + 1;
172 int lastIndex = firstIndex != 0 ? firstIndex : angleCount;
173 angle = sorted[firstIndex];
174 winding -= angle->segment()->spanSign(angle);
175 do {
176 SkASSERT(nextIndex != firstIndex);
177 if (nextIndex == angleCount) {
178 nextIndex = 0;
179 }
180 angle = sorted[nextIndex];
181 segment = angle->segment();
182 int maxWinding = winding;
183 winding -= segment->spanSign(angle);
184 #if DEBUG_SORT
185 SkDebugf("%s id=%d maxWinding=%d winding=%d sign=%d\n", __FUNCTION__,
186 segment->debugID(), maxWinding, winding, angle->sign());
187 #endif
188 tIndex = angle->start();
189 endIndex = angle->end();
190 int lesser = SkMin32(tIndex, endIndex);
191 const SkOpSpan& nextSpan = segment->span(lesser);
192 if (!nextSpan.fDone) {
193 // FIXME: this be wrong? assign startWinding if edge is in
194 // same direction. If the direction is opposite, winding to
195 // assign is flipped sign or +/- 1?
196 if (SkOpSegment::UseInnerWinding(maxWinding, winding)) {
197 maxWinding = winding;
198 }
199 segment->markAndChaseWinding(angle, maxWinding, 0);
200 break;
201 }
202 } while (++nextIndex != lastIndex);
203 *chase.insert(0) = span;
204 return segment;
205 }
206 return NULL;
207}
208
209#if DEBUG_ACTIVE_SPANS
210void DebugShowActiveSpans(SkTDArray<SkOpContour*>& contourList) {
211 int index;
212 for (index = 0; index < contourList.count(); ++ index) {
213 contourList[index]->debugShowActiveSpans();
214 }
215}
216#endif
217
218static SkOpSegment* findSortableTop(const SkTDArray<SkOpContour*>& contourList,
219 int* index, int* endIndex, SkPoint* topLeft, bool* unsortable,
220 bool* done, bool onlySortable) {
221 SkOpSegment* result;
222 do {
223 SkPoint bestXY = {SK_ScalarMax, SK_ScalarMax};
224 int contourCount = contourList.count();
225 SkOpSegment* topStart = NULL;
226 *done = true;
227 for (int cIndex = 0; cIndex < contourCount; ++cIndex) {
228 SkOpContour* contour = contourList[cIndex];
229 if (contour->done()) {
230 continue;
231 }
232 const SkPathOpsBounds& bounds = contour->bounds();
233 if (bounds.fBottom < topLeft->fY) {
234 *done = false;
235 continue;
236 }
237 if (bounds.fBottom == topLeft->fY && bounds.fRight < topLeft->fX) {
238 *done = false;
239 continue;
240 }
241 contour->topSortableSegment(*topLeft, &bestXY, &topStart);
242 if (!contour->done()) {
243 *done = false;
244 }
245 }
246 if (!topStart) {
247 return NULL;
248 }
249 *topLeft = bestXY;
250 result = topStart->findTop(index, endIndex, unsortable, onlySortable);
251 } while (!result);
252 return result;
253}
254
255static int rightAngleWinding(const SkTDArray<SkOpContour*>& contourList,
256 SkOpSegment** current, int* index, int* endIndex, double* tHit,
257 SkScalar* hitDx, bool* tryAgain, bool opp) {
258 double test = 0.9;
259 int contourWinding;
260 do {
261 contourWinding = contourRangeCheckY(contourList, current, index, endIndex, tHit, hitDx,
262 tryAgain, &test, opp);
263 if (contourWinding != SK_MinS32 || *tryAgain) {
264 return contourWinding;
265 }
266 test /= 2;
267 } while (!approximately_negative(test));
268 SkASSERT(0); // should be OK to comment out, but interested when this hits
269 return contourWinding;
270}
271
272static void skipVertical(const SkTDArray<SkOpContour*>& contourList,
273 SkOpSegment** current, int* index, int* endIndex) {
274 if (!(*current)->isVertical(*index, *endIndex)) {
275 return;
276 }
277 int contourCount = contourList.count();
278 for (int cIndex = 0; cIndex < contourCount; ++cIndex) {
279 SkOpContour* contour = contourList[cIndex];
280 if (contour->done()) {
281 continue;
282 }
283 *current = contour->nonVerticalSegment(index, endIndex);
284 if (*current) {
285 return;
286 }
287 }
288}
289
290SkOpSegment* FindSortableTop(const SkTDArray<SkOpContour*>& contourList, bool* firstContour,
291 int* indexPtr, int* endIndexPtr, SkPoint* topLeft, bool* unsortable,
292 bool* done, bool binary) {
293 SkOpSegment* current = findSortableTop(contourList, indexPtr, endIndexPtr, topLeft, unsortable,
294 done, true);
295 if (!current) {
296 return NULL;
297 }
298 const int index = *indexPtr;
299 const int endIndex = *endIndexPtr;
300 if (*firstContour) {
301 current->initWinding(index, endIndex);
302 *firstContour = false;
303 return current;
304 }
305 int minIndex = SkMin32(index, endIndex);
306 int sumWinding = current->windSum(minIndex);
307 if (sumWinding != SK_MinS32) {
308 return current;
309 }
310 sumWinding = current->computeSum(index, endIndex, binary);
311 if (sumWinding != SK_MinS32) {
312 return current;
313 }
314 int contourWinding;
315 int oppContourWinding = 0;
316 // the simple upward projection of the unresolved points hit unsortable angles
317 // shoot rays at right angles to the segment to find its winding, ignoring angle cases
318 bool tryAgain;
319 double tHit;
320 SkScalar hitDx = 0;
321 SkScalar hitOppDx = 0;
322 do {
323 // if current is vertical, find another candidate which is not
324 // if only remaining candidates are vertical, then they can be marked done
325 SkASSERT(*indexPtr != *endIndexPtr && *indexPtr >= 0 && *endIndexPtr >= 0);
326 skipVertical(contourList, &current, indexPtr, endIndexPtr);
skia.committer@gmail.com32840172013-04-09 07:01:27 +0000327
caryclark@google.com07393ca2013-04-08 11:47:37 +0000328 SkASSERT(*indexPtr != *endIndexPtr && *indexPtr >= 0 && *endIndexPtr >= 0);
329 tryAgain = false;
330 contourWinding = rightAngleWinding(contourList, &current, indexPtr, endIndexPtr, &tHit,
331 &hitDx, &tryAgain, false);
332 if (tryAgain) {
333 continue;
334 }
335 if (!binary) {
336 break;
337 }
338 oppContourWinding = rightAngleWinding(contourList, &current, indexPtr, endIndexPtr, &tHit,
339 &hitOppDx, &tryAgain, true);
340 } while (tryAgain);
341 current->initWinding(*indexPtr, *endIndexPtr, tHit, contourWinding, hitDx, oppContourWinding,
342 hitOppDx);
343 return current;
344}
345
346void FixOtherTIndex(SkTDArray<SkOpContour*>* contourList) {
347 int contourCount = (*contourList).count();
348 for (int cTest = 0; cTest < contourCount; ++cTest) {
349 SkOpContour* contour = (*contourList)[cTest];
350 contour->fixOtherTIndex();
351 }
352}
353
354void SortSegments(SkTDArray<SkOpContour*>* contourList) {
355 int contourCount = (*contourList).count();
356 for (int cTest = 0; cTest < contourCount; ++cTest) {
357 SkOpContour* contour = (*contourList)[cTest];
358 contour->sortSegments();
359 }
360}
361
362void MakeContourList(SkTArray<SkOpContour>& contours, SkTDArray<SkOpContour*>& list,
363 bool evenOdd, bool oppEvenOdd) {
364 int count = contours.count();
365 if (count == 0) {
366 return;
367 }
368 for (int index = 0; index < count; ++index) {
369 SkOpContour& contour = contours[index];
370 contour.setOppXor(contour.operand() ? evenOdd : oppEvenOdd);
371 *list.append() = &contour;
372 }
commit-bot@chromium.orgb76d3b62013-04-22 19:55:19 +0000373 SkTQSort<SkOpContour>(list.begin(), list.end() - 1);
caryclark@google.com07393ca2013-04-08 11:47:37 +0000374}
375
376static bool approximatelyEqual(const SkPoint& a, const SkPoint& b) {
377 return AlmostEqualUlps(a.fX, b.fX) && AlmostEqualUlps(a.fY, b.fY);
378}
379
commit-bot@chromium.orgb76d3b62013-04-22 19:55:19 +0000380class DistanceLessThan {
381public:
382 DistanceLessThan(double* distances) : fDistances(distances) { }
383 double* fDistances;
384 bool operator()(const int one, const int two) {
385 return fDistances[one] < fDistances[two];
386 }
387};
388
caryclark@google.com07393ca2013-04-08 11:47:37 +0000389 /*
390 check start and end of each contour
391 if not the same, record them
392 match them up
393 connect closest
394 reassemble contour pieces into new path
395 */
396void Assemble(const SkPathWriter& path, SkPathWriter* simple) {
397#if DEBUG_PATH_CONSTRUCTION
398 SkDebugf("%s\n", __FUNCTION__);
399#endif
400 SkTArray<SkOpContour> contours;
401 SkOpEdgeBuilder builder(path, contours);
402 builder.finish();
403 int count = contours.count();
404 int outer;
405 SkTDArray<int> runs; // indices of partial contours
406 for (outer = 0; outer < count; ++outer) {
407 const SkOpContour& eContour = contours[outer];
408 const SkPoint& eStart = eContour.start();
409 const SkPoint& eEnd = eContour.end();
410#if DEBUG_ASSEMBLE
411 SkDebugf("%s contour", __FUNCTION__);
412 if (!approximatelyEqual(eStart, eEnd)) {
413 SkDebugf("[%d]", runs.count());
414 } else {
415 SkDebugf(" ");
416 }
417 SkDebugf(" start=(%1.9g,%1.9g) end=(%1.9g,%1.9g)\n",
418 eStart.fX, eStart.fY, eEnd.fX, eEnd.fY);
419#endif
420 if (approximatelyEqual(eStart, eEnd)) {
421 eContour.toPath(simple);
422 continue;
423 }
424 *runs.append() = outer;
425 }
426 count = runs.count();
427 if (count == 0) {
428 return;
429 }
430 SkTDArray<int> sLink, eLink;
431 sLink.setCount(count);
432 eLink.setCount(count);
433 int rIndex, iIndex;
434 for (rIndex = 0; rIndex < count; ++rIndex) {
435 sLink[rIndex] = eLink[rIndex] = SK_MaxS32;
436 }
437 SkTDArray<double> distances;
438 const int ends = count * 2; // all starts and ends
439 const int entries = (ends - 1) * count; // folded triangle : n * (n - 1) / 2
440 distances.setCount(entries);
441 for (rIndex = 0; rIndex < ends - 1; ++rIndex) {
442 outer = runs[rIndex >> 1];
443 const SkOpContour& oContour = contours[outer];
444 const SkPoint& oPt = rIndex & 1 ? oContour.end() : oContour.start();
445 const int row = rIndex < count - 1 ? rIndex * ends : (ends - rIndex - 2)
446 * ends - rIndex - 1;
447 for (iIndex = rIndex + 1; iIndex < ends; ++iIndex) {
448 int inner = runs[iIndex >> 1];
449 const SkOpContour& iContour = contours[inner];
450 const SkPoint& iPt = iIndex & 1 ? iContour.end() : iContour.start();
451 double dx = iPt.fX - oPt.fX;
452 double dy = iPt.fY - oPt.fY;
453 double dist = dx * dx + dy * dy;
454 distances[row + iIndex] = dist; // oStart distance from iStart
455 }
456 }
457 SkTDArray<int> sortedDist;
458 sortedDist.setCount(entries);
459 for (rIndex = 0; rIndex < entries; ++rIndex) {
460 sortedDist[rIndex] = rIndex;
461 }
commit-bot@chromium.orgb76d3b62013-04-22 19:55:19 +0000462 SkTQSort<int>(sortedDist.begin(), sortedDist.end() - 1, DistanceLessThan(distances.begin()));
caryclark@google.com07393ca2013-04-08 11:47:37 +0000463 int remaining = count; // number of start/end pairs
464 for (rIndex = 0; rIndex < entries; ++rIndex) {
465 int pair = sortedDist[rIndex];
466 int row = pair / ends;
467 int col = pair - row * ends;
468 int thingOne = row < col ? row : ends - row - 2;
469 int ndxOne = thingOne >> 1;
470 bool endOne = thingOne & 1;
471 int* linkOne = endOne ? eLink.begin() : sLink.begin();
472 if (linkOne[ndxOne] != SK_MaxS32) {
473 continue;
474 }
475 int thingTwo = row < col ? col : ends - row + col - 1;
476 int ndxTwo = thingTwo >> 1;
477 bool endTwo = thingTwo & 1;
478 int* linkTwo = endTwo ? eLink.begin() : sLink.begin();
479 if (linkTwo[ndxTwo] != SK_MaxS32) {
480 continue;
481 }
482 SkASSERT(&linkOne[ndxOne] != &linkTwo[ndxTwo]);
483 bool flip = endOne == endTwo;
484 linkOne[ndxOne] = flip ? ~ndxTwo : ndxTwo;
485 linkTwo[ndxTwo] = flip ? ~ndxOne : ndxOne;
486 if (!--remaining) {
487 break;
488 }
489 }
490 SkASSERT(!remaining);
491#if DEBUG_ASSEMBLE
492 for (rIndex = 0; rIndex < count; ++rIndex) {
493 int s = sLink[rIndex];
494 int e = eLink[rIndex];
495 SkDebugf("%s %c%d <- s%d - e%d -> %c%d\n", __FUNCTION__, s < 0 ? 's' : 'e',
496 s < 0 ? ~s : s, rIndex, rIndex, e < 0 ? 'e' : 's', e < 0 ? ~e : e);
497 }
498#endif
499 rIndex = 0;
500 do {
501 bool forward = true;
502 bool first = true;
503 int sIndex = sLink[rIndex];
504 SkASSERT(sIndex != SK_MaxS32);
505 sLink[rIndex] = SK_MaxS32;
506 int eIndex;
507 if (sIndex < 0) {
508 eIndex = sLink[~sIndex];
509 sLink[~sIndex] = SK_MaxS32;
510 } else {
511 eIndex = eLink[sIndex];
512 eLink[sIndex] = SK_MaxS32;
513 }
514 SkASSERT(eIndex != SK_MaxS32);
515#if DEBUG_ASSEMBLE
516 SkDebugf("%s sIndex=%c%d eIndex=%c%d\n", __FUNCTION__, sIndex < 0 ? 's' : 'e',
517 sIndex < 0 ? ~sIndex : sIndex, eIndex < 0 ? 's' : 'e',
518 eIndex < 0 ? ~eIndex : eIndex);
519#endif
520 do {
521 outer = runs[rIndex];
522 const SkOpContour& contour = contours[outer];
523 if (first) {
524 first = false;
525 const SkPoint* startPtr = &contour.start();
526 simple->deferredMove(startPtr[0]);
527 }
528 if (forward) {
529 contour.toPartialForward(simple);
530 } else {
531 contour.toPartialBackward(simple);
532 }
533#if DEBUG_ASSEMBLE
534 SkDebugf("%s rIndex=%d eIndex=%s%d close=%d\n", __FUNCTION__, rIndex,
535 eIndex < 0 ? "~" : "", eIndex < 0 ? ~eIndex : eIndex,
536 sIndex == ((rIndex != eIndex) ^ forward ? eIndex : ~eIndex));
537#endif
538 if (sIndex == ((rIndex != eIndex) ^ forward ? eIndex : ~eIndex)) {
539 simple->close();
540 break;
541 }
542 if (forward) {
543 eIndex = eLink[rIndex];
544 SkASSERT(eIndex != SK_MaxS32);
545 eLink[rIndex] = SK_MaxS32;
546 if (eIndex >= 0) {
547 SkASSERT(sLink[eIndex] == rIndex);
548 sLink[eIndex] = SK_MaxS32;
549 } else {
550 SkASSERT(eLink[~eIndex] == ~rIndex);
551 eLink[~eIndex] = SK_MaxS32;
552 }
553 } else {
554 eIndex = sLink[rIndex];
555 SkASSERT(eIndex != SK_MaxS32);
556 sLink[rIndex] = SK_MaxS32;
557 if (eIndex >= 0) {
558 SkASSERT(eLink[eIndex] == rIndex);
559 eLink[eIndex] = SK_MaxS32;
560 } else {
561 SkASSERT(sLink[~eIndex] == ~rIndex);
562 sLink[~eIndex] = SK_MaxS32;
563 }
564 }
565 rIndex = eIndex;
566 if (rIndex < 0) {
567 forward ^= 1;
568 rIndex = ~rIndex;
569 }
570 } while (true);
571 for (rIndex = 0; rIndex < count; ++rIndex) {
572 if (sLink[rIndex] != SK_MaxS32) {
573 break;
574 }
575 }
576 } while (rIndex < count);
577#if DEBUG_ASSEMBLE
578 for (rIndex = 0; rIndex < count; ++rIndex) {
579 SkASSERT(sLink[rIndex] == SK_MaxS32);
580 SkASSERT(eLink[rIndex] == SK_MaxS32);
581 }
582#endif
583}