Lines Matching refs:runs
33 static SkRegion::RunType* skip_intervals(const SkRegion::RunType runs[]) {
34 int intervals = runs[-1];
37 SkASSERT(runs[0] < runs[1]);
38 SkASSERT(runs[1] < SkRegion::kRunTypeSentinel);
41 SkASSERT(SkRegion::kRunTypeSentinel == runs[0]);
44 runs += intervals * 2 + 1;
45 return const_cast<SkRegion::RunType*>(runs);
48 bool SkRegion::RunsAreARect(const SkRegion::RunType runs[], int count,
50 assert_sentinel(runs[0], false); // top
54 assert_sentinel(runs[1], false); // bottom
55 SkASSERT(1 == runs[2]);
56 assert_sentinel(runs[3], false); // left
57 assert_sentinel(runs[4], false); // right
58 assert_sentinel(runs[5], true);
59 assert_sentinel(runs[6], true);
61 SkASSERT(runs[0] < runs[1]); // valid height
62 SkASSERT(runs[3] < runs[4]); // valid width
64 bounds->set(runs[3], runs[0], runs[4], runs[1]);
232 bool SkRegion::setRuns(RunType runs[], int count) {
238 assert_sentinel(runs[count-1], true);
245 RunType* stop = runs + count;
246 assert_sentinel(runs[0], false); // top
247 assert_sentinel(runs[1], false); // bottom
248 // runs[2] is uncomputed intervalCount
250 if (runs[3] == SkRegion::kRunTypeSentinel) { // should be first left...
251 runs += 3; // skip empty initial span
252 runs[0] = runs[-2]; // set new top to prev bottom
253 assert_sentinel(runs[1], false); // bot: a sentinal would mean two in a row
254 assert_sentinel(runs[2], false); // intervalcount
255 assert_sentinel(runs[3], false); // left
256 assert_sentinel(runs[4], false); // right
263 if (stop[-5] == SkRegion::kRunTypeSentinel) { // eek, stop[-4] was a bottom with no x-runs
273 count = (int)(stop - runs);
278 if (SkRegion::RunsAreARect(runs, count, &fBounds)) {
289 // must call this before we can write directly into runs()
292 memcpy(fRunHead->writable_runs(), runs, count * sizeof(RunType));
301 RunType runs[kRectRegionRuns]) {
302 runs[0] = bounds.fTop;
303 runs[1] = bounds.fBottom;
304 runs[2] = 1; // 1 interval for this scanline
305 runs[3] = bounds.fLeft;
306 runs[4] = bounds.fRight;
307 runs[5] = kRunTypeSentinel;
308 runs[6] = kRunTypeSentinel;
322 const RunType* runs = fRunHead->findScanline(y);
325 runs += 2;
328 // appear as a left-inteval (runs[0]) and should abort the search.
330 // We could do a bsearch, using interval-count (runs[1]), but need to time
334 if (x < runs[0]) {
337 if (x < runs[1]) {
340 runs += 2;
345 static SkRegion::RunType scanline_bottom(const SkRegion::RunType runs[]) {
346 return runs[0];
349 static const SkRegion::RunType* scanline_next(const SkRegion::RunType runs[]) {
351 return runs + 2 + runs[1] * 2 + 1;
354 static bool scanline_contains(const SkRegion::RunType runs[],
356 runs += 2; // skip Bottom and IntervalCount
358 if (L < runs[0]) {
361 if (R <= runs[1]) {
364 runs += 2;
417 const RunType* runs = tmpStorage;
426 runs = fRunHead->readonly_runs();
429 return runs;
434 static bool scanline_intersects(const SkRegion::RunType runs[],
436 runs += 2; // skip Bottom and IntervalCount
438 if (R <= runs[0]) {
441 if (L < runs[1]) {
444 runs += 2;
1166 static const SkRegion::RunType* skip_intervals_slow(const SkRegion::RunType runs[]) {
1173 while (runs[0] < SkRegion::kRunTypeSentinel) {
1174 SkASSERT(prevR < runs[0]);
1175 SkASSERT(runs[0] < runs[1]);
1176 SkASSERT(runs[1] < SkRegion::kRunTypeSentinel);
1177 prevR = runs[1];
1178 runs += 2;
1180 return runs;
1183 static void compute_bounds(const SkRegion::RunType runs[],
1186 assert_sentinel(runs[0], false); // top
1194 bounds->fTop = *runs++;
1196 bot = *runs++;
1201 runs += 1; // skip intervalCount for now
1202 if (*runs < SkRegion::kRunTypeSentinel) {
1203 if (left > *runs) {
1204 left = *runs;
1207 const SkRegion::RunType* prev = runs;
1208 runs = skip_intervals_slow(runs);
1209 int intervals = SkToInt((runs - prev) >> 1);
1213 if (rite < runs[-1]) {
1214 rite = runs[-1];
1217 SkASSERT(0 == runs[-1]); // no intervals
1219 SkASSERT(SkRegion::kRunTypeSentinel == *runs);
1220 runs += 1;
1221 } while (SkRegion::kRunTypeSentinel != *runs);
1244 // check that our bounds match our runs
1266 const RunType* runs = fRunHead->readonly_runs();
1268 SkDebugf(" %d", runs[i]);
1318 const RunType* runs = fRuns;
1320 if (runs[0] < kRunTypeSentinel) { // valid X value
1321 fRect.fLeft = runs[0];
1322 fRect.fRight = runs[1];
1323 runs += 2;
1325 runs += 1;
1326 if (runs[0] < kRunTypeSentinel) { // valid Y value
1327 int intervals = runs[1];
1329 fRect.fTop = runs[0];
1330 runs += 3;
1335 fRect.fBottom = runs[0];
1336 assert_sentinel(runs[2], false);
1337 assert_sentinel(runs[3], false);
1338 fRect.fLeft = runs[2];
1339 fRect.fRight = runs[3];
1340 runs += 4;
1345 fRuns = runs;
1408 const SkRegion::RunType* runs = rgn.fRunHead->findScanline(y);
1409 runs += 2; // skip Bottom and IntervalCount
1411 // runs[0..1] is to the right of the span, so we're done
1412 if (runs[0] >= right) {
1415 // runs[0..1] is to the left of the span, so continue
1416 if (runs[1] <= left) {
1417 runs += 2;
1420 // runs[0..1] intersects the span
1421 fRuns = runs;
1447 const SkRegion::RunType* runs = fRuns;
1449 if (runs[0] >= fRight) {
1454 SkASSERT(runs[1] > fLeft);
1457 *left = SkMax32(fLeft, runs[0]);
1460 *right = SkMin32(fRight, runs[1]);
1462 fRuns = runs + 2;
1470 bool SkRegion::debugSetRuns(const RunType runs[], int count) {
1475 memcpy(storage.get(), runs, count * sizeof(RunType));