OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkIntersections.h" | 8 #include "SkIntersections.h" |
9 | 9 |
10 int (SkIntersections::*CurveVertical[])(const SkPoint[], SkScalar, SkScalar, SkS
calar, bool) = { | 10 int (SkIntersections::*CurveVertical[])(const SkPoint[], SkScalar, SkScalar, SkS
calar, bool) = { |
11 NULL, | 11 NULL, |
12 &SkIntersections::verticalLine, | 12 &SkIntersections::verticalLine, |
13 &SkIntersections::verticalQuad, | 13 &SkIntersections::verticalQuad, |
14 &SkIntersections::verticalCubic | 14 &SkIntersections::verticalCubic |
15 }; | 15 }; |
16 | 16 |
17 int (SkIntersections::*CurveRay[])(const SkPoint[], const SkDLine&) = { | 17 int (SkIntersections::*CurveRay[])(const SkPoint[], const SkDLine&) = { |
18 NULL, | 18 NULL, |
19 NULL, | 19 NULL, |
20 &SkIntersections::quadRay, | 20 &SkIntersections::quadRay, |
21 &SkIntersections::cubicRay | 21 &SkIntersections::cubicRay |
22 }; | 22 }; |
23 | 23 |
24 int SkIntersections::coincidentUsed() const { | 24 int SkIntersections::coincidentUsed() const { |
25 if (!fIsCoincident[0]) { | 25 if (!fIsCoincident[0]) { |
26 SkASSERT(!fIsCoincident[0]); | 26 SkASSERT(!fIsCoincident[1]); |
27 return 0; | 27 return 0; |
28 } | 28 } |
29 int count = 0; | 29 int count = 0; |
30 SkDEBUGCODE(int count2 = 0;) | 30 SkDEBUGCODE(int count2 = 0;) |
31 for (int index = 0; index < fUsed; ++index) { | 31 for (int index = 0; index < fUsed; ++index) { |
32 if (fIsCoincident[0] & (1 << index)) { | 32 if (fIsCoincident[0] & (1 << index)) { |
33 ++count; | 33 ++count; |
34 } | 34 } |
35 #ifdef SK_DEBUG | 35 #ifdef SK_DEBUG |
36 if (fIsCoincident[1] & (1 << index)) { | 36 if (fIsCoincident[1] & (1 << index)) { |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 quad.set(a); | 256 quad.set(a); |
257 return vertical(quad, top, bottom, x, flipped); | 257 return vertical(quad, top, bottom, x, flipped); |
258 } | 258 } |
259 | 259 |
260 int SkIntersections::verticalCubic(const SkPoint a[4], SkScalar top, SkScalar bo
ttom, | 260 int SkIntersections::verticalCubic(const SkPoint a[4], SkScalar top, SkScalar bo
ttom, |
261 SkScalar x, bool flipped) { | 261 SkScalar x, bool flipped) { |
262 SkDCubic cubic; | 262 SkDCubic cubic; |
263 cubic.set(a); | 263 cubic.set(a); |
264 return vertical(cubic, top, bottom, x, flipped); | 264 return vertical(cubic, top, bottom, x, flipped); |
265 } | 265 } |
OLD | NEW |