| 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 "SkMatrix.h" | 8 #include "SkMatrix.h" |
| 9 #include "Sk64.h" | 9 #include "Sk64.h" |
| 10 #include "SkFloatBits.h" | 10 #include "SkFloatBits.h" |
| (...skipping 1159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1170 SkScalar SkMatrix::mapRadius(SkScalar radius) const { | 1170 SkScalar SkMatrix::mapRadius(SkScalar radius) const { |
| 1171 SkVector vec[2]; | 1171 SkVector vec[2]; |
| 1172 | 1172 |
| 1173 vec[0].set(radius, 0); | 1173 vec[0].set(radius, 0); |
| 1174 vec[1].set(0, radius); | 1174 vec[1].set(0, radius); |
| 1175 this->mapVectors(vec, 2); | 1175 this->mapVectors(vec, 2); |
| 1176 | 1176 |
| 1177 SkScalar d0 = vec[0].length(); | 1177 SkScalar d0 = vec[0].length(); |
| 1178 SkScalar d1 = vec[1].length(); | 1178 SkScalar d1 = vec[1].length(); |
| 1179 | 1179 |
| 1180 return SkScalarMean(d0, d1); | 1180 // return geometric mean |
| 1181 return SkScalarSqrt(d0 * d1); |
| 1181 } | 1182 } |
| 1182 | 1183 |
| 1183 /////////////////////////////////////////////////////////////////////////////// | 1184 /////////////////////////////////////////////////////////////////////////////// |
| 1184 | 1185 |
| 1185 void SkMatrix::Persp_xy(const SkMatrix& m, SkScalar sx, SkScalar sy, | 1186 void SkMatrix::Persp_xy(const SkMatrix& m, SkScalar sx, SkScalar sy, |
| 1186 SkPoint* pt) { | 1187 SkPoint* pt) { |
| 1187 SkASSERT(m.hasPerspective()); | 1188 SkASSERT(m.hasPerspective()); |
| 1188 | 1189 |
| 1189 SkScalar x = SkScalarMul(sx, m.fMat[kMScaleX]) + | 1190 SkScalar x = SkScalarMul(sx, m.fMat[kMScaleX]) + |
| 1190 SkScalarMul(sy, m.fMat[kMSkewX]) + m.fMat[kMTransX]; | 1191 SkScalarMul(sy, m.fMat[kMSkewX]) + m.fMat[kMTransX]; |
| (...skipping 802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1993 rotation1->fX = cos1; | 1994 rotation1->fX = cos1; |
| 1994 rotation1->fY = sin1; | 1995 rotation1->fY = sin1; |
| 1995 } | 1996 } |
| 1996 if (NULL != rotation2) { | 1997 if (NULL != rotation2) { |
| 1997 rotation2->fX = cos2; | 1998 rotation2->fX = cos2; |
| 1998 rotation2->fY = sin2; | 1999 rotation2->fY = sin2; |
| 1999 } | 2000 } |
| 2000 | 2001 |
| 2001 return true; | 2002 return true; |
| 2002 } | 2003 } |
| OLD | NEW |