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 #ifndef SkRegionPriv_DEFINED | 10 #ifndef SkRegionPriv_DEFINED |
(...skipping 11 matching lines...) Expand all Loading... |
22 // Given the first interval (just past the interval-count), compute the | 22 // Given the first interval (just past the interval-count), compute the |
23 // interval count, by search for the x-sentinel | 23 // interval count, by search for the x-sentinel |
24 // | 24 // |
25 static int compute_intervalcount(const SkRegion::RunType runs[]) { | 25 static int compute_intervalcount(const SkRegion::RunType runs[]) { |
26 const SkRegion::RunType* curr = runs; | 26 const SkRegion::RunType* curr = runs; |
27 while (*curr < SkRegion::kRunTypeSentinel) { | 27 while (*curr < SkRegion::kRunTypeSentinel) { |
28 SkASSERT(curr[0] < curr[1]); | 28 SkASSERT(curr[0] < curr[1]); |
29 SkASSERT(curr[1] < SkRegion::kRunTypeSentinel); | 29 SkASSERT(curr[1] < SkRegion::kRunTypeSentinel); |
30 curr += 2; | 30 curr += 2; |
31 } | 31 } |
32 return (curr - runs) >> 1; | 32 return SkToInt((curr - runs) >> 1); |
33 } | 33 } |
34 #endif | 34 #endif |
35 | 35 |
36 struct SkRegion::RunHead { | 36 struct SkRegion::RunHead { |
37 private: | 37 private: |
38 | 38 |
39 public: | 39 public: |
40 int32_t fRefCnt; | 40 int32_t fRefCnt; |
41 int32_t fRunCount; | 41 int32_t fRunCount; |
42 | 42 |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 intervalCount += intervals; | 206 intervalCount += intervals; |
207 } | 207 } |
208 SkASSERT(SkRegion::kRunTypeSentinel == *runs); | 208 SkASSERT(SkRegion::kRunTypeSentinel == *runs); |
209 runs += 1; // skip x-sentinel | 209 runs += 1; // skip x-sentinel |
210 | 210 |
211 // test Y-sentinel | 211 // test Y-sentinel |
212 } while (SkRegion::kRunTypeSentinel > *runs); | 212 } while (SkRegion::kRunTypeSentinel > *runs); |
213 | 213 |
214 #ifdef SK_DEBUG | 214 #ifdef SK_DEBUG |
215 // +1 to skip the last Y-sentinel | 215 // +1 to skip the last Y-sentinel |
216 int runCount = runs - this->writable_runs() + 1; | 216 int runCount = SkToInt(runs - this->writable_runs() + 1); |
217 SkASSERT(runCount == fRunCount); | 217 SkASSERT(runCount == fRunCount); |
218 #endif | 218 #endif |
219 | 219 |
220 fYSpanCount = ySpanCount; | 220 fYSpanCount = ySpanCount; |
221 fIntervalCount = intervalCount; | 221 fIntervalCount = intervalCount; |
222 | 222 |
223 bounds->fLeft = left; | 223 bounds->fLeft = left; |
224 bounds->fRight = rite; | 224 bounds->fRight = rite; |
225 bounds->fBottom = bot; | 225 bounds->fBottom = bot; |
226 } | 226 } |
227 | 227 |
228 private: | 228 private: |
229 int32_t fYSpanCount; | 229 int32_t fYSpanCount; |
230 int32_t fIntervalCount; | 230 int32_t fIntervalCount; |
231 }; | 231 }; |
232 | 232 |
233 #endif | 233 #endif |
OLD | NEW |