Lines Matching defs:runs

76 static SkRegionPriv::RunType* skip_intervals(const SkRegionPriv::RunType runs[]) {
77 int intervals = runs[-1];
80 SkASSERT(runs[0] < runs[1]);
81 SkASSERT(runs[1] < SkRegion_kRunTypeSentinel);
84 SkASSERT(SkRegion_kRunTypeSentinel == runs[0]);
87 runs += intervals * 2 + 1;
88 return const_cast<SkRegionPriv::RunType*>(runs);
91 bool SkRegion::RunsAreARect(const SkRegion::RunType runs[], int count,
93 assert_sentinel(runs[0], false); // top
97 assert_sentinel(runs[1], false); // bottom
98 SkASSERT(1 == runs[2]);
99 assert_sentinel(runs[3], false); // left
100 assert_sentinel(runs[4], false); // right
101 assert_sentinel(runs[5], true);
102 assert_sentinel(runs[6], true);
104 SkASSERT(runs[0] < runs[1]); // valid height
105 SkASSERT(runs[3] < runs[4]); // valid width
107 bounds->setLTRB(runs[3], runs[0], runs[4], runs[1]);
271 bool SkRegion::setRuns(RunType runs[], int count) {
277 assert_sentinel(runs[count-1], true);
284 RunType* stop = runs + count;
285 assert_sentinel(runs[0], false); // top
286 assert_sentinel(runs[1], false); // bottom
287 // runs[2] is uncomputed intervalCount
289 if (runs[3] == SkRegion_kRunTypeSentinel) { // should be first left...
290 runs += 3; // skip empty initial span
291 runs[0] = runs[-2]; // set new top to prev bottom
292 assert_sentinel(runs[1], false); // bot: a sentinal would mean two in a row
293 assert_sentinel(runs[2], false); // intervalcount
294 assert_sentinel(runs[3], false); // left
295 assert_sentinel(runs[4], false); // right
302 if (stop[-5] == SkRegion_kRunTypeSentinel) { // eek, stop[-4] was a bottom with no x-runs
312 count = (int)(stop - runs);
317 if (SkRegion::RunsAreARect(runs, count, &fBounds)) {
329 // must call this before we can write directly into runs()
332 memcpy(fRunHead->writable_runs(), runs, count * sizeof(RunType));
346 RunType runs[kRectRegionRuns]) {
347 runs[0] = bounds.fTop;
348 runs[1] = bounds.fBottom;
349 runs[2] = 1; // 1 interval for this scanline
350 runs[3] = bounds.fLeft;
351 runs[4] = bounds.fRight;
352 runs[5] = SkRegion_kRunTypeSentinel;
353 runs[6] = SkRegion_kRunTypeSentinel;
367 const RunType* runs = fRunHead->findScanline(y);
370 runs += 2;
373 // appear as a left-inteval (runs[0]) and should abort the search.
375 // We could do a bsearch, using interval-count (runs[1]), but need to time
379 if (x < runs[0]) {
382 if (x < runs[1]) {
385 runs += 2;
390 static SkRegionPriv::RunType scanline_bottom(const SkRegionPriv::RunType runs[]) {
391 return runs[0];
394 static const SkRegionPriv::RunType* scanline_next(const SkRegionPriv::RunType runs[]) {
396 return runs + 2 + runs[1] * 2 + 1;
399 static bool scanline_contains(const SkRegionPriv::RunType runs[],
401 runs += 2; // skip Bottom and IntervalCount
403 if (L < runs[0]) {
406 if (R <= runs[1]) {
409 runs += 2;
462 const RunType* runs = tmpStorage;
471 runs = fRunHead->readonly_runs();
474 return runs;
479 static bool scanline_intersects(const SkRegionPriv::RunType runs[],
481 runs += 2; // skip Bottom and IntervalCount
483 if (R <= runs[0]) {
486 if (L < runs[1]) {
489 runs += 2;
768 static int distance_to_sentinel(const SkRegionPriv::RunType* runs) {
769 const SkRegionPriv::RunType* ptr = runs;
771 return ptr - runs;
1193 // never read beyond &runs[runCount-1].
1194 static bool validate_run(const int32_t* runs,
1206 if (runs[runCount - 1] != SkRegion_kRunTypeSentinel ||
1207 runs[runCount - 2] != SkRegion_kRunTypeSentinel) {
1210 const int32_t* const end = runs + runCount;
1213 rect.fTop = *runs++;
1225 rect.fBottom = *runs++;
1236 int32_t xIntervals = *runs++;
1237 SkASSERT(runs < end);
1238 if (xIntervals < 0 || xIntervals > intervalCount || runs + 1 + 2 * xIntervals > end) {
1245 rect.fLeft = *runs++;
1246 rect.fRight = *runs++;
1257 if (*runs++ != SkRegion_kRunTypeSentinel) {
1261 SkASSERT(runs < end);
1262 } while (*runs != SkRegion_kRunTypeSentinel);
1263 ++runs;
1267 SkASSERT(runs == end); // if ySpanCount && intervalCount are right, must be correct length.
1300 return 0; // invalid runs, don't even allocate
1344 const RunType* runs = fRunHead->readonly_runs();
1346 desc += " " + std::to_string(runs[i]);
1363 const RunType* runs = fRunHead->readonly_runs();
1365 SkDebugf(" %d", runs[i]);
1415 const RunType* runs = fRuns;
1417 if (runs[0] < SkRegion_kRunTypeSentinel) { // valid X value
1418 fRect.fLeft = runs[0];
1419 fRect.fRight = runs[1];
1420 runs += 2;
1422 runs += 1;
1423 if (runs[0] < SkRegion_kRunTypeSentinel) { // valid Y value
1424 int intervals = runs[1];
1426 fRect.fTop = runs[0];
1427 runs += 3;
1432 fRect.fBottom = runs[0];
1433 assert_sentinel(runs[2], false);
1434 assert_sentinel(runs[3], false);
1435 fRect.fLeft = runs[2];
1436 fRect.fRight = runs[3];
1437 runs += 4;
1442 fRuns = runs;
1505 const SkRegion::RunType* runs = rgn.fRunHead->findScanline(y);
1506 runs += 2; // skip Bottom and IntervalCount
1508 // runs[0..1] is to the right of the span, so we're done
1509 if (runs[0] >= right) {
1512 // runs[0..1] is to the left of the span, so continue
1513 if (runs[1] <= left) {
1514 runs += 2;
1517 // runs[0..1] intersects the span
1518 fRuns = runs;
1544 const SkRegion::RunType* runs = fRuns;
1546 if (runs[0] >= fRight) {
1551 SkASSERT(runs[1] > fLeft);
1554 *left = std::max(fLeft, runs[0]);
1557 *right = std::min(fRight, runs[1]);
1559 fRuns = runs + 2;