Lines Matching full:runs
77 static SkRegionPriv::RunType* skip_intervals(const SkRegionPriv::RunType runs[]) { in skip_intervals() argument
78 int intervals = runs[-1]; in skip_intervals()
81 SkASSERT(runs[0] < runs[1]); in skip_intervals()
82 SkASSERT(runs[1] < SkRegion_kRunTypeSentinel); in skip_intervals()
85 SkASSERT(SkRegion_kRunTypeSentinel == runs[0]); in skip_intervals()
88 runs += intervals * 2 + 1; in skip_intervals()
89 return const_cast<SkRegionPriv::RunType*>(runs); in skip_intervals()
92 bool SkRegion::RunsAreARect(const SkRegion::RunType runs[], int count, in RunsAreARect() argument
94 assert_sentinel(runs[0], false); // top in RunsAreARect()
98 assert_sentinel(runs[1], false); // bottom in RunsAreARect()
99 SkASSERT(1 == runs[2]); in RunsAreARect()
100 assert_sentinel(runs[3], false); // left in RunsAreARect()
101 assert_sentinel(runs[4], false); // right in RunsAreARect()
102 assert_sentinel(runs[5], true); in RunsAreARect()
103 assert_sentinel(runs[6], true); in RunsAreARect()
105 SkASSERT(runs[0] < runs[1]); // valid height in RunsAreARect()
106 SkASSERT(runs[3] < runs[4]); // valid width in RunsAreARect()
108 bounds->set(runs[3], runs[0], runs[4], runs[1]); in RunsAreARect()
272 bool SkRegion::setRuns(RunType runs[], int count) { in setRuns() argument
278 assert_sentinel(runs[count-1], true); in setRuns()
285 RunType* stop = runs + count; in setRuns()
286 assert_sentinel(runs[0], false); // top in setRuns()
287 assert_sentinel(runs[1], false); // bottom in setRuns()
288 // runs[2] is uncomputed intervalCount in setRuns()
290 if (runs[3] == SkRegion_kRunTypeSentinel) { // should be first left... in setRuns()
291 runs += 3; // skip empty initial span in setRuns()
292 runs[0] = runs[-2]; // set new top to prev bottom in setRuns()
293 assert_sentinel(runs[1], false); // bot: a sentinal would mean two in a row in setRuns()
294 assert_sentinel(runs[2], false); // intervalcount in setRuns()
295 assert_sentinel(runs[3], false); // left in setRuns()
296 assert_sentinel(runs[4], false); // right in setRuns()
303 if (stop[-5] == SkRegion_kRunTypeSentinel) { // eek, stop[-4] was a bottom with no x-runs in setRuns()
313 count = (int)(stop - runs); in setRuns()
318 if (SkRegion::RunsAreARect(runs, count, &fBounds)) { in setRuns()
330 // must call this before we can write directly into runs() in setRuns()
333 memcpy(fRunHead->writable_runs(), runs, count * sizeof(RunType)); in setRuns()
347 RunType runs[kRectRegionRuns]) { in BuildRectRuns()
348 runs[0] = bounds.fTop; in BuildRectRuns()
349 runs[1] = bounds.fBottom; in BuildRectRuns()
350 runs[2] = 1; // 1 interval for this scanline in BuildRectRuns()
351 runs[3] = bounds.fLeft; in BuildRectRuns()
352 runs[4] = bounds.fRight; in BuildRectRuns()
353 runs[5] = SkRegion_kRunTypeSentinel; in BuildRectRuns()
354 runs[6] = SkRegion_kRunTypeSentinel; in BuildRectRuns()
368 const RunType* runs = fRunHead->findScanline(y); in contains() local
371 runs += 2; in contains()
374 // appear as a left-inteval (runs[0]) and should abort the search. in contains()
376 // We could do a bsearch, using interval-count (runs[1]), but need to time in contains()
380 if (x < runs[0]) { in contains()
383 if (x < runs[1]) { in contains()
386 runs += 2; in contains()
391 static SkRegionPriv::RunType scanline_bottom(const SkRegionPriv::RunType runs[]) { in scanline_bottom() argument
392 return runs[0]; in scanline_bottom()
395 static const SkRegionPriv::RunType* scanline_next(const SkRegionPriv::RunType runs[]) { in scanline_next() argument
397 return runs + 2 + runs[1] * 2 + 1; in scanline_next()
400 static bool scanline_contains(const SkRegionPriv::RunType runs[], in scanline_contains() argument
402 runs += 2; // skip Bottom and IntervalCount in scanline_contains()
404 if (L < runs[0]) { in scanline_contains()
407 if (R <= runs[1]) { in scanline_contains()
410 runs += 2; in scanline_contains()
463 const RunType* runs = tmpStorage; in getRuns() local
472 runs = fRunHead->readonly_runs(); in getRuns()
475 return runs; in getRuns()
480 static bool scanline_intersects(const SkRegionPriv::RunType runs[], in scanline_intersects() argument
482 runs += 2; // skip Bottom and IntervalCount in scanline_intersects()
484 if (R <= runs[0]) { in scanline_intersects()
487 if (L < runs[1]) { in scanline_intersects()
490 runs += 2; in scanline_intersects()
769 static int distance_to_sentinel(const SkRegionPriv::RunType* runs) { in distance_to_sentinel() argument
770 const SkRegionPriv::RunType* ptr = runs; in distance_to_sentinel()
772 return ptr - runs; in distance_to_sentinel()
1195 // never read beyond &runs[runCount-1].
1196 static bool validate_run(const int32_t* runs, in validate_run() argument
1208 if (runs[runCount - 1] != SkRegion_kRunTypeSentinel || in validate_run()
1209 runs[runCount - 2] != SkRegion_kRunTypeSentinel) { in validate_run()
1212 const int32_t* const end = runs + runCount; in validate_run()
1215 rect.fTop = *runs++; in validate_run()
1227 rect.fBottom = *runs++; in validate_run()
1238 int32_t xIntervals = *runs++; in validate_run()
1239 SkASSERT(runs < end); in validate_run()
1240 if (xIntervals < 0 || xIntervals > intervalCount || runs + 1 + 2 * xIntervals > end) { in validate_run()
1247 rect.fLeft = *runs++; in validate_run()
1248 rect.fRight = *runs++; in validate_run()
1259 if (*runs++ != SkRegion_kRunTypeSentinel) { in validate_run()
1263 SkASSERT(runs < end); in validate_run()
1264 } while (*runs != SkRegion_kRunTypeSentinel); in validate_run()
1265 ++runs; in validate_run()
1269 SkASSERT(runs == end); // if ySpanCount && intervalCount are right, must be correct length. in validate_run()
1283 // COUNT LEFT TOP RIGHT BOTTOM Y_SPAN_COUNT TOTAL_INTERVAL_COUNT [RUNS....] in readFromMemory()
1302 return 0; // invalid runs, don't even allocate in readFromMemory()
1341 const RunType* runs = fRunHead->readonly_runs(); in dump() local
1343 SkDebugf(" %d", runs[i]); in dump()
1393 const RunType* runs = fRuns; in next() local
1395 if (runs[0] < SkRegion_kRunTypeSentinel) { // valid X value in next()
1396 fRect.fLeft = runs[0]; in next()
1397 fRect.fRight = runs[1]; in next()
1398 runs += 2; in next()
1400 runs += 1; in next()
1401 if (runs[0] < SkRegion_kRunTypeSentinel) { // valid Y value in next()
1402 int intervals = runs[1]; in next()
1404 fRect.fTop = runs[0]; in next()
1405 runs += 3; in next()
1410 fRect.fBottom = runs[0]; in next()
1411 assert_sentinel(runs[2], false); in next()
1412 assert_sentinel(runs[3], false); in next()
1413 fRect.fLeft = runs[2]; in next()
1414 fRect.fRight = runs[3]; in next()
1415 runs += 4; in next()
1420 fRuns = runs; in next()
1483 const SkRegion::RunType* runs = rgn.fRunHead->findScanline(y); in Spanerator() local
1484 runs += 2; // skip Bottom and IntervalCount in Spanerator()
1486 // runs[0..1] is to the right of the span, so we're done in Spanerator()
1487 if (runs[0] >= right) { in Spanerator()
1490 // runs[0..1] is to the left of the span, so continue in Spanerator()
1491 if (runs[1] <= left) { in Spanerator()
1492 runs += 2; in Spanerator()
1495 // runs[0..1] intersects the span in Spanerator()
1496 fRuns = runs; in Spanerator()
1522 const SkRegion::RunType* runs = fRuns; in next() local
1524 if (runs[0] >= fRight) { in next()
1529 SkASSERT(runs[1] > fLeft); in next()
1532 *left = SkMax32(fLeft, runs[0]); in next()
1535 *right = SkMin32(fRight, runs[1]); in next()
1537 fRuns = runs + 2; in next()