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 #ifndef SkPathOpsCurve_DEFINE | 7 #ifndef SkPathOpsCurve_DEFINE |
8 #define SkPathOpsCurve_DEFINE | 8 #define SkPathOpsCurve_DEFINE |
9 | 9 |
| 10 #include "SkIntersections.h" |
10 #include "SkPathOpsCubic.h" | 11 #include "SkPathOpsCubic.h" |
11 #include "SkPathOpsLine.h" | 12 #include "SkPathOpsLine.h" |
12 #include "SkPathOpsQuad.h" | 13 #include "SkPathOpsQuad.h" |
13 | 14 |
14 static SkDPoint dline_xy_at_t(const SkPoint a[2], double t) { | 15 static SkDPoint dline_xy_at_t(const SkPoint a[2], double t) { |
15 SkDLine line; | 16 SkDLine line; |
16 line.set(a); | 17 line.set(a); |
17 return line.ptAtT(t); | 18 return line.ptAtT(t); |
18 } | 19 } |
19 | 20 |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 && AlmostEqualUlps(dst[2].fX, dst[3].fX); | 143 && AlmostEqualUlps(dst[2].fX, dst[3].fX); |
143 } | 144 } |
144 | 145 |
145 static bool (* const CurveIsVertical[])(const SkPoint[], double , double) = { | 146 static bool (* const CurveIsVertical[])(const SkPoint[], double , double) = { |
146 NULL, | 147 NULL, |
147 line_is_vertical, | 148 line_is_vertical, |
148 quad_is_vertical, | 149 quad_is_vertical, |
149 cubic_is_vertical | 150 cubic_is_vertical |
150 }; | 151 }; |
151 | 152 |
| 153 static void line_intersect_ray(const SkPoint a[2], const SkDLine& ray, SkInterse
ctions* i) { |
| 154 SkDLine line; |
| 155 line.set(a); |
| 156 i->intersectRay(line, ray); |
| 157 } |
| 158 |
| 159 static void quad_intersect_ray(const SkPoint a[3], const SkDLine& ray, SkInterse
ctions* i) { |
| 160 SkDQuad quad; |
| 161 quad.set(a); |
| 162 i->intersectRay(quad, ray); |
| 163 } |
| 164 |
| 165 static void cubic_intersect_ray(const SkPoint a[4], const SkDLine& ray, SkInters
ections* i) { |
| 166 SkDCubic cubic; |
| 167 cubic.set(a); |
| 168 i->intersectRay(cubic, ray); |
| 169 } |
| 170 |
| 171 static void (* const CurveIntersectRay[])(const SkPoint[] , const SkDLine& , SkI
ntersections* ) = { |
| 172 NULL, |
| 173 line_intersect_ray, |
| 174 quad_intersect_ray, |
| 175 cubic_intersect_ray |
| 176 }; |
| 177 |
152 #endif | 178 #endif |
OLD | NEW |