Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9)

Side by Side Diff: src/core/SkMatrix.cpp

Issue 117973002: move SkScalarMean into its only caller, reducing out public API exposure (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « include/core/SkScalar.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/core/SkScalar.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698