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 | 10 |
(...skipping 1517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1528 } | 1528 } |
1529 | 1529 |
1530 void SkConic::computeFastBounds(SkRect* bounds) const { | 1530 void SkConic::computeFastBounds(SkRect* bounds) const { |
1531 bounds->set(fPts, 3); | 1531 bounds->set(fPts, 3); |
1532 } | 1532 } |
1533 | 1533 |
1534 bool SkConic::findMaxCurvature(SkScalar* t) const { | 1534 bool SkConic::findMaxCurvature(SkScalar* t) const { |
1535 // TODO: Implement me | 1535 // TODO: Implement me |
1536 return false; | 1536 return false; |
1537 } | 1537 } |
1538 | |
1539 SkScalar SkConic::TransformW(const SkPoint pts[], SkScalar w, | |
1540 const SkMatrix& matrix) { | |
1541 if (!matrix.hasPerspective()) { | |
1542 return w; | |
1543 } | |
1544 | |
1545 SkP3D src[3], dst[3]; | |
1546 | |
1547 ratquad_mapTo3D(pts, w, src); | |
1548 | |
1549 matrix.mapHomogeneousPoints((SkScalar*)dst, (const SkScalar*)src, 3); | |
caryclark
2014/12/17 15:52:43
&dst[0].fX, &src[0].fX would avoid the cast..
| |
1550 | |
1551 // w' = sqrt(w1*w1/w0*w2) | |
1552 SkScalar w0 = dst[0].fZ; | |
1553 SkScalar w1 = dst[1].fZ; | |
1554 SkScalar w2 = dst[2].fZ; | |
1555 w = SkScalarSqrt((w1 * w1) / (w0 * w2)); | |
1556 return w; | |
1557 } | |
OLD | NEW |