Home | History | Annotate | Download | only in core

Lines Matching full:runs

32 static SkRegion::RunType* skip_scanline(const SkRegion::RunType runs[])
34 while (runs[0] != SkRegion::kRunTypeSentinel)
36 SkASSERT(runs[0] < runs[1]); // valid span
37 runs += 2;
39 return (SkRegion::RunType*)(runs + 1); // return past the X-sentinel
42 // returns true if runs are just a rect
43 bool SkRegion::ComputeRunBounds(const SkRegion::RunType runs[], int count, SkIRect* bounds)
45 assert_sentinel(runs[0], false); // top
49 assert_sentinel(runs[1], false); // bottom
50 assert_sentinel(runs[2], false); // left
51 assert_sentinel(runs[3], false); // right
52 assert_sentinel(runs[4], true);
53 assert_sentinel(runs[5], true);
55 SkASSERT(runs[0] < runs[1]); // valid height
56 SkASSERT(runs[2] < runs[3]); // valid width
58 bounds->set(runs[2], runs[0], runs[3], runs[1]);
66 bounds->fTop = *runs++;
68 bot = *runs++;
69 if (*runs < SkRegion::kRunTypeSentinel)
71 if (left > *runs)
72 left = *runs;
73 runs = skip_scanline(runs);
74 if (rite < runs[-2])
75 rite = runs[-2];
78 runs += 1; // skip X-sentinel
79 } while (runs[0] < SkRegion::kRunTypeSentinel);
228 const RunType* runs = fRunHead->readonly_runs() + 1;
232 const RunType* next = skip_scanline(runs + 1);
233 SkASSERT(next > runs);
234 int T = (int)(next - runs - 1);
237 runs = next;
238 } while (runs[0] < SkRegion::kRunTypeSentinel);
245 bool SkRegion::setRuns(RunType runs[], int count)
253 assert_sentinel(runs[count-1], true);
261 RunType* stop = runs + count;
262 assert_sentinel(runs[0], false); // top
263 assert_sentinel(runs[1], false); // bottom
264 if (runs[2] == SkRegion::kRunTypeSentinel) // should be first left...
266 runs += 2; // skip empty initial span
267 runs[0] = runs[-1]; // set new top to prev bottom
268 assert_sentinel(runs[1], false); // bot: a sentinal would mean two in a row
269 assert_sentinel(runs[2], false); // left
270 assert_sentinel(runs[3], false); // right
277 if (stop[-4] == SkRegion::kRunTypeSentinel) // eek, stop[-3] was a bottom with no x-runs
287 count = (int)(stop - runs);
292 if (ComputeRunBounds(runs, count, &fBounds))
305 const RunType* r = runs;
324 // must call this before we can write directly into runs()
327 memcpy(fRunHead->writable_runs(), runs, count * sizeof(RunType));
335 RunType runs[kRectRegionRuns])
337 runs[0] = bounds.fTop;
338 runs[1] = bounds.fBottom;
339 runs[2] = bounds.fLeft;
340 runs[3] = bounds.fRight;
341 runs[4] = kRunTypeSentinel;
342 runs[5] = kRunTypeSentinel;
345 static SkRegion::RunType* find_scanline(const SkRegion::RunType runs[], int y)
347 SkASSERT(y >= runs[0]); // if this fails, we didn't do a quick check on the boudns
349 runs += 1; // skip top-Y
352 if (runs[0] == SkRegion::kRunTypeSentinel)
354 if (y < runs[0])
355 return (SkRegion::RunType*)&runs[1];
356 runs = skip_scanline(runs + 1); // skip the Y value before calling
370 const RunType* runs = find_scanline(fRunHead->readonly_runs(), y);
372 if (runs)
374 { if (x < runs[0])
376 if (x < runs[1])
378 runs += 2;
408 const RunType* runs = tmpStorage;
423 runs = fRunHead->readonly_runs();
425 return runs;
1124 // check that our bounds match our runs
1151 const RunType* runs = fRunHead->readonly_runs();
1153 SkDebugf(" %d", runs[i]);
1202 const RunType* runs = fRuns;
1204 if (runs[0] < kRunTypeSentinel) { // valid X value
1205 fRect.fLeft = runs[0];
1206 fRect.fRight = runs[1];
1207 runs += 2;
1209 runs += 1;
1210 if (runs[0] < kRunTypeSentinel) { // valid Y value
1211 if (runs[1] == kRunTypeSentinel) { // empty line
1212 fRect.fTop = runs[0];
1213 runs += 2;
1218 fRect.fBottom = runs[0];
1219 assert_sentinel(runs[1], false);
1220 fRect.fLeft = runs[1];
1221 fRect.fRight = runs[2];
1222 runs += 3;
1227 fRuns = runs;
1269 static SkRegion::RunType* find_y(const SkRegion::RunType runs[], int y) {
1270 int top = *runs++;
1273 int bot = *runs++;
1276 *runs == SkRegion::kRunTypeSentinel) {
1279 return (SkRegion::RunType*)runs;
1281 runs = skip_scanline(runs);
1308 const SkRegion::RunType* runs = find_y(
1310 if (runs) {
1312 // runs[0..1] is to the right of the span, so we're done
1313 if (runs[0] >= right) {
1316 // runs[0..1] is to the left of the span, so continue
1317 if (runs[1] <= left) {
1318 runs += 2;
1321 // runs[0..1] intersects the span
1322 fRuns = runs;
1349 const SkRegion::RunType* runs = fRuns;
1351 if (runs[0] >= fRight) {
1356 SkASSERT(runs[1] > fLeft);
1359 *left = SkMax32(fLeft, runs[0]);
1362 *right = SkMin32(fRight, runs[1]);
1364 fRuns = runs + 2;
1372 bool SkRegion::debugSetRuns(const RunType runs[], int count) {
1377 memcpy(storage.get(), runs, count * sizeof(RunType));