| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 #include "SkRegionPriv.h" | 10 #include "SkRegionPriv.h" |
| (...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 789 if (fPrevLen == len && | 789 if (fPrevLen == len && |
| 790 (1 == len || !memcmp(fPrevDst, start, | 790 (1 == len || !memcmp(fPrevDst, start, |
| 791 (len - 1) * sizeof(SkRegion::RunType)))) { | 791 (len - 1) * sizeof(SkRegion::RunType)))) { |
| 792 // update Y value | 792 // update Y value |
| 793 fPrevDst[-2] = (SkRegion::RunType)(bottom); | 793 fPrevDst[-2] = (SkRegion::RunType)(bottom); |
| 794 } else { // accept the new span | 794 } else { // accept the new span |
| 795 if (len == 1 && fPrevLen == 0) { | 795 if (len == 1 && fPrevLen == 0) { |
| 796 fTop = (SkRegion::RunType)(bottom); // just update our bottom | 796 fTop = (SkRegion::RunType)(bottom); // just update our bottom |
| 797 } else { | 797 } else { |
| 798 start[-2] = (SkRegion::RunType)(bottom); | 798 start[-2] = (SkRegion::RunType)(bottom); |
| 799 start[-1] = len >> 1; | 799 start[-1] = SkToS32(len >> 1); |
| 800 fPrevDst = start; | 800 fPrevDst = start; |
| 801 fPrevLen = len; | 801 fPrevLen = len; |
| 802 } | 802 } |
| 803 } | 803 } |
| 804 } | 804 } |
| 805 | 805 |
| 806 int flush() { | 806 int flush() { |
| 807 fStartDst[0] = fTop; | 807 fStartDst[0] = fTop; |
| 808 fPrevDst[fPrevLen] = SkRegion::kRunTypeSentinel; | 808 fPrevDst[fPrevLen] = SkRegion::kRunTypeSentinel; |
| 809 return (int)(fPrevDst - fStartDst + fPrevLen + 1); | 809 return (int)(fPrevDst - fStartDst + fPrevLen + 1); |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1205 ySpanCount += 1; | 1205 ySpanCount += 1; |
| 1206 | 1206 |
| 1207 runs += 1; // skip intervalCount for now | 1207 runs += 1; // skip intervalCount for now |
| 1208 if (*runs < SkRegion::kRunTypeSentinel) { | 1208 if (*runs < SkRegion::kRunTypeSentinel) { |
| 1209 if (left > *runs) { | 1209 if (left > *runs) { |
| 1210 left = *runs; | 1210 left = *runs; |
| 1211 } | 1211 } |
| 1212 | 1212 |
| 1213 const SkRegion::RunType* prev = runs; | 1213 const SkRegion::RunType* prev = runs; |
| 1214 runs = skip_intervals_slow(runs); | 1214 runs = skip_intervals_slow(runs); |
| 1215 int intervals = (runs - prev) >> 1; | 1215 int intervals = SkToInt((runs - prev) >> 1); |
| 1216 SkASSERT(prev[-1] == intervals); | 1216 SkASSERT(prev[-1] == intervals); |
| 1217 intervalCount += intervals; | 1217 intervalCount += intervals; |
| 1218 | 1218 |
| 1219 if (rite < runs[-1]) { | 1219 if (rite < runs[-1]) { |
| 1220 rite = runs[-1]; | 1220 rite = runs[-1]; |
| 1221 } | 1221 } |
| 1222 } else { | 1222 } else { |
| 1223 SkASSERT(0 == runs[-1]); // no intervals | 1223 SkASSERT(0 == runs[-1]); // no intervals |
| 1224 } | 1224 } |
| 1225 SkASSERT(SkRegion::kRunTypeSentinel == *runs); | 1225 SkASSERT(SkRegion::kRunTypeSentinel == *runs); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1476 bool SkRegion::debugSetRuns(const RunType runs[], int count) { | 1476 bool SkRegion::debugSetRuns(const RunType runs[], int count) { |
| 1477 // we need to make a copy, since the real method may modify the array, and | 1477 // we need to make a copy, since the real method may modify the array, and |
| 1478 // so it cannot be const. | 1478 // so it cannot be const. |
| 1479 | 1479 |
| 1480 SkAutoTArray<RunType> storage(count); | 1480 SkAutoTArray<RunType> storage(count); |
| 1481 memcpy(storage.get(), runs, count * sizeof(RunType)); | 1481 memcpy(storage.get(), runs, count * sizeof(RunType)); |
| 1482 return this->setRuns(storage.get(), count); | 1482 return this->setRuns(storage.get(), count); |
| 1483 } | 1483 } |
| 1484 | 1484 |
| 1485 #endif | 1485 #endif |
| OLD | NEW |