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

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

Issue 373383003: ios fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: only build gyp on ios Created 6 years, 5 months 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
« no previous file with comments | « src/core/SkMathPriv.h ('k') | src/images/SkForceLinking.cpp » ('j') | 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 /* 2 /*
3 * Copyright 2008 The Android Open Source Project 3 * Copyright 2008 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkMathPriv.h"
10 #include "SkPoint.h" 11 #include "SkPoint.h"
11 12
12 void SkIPoint::rotateCW(SkIPoint* dst) const { 13 void SkIPoint::rotateCW(SkIPoint* dst) const {
13 SkASSERT(dst); 14 SkASSERT(dst);
14 15
15 // use a tmp in case this == dst 16 // use a tmp in case this == dst
16 int32_t tmp = fX; 17 int32_t tmp = fX;
17 dst->fX = -fY; 18 dst->fX = -fY;
18 dst->fY = tmp; 19 dst->fY = tmp;
19 } 20 }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 float scale; 163 float scale;
163 if (SkScalarIsFinite(mag2)) { 164 if (SkScalarIsFinite(mag2)) {
164 scale = length / sk_float_sqrt(mag2); 165 scale = length / sk_float_sqrt(mag2);
165 } else { 166 } else {
166 // our mag2 step overflowed to infinity, so use doubles instead. 167 // our mag2 step overflowed to infinity, so use doubles instead.
167 // much slower, but needed when x or y are very large, other wise we 168 // much slower, but needed when x or y are very large, other wise we
168 // divide by inf. and return (0,0) vector. 169 // divide by inf. and return (0,0) vector.
169 double xx = x; 170 double xx = x;
170 double yy = y; 171 double yy = y;
172 #ifdef SK_DISCARD_DENORMALIZED_FOR_SPEED
173 // The iOS ARM processor discards small denormalized numbers to go faste r.
174 // Casting this to a float would cause the scale to go to zero. Keeping it
175 // as a double for the multiply keeps the scale non-zero.
176 double dscale = length / sqrt(xx * xx + yy * yy);
177 fX = x * dscale;
178 fY = y * dscale;
179 return true;
180 #else
171 scale = (float)(length / sqrt(xx * xx + yy * yy)); 181 scale = (float)(length / sqrt(xx * xx + yy * yy));
182 #endif
172 } 183 }
173 fX = x * scale; 184 fX = x * scale;
174 fY = y * scale; 185 fY = y * scale;
175 return true; 186 return true;
176 } 187 }
177 188
178 bool SkPoint::setLengthFast(float length) { 189 bool SkPoint::setLengthFast(float length) {
179 return this->setLengthFast(fX, fY, length); 190 return this->setLengthFast(fX, fY, length);
180 } 191 }
181 192
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 259
249 if (uDotV <= 0) { 260 if (uDotV <= 0) {
250 return v.lengthSqd(); 261 return v.lengthSqd();
251 } else if (uDotV > uLengthSqd) { 262 } else if (uDotV > uLengthSqd) {
252 return b.distanceToSqd(*this); 263 return b.distanceToSqd(*this);
253 } else { 264 } else {
254 SkScalar det = u.cross(v); 265 SkScalar det = u.cross(v);
255 return SkScalarMulDiv(det, det, uLengthSqd); 266 return SkScalarMulDiv(det, det, uLengthSqd);
256 } 267 }
257 } 268 }
OLDNEW
« no previous file with comments | « src/core/SkMathPriv.h ('k') | src/images/SkForceLinking.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698