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 1155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 while (runs[0] < SkRegion::kRunTypeSentinel) { | 1166 while (runs[0] < SkRegion::kRunTypeSentinel) { |
1167 SkASSERT(prevR < runs[0]); | 1167 SkASSERT(prevR < runs[0]); |
1168 SkASSERT(runs[0] < runs[1]); | 1168 SkASSERT(runs[0] < runs[1]); |
1169 SkASSERT(runs[1] < SkRegion::kRunTypeSentinel); | 1169 SkASSERT(runs[1] < SkRegion::kRunTypeSentinel); |
1170 prevR = runs[1]; | 1170 prevR = runs[1]; |
1171 runs += 2; | 1171 runs += 2; |
1172 } | 1172 } |
1173 return runs; | 1173 return runs; |
1174 } | 1174 } |
1175 | 1175 |
1176 static void compute_bounds(const SkRegion::RunType runs[], int count, | 1176 static void compute_bounds(const SkRegion::RunType runs[], |
1177 SkIRect* bounds, int* ySpanCountPtr, | 1177 SkIRect* bounds, int* ySpanCountPtr, |
1178 int* intervalCountPtr) { | 1178 int* intervalCountPtr) { |
1179 assert_sentinel(runs[0], false); // top | 1179 assert_sentinel(runs[0], false); // top |
1180 | 1180 |
1181 int left = SK_MaxS32; | 1181 int left = SK_MaxS32; |
1182 int rite = SK_MinS32; | 1182 int rite = SK_MinS32; |
1183 int bot; | 1183 int bot; |
1184 int ySpanCount = 0; | 1184 int ySpanCount = 0; |
1185 int intervalCount = 0; | 1185 int intervalCount = 0; |
1186 | 1186 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1232 SkASSERT(fRunHead->fRefCnt >= 1); | 1232 SkASSERT(fRunHead->fRefCnt >= 1); |
1233 SkASSERT(fRunHead->fRunCount > kRectRegionRuns); | 1233 SkASSERT(fRunHead->fRunCount > kRectRegionRuns); |
1234 | 1234 |
1235 const RunType* run = fRunHead->readonly_runs(); | 1235 const RunType* run = fRunHead->readonly_runs(); |
1236 const RunType* stop = run + fRunHead->fRunCount; | 1236 const RunType* stop = run + fRunHead->fRunCount; |
1237 | 1237 |
1238 // check that our bounds match our runs | 1238 // check that our bounds match our runs |
1239 { | 1239 { |
1240 SkIRect bounds; | 1240 SkIRect bounds; |
1241 int ySpanCount, intervalCount; | 1241 int ySpanCount, intervalCount; |
1242 compute_bounds(run, stop - run, &bounds, &ySpanCount, &intervalC
ount); | 1242 compute_bounds(run, &bounds, &ySpanCount, &intervalCount); |
1243 | 1243 |
1244 SkASSERT(bounds == fBounds); | 1244 SkASSERT(bounds == fBounds); |
1245 SkASSERT(ySpanCount > 0); | 1245 SkASSERT(ySpanCount > 0); |
1246 SkASSERT(fRunHead->getYSpanCount() == ySpanCount); | 1246 SkASSERT(fRunHead->getYSpanCount() == ySpanCount); |
1247 // SkASSERT(intervalCount > 1); | 1247 // SkASSERT(intervalCount > 1); |
1248 SkASSERT(fRunHead->getIntervalCount() == intervalCount); | 1248 SkASSERT(fRunHead->getIntervalCount() == intervalCount); |
1249 } | 1249 } |
1250 } | 1250 } |
1251 } | 1251 } |
1252 } | 1252 } |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1464 bool SkRegion::debugSetRuns(const RunType runs[], int count) { | 1464 bool SkRegion::debugSetRuns(const RunType runs[], int count) { |
1465 // we need to make a copy, since the real method may modify the array, and | 1465 // we need to make a copy, since the real method may modify the array, and |
1466 // so it cannot be const. | 1466 // so it cannot be const. |
1467 | 1467 |
1468 SkAutoTArray<RunType> storage(count); | 1468 SkAutoTArray<RunType> storage(count); |
1469 memcpy(storage.get(), runs, count * sizeof(RunType)); | 1469 memcpy(storage.get(), runs, count * sizeof(RunType)); |
1470 return this->setRuns(storage.get(), count); | 1470 return this->setRuns(storage.get(), count); |
1471 } | 1471 } |
1472 | 1472 |
1473 #endif | 1473 #endif |
OLD | NEW |