OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkGeometry.h" | 8 #include "SkGeometry.h" |
9 #include "SkMatrix.h" | 9 #include "SkMatrix.h" |
10 #include "Sk2x.h" | 10 #include "SkNx.h" |
11 | 11 |
12 static Sk2s from_point(const SkPoint& point) { | 12 static Sk2s from_point(const SkPoint& point) { |
13 return Sk2s::Load(&point.fX); | 13 return Sk2s::Load(&point.fX); |
14 } | 14 } |
15 | 15 |
16 static SkPoint to_point(const Sk2s& x) { | 16 static SkPoint to_point(const Sk2s& x) { |
17 SkPoint point; | 17 SkPoint point; |
18 x.store(&point.fX); | 18 x.store(&point.fX); |
19 return point; | 19 return point; |
20 } | 20 } |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 return v0 + (v1 - v0) * t; | 183 return v0 + (v1 - v0) * t; |
184 } | 184 } |
185 | 185 |
186 void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t) { | 186 void SkChopQuadAt(const SkPoint src[3], SkPoint dst[5], SkScalar t) { |
187 SkASSERT(t > 0 && t < SK_Scalar1); | 187 SkASSERT(t > 0 && t < SK_Scalar1); |
188 | 188 |
189 Sk2s p0 = from_point(src[0]); | 189 Sk2s p0 = from_point(src[0]); |
190 Sk2s p1 = from_point(src[1]); | 190 Sk2s p1 = from_point(src[1]); |
191 Sk2s p2 = from_point(src[2]); | 191 Sk2s p2 = from_point(src[2]); |
192 Sk2s tt(t); | 192 Sk2s tt(t); |
193 | 193 |
194 Sk2s p01 = interp(p0, p1, tt); | 194 Sk2s p01 = interp(p0, p1, tt); |
195 Sk2s p12 = interp(p1, p2, tt); | 195 Sk2s p12 = interp(p1, p2, tt); |
196 | 196 |
197 dst[0] = to_point(p0); | 197 dst[0] = to_point(p0); |
198 dst[1] = to_point(p01); | 198 dst[1] = to_point(p01); |
199 dst[2] = to_point(interp(p01, p12, tt)); | 199 dst[2] = to_point(interp(p01, p12, tt)); |
200 dst[3] = to_point(p12); | 200 dst[3] = to_point(p12); |
201 dst[4] = to_point(p2); | 201 dst[4] = to_point(p2); |
202 } | 202 } |
203 | 203 |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 Sk2s p2 = from_point(src[2]); | 435 Sk2s p2 = from_point(src[2]); |
436 Sk2s p3 = from_point(src[3]); | 436 Sk2s p3 = from_point(src[3]); |
437 Sk2s tt(t); | 437 Sk2s tt(t); |
438 | 438 |
439 Sk2s ab = interp(p0, p1, tt); | 439 Sk2s ab = interp(p0, p1, tt); |
440 Sk2s bc = interp(p1, p2, tt); | 440 Sk2s bc = interp(p1, p2, tt); |
441 Sk2s cd = interp(p2, p3, tt); | 441 Sk2s cd = interp(p2, p3, tt); |
442 Sk2s abc = interp(ab, bc, tt); | 442 Sk2s abc = interp(ab, bc, tt); |
443 Sk2s bcd = interp(bc, cd, tt); | 443 Sk2s bcd = interp(bc, cd, tt); |
444 Sk2s abcd = interp(abc, bcd, tt); | 444 Sk2s abcd = interp(abc, bcd, tt); |
445 | 445 |
446 dst[0] = src[0]; | 446 dst[0] = src[0]; |
447 dst[1] = to_point(ab); | 447 dst[1] = to_point(ab); |
448 dst[2] = to_point(abc); | 448 dst[2] = to_point(abc); |
449 dst[3] = to_point(abcd); | 449 dst[3] = to_point(abcd); |
450 dst[4] = to_point(bcd); | 450 dst[4] = to_point(bcd); |
451 dst[5] = to_point(cd); | 451 dst[5] = to_point(cd); |
452 dst[6] = src[3]; | 452 dst[6] = src[3]; |
453 } | 453 } |
454 | 454 |
455 /* http://code.google.com/p/skia/issues/detail?id=32 | 455 /* http://code.google.com/p/skia/issues/detail?id=32 |
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1534 matrix.preScale(SK_Scalar1, -SK_Scalar1); | 1534 matrix.preScale(SK_Scalar1, -SK_Scalar1); |
1535 } | 1535 } |
1536 if (userMatrix) { | 1536 if (userMatrix) { |
1537 matrix.postConcat(*userMatrix); | 1537 matrix.postConcat(*userMatrix); |
1538 } | 1538 } |
1539 for (int i = 0; i < conicCount; ++i) { | 1539 for (int i = 0; i < conicCount; ++i) { |
1540 matrix.mapPoints(dst[i].fPts, 3); | 1540 matrix.mapPoints(dst[i].fPts, 3); |
1541 } | 1541 } |
1542 return conicCount; | 1542 return conicCount; |
1543 } | 1543 } |
OLD | NEW |