OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
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 #include "SkLineClipper.h" | 8 #include "SkLineClipper.h" |
9 | 9 |
10 template <typename T> T pin_unsorted(T value, T limit0, T limit1) { | 10 template <typename T> T pin_unsorted(T value, T limit0, T limit1) { |
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 | 260 |
261 if (tmp[index1].fX > clip.fRight) { | 261 if (tmp[index1].fX > clip.fRight) { |
262 r->set(clip.fRight, sect_with_vertical(tmp, clip.fRight)); | 262 r->set(clip.fRight, sect_with_vertical(tmp, clip.fRight)); |
263 SkASSERT(is_between_unsorted(r->fY, tmp[0].fY, tmp[1].fY)); | 263 SkASSERT(is_between_unsorted(r->fY, tmp[0].fY, tmp[1].fY)); |
264 r += 1; | 264 r += 1; |
265 r->set(clip.fRight, tmp[index1].fY); | 265 r->set(clip.fRight, tmp[index1].fY); |
266 } else { | 266 } else { |
267 *r = tmp[index1]; | 267 *r = tmp[index1]; |
268 } | 268 } |
269 | 269 |
270 lineCount = r - result; | 270 lineCount = SkToInt(r - result); |
271 } | 271 } |
272 | 272 |
273 // Now copy the results into the caller's lines[] parameter | 273 // Now copy the results into the caller's lines[] parameter |
274 if (reverse) { | 274 if (reverse) { |
275 // copy the pts in reverse order to maintain winding order | 275 // copy the pts in reverse order to maintain winding order |
276 for (int i = 0; i <= lineCount; i++) { | 276 for (int i = 0; i <= lineCount; i++) { |
277 lines[lineCount - i] = result[i]; | 277 lines[lineCount - i] = result[i]; |
278 } | 278 } |
279 } else { | 279 } else { |
280 memcpy(lines, result, (lineCount + 1) * sizeof(SkPoint)); | 280 memcpy(lines, result, (lineCount + 1) * sizeof(SkPoint)); |
281 } | 281 } |
282 return lineCount; | 282 return lineCount; |
283 } | 283 } |
OLD | NEW |