aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/core/SkPoint.cpp
diff options
context:
space:
mode:
authorGravatar caryclark <caryclark@google.com>2014-07-11 12:14:51 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2014-07-11 12:14:51 -0700
commit936b73424f7393994be832376287da988a52b993 (patch)
tree593058a39c92a62ab13de099542884aa307f6848 /src/core/SkPoint.cpp
parentbc9205be0a1094e312da098348601398c210dc5a (diff)
ios fixes
skia_ios.mm Get the app's Documents directory and pass use it to set the resource path. This is a quick hack which will be replaced by a new application that is a tiny shim around a command line tool. SkImageEncoder.h SkForceLinking.cpp SkImageDecoder_CG.cpp Add support for FORCE_LINKING so iOS sees the PNG encoder and others. SkFloatBits.cpp SkPoint.cpp Handle denormalized numbers that are floored by the iOS ARM processor. SkImageDecoder_iOS.mm Remove empty encoder factory. SkTouchGesture.cpp Return early on empty state on touch rather than aborting (crashing) JpegTest.cpp Hal via stackoverflow.com says partial jpegs can be gray as well. skia_test.cpp Remove crash handler call for now to avoid link failure. OverwriteLine.h Remove fancy line overwrite for iOS. Resources.cpp Add interface to set resource directory based on runtime query. BUG=skia:2736 skia:2737 skia:2738 R=reed@google.com, halcanary@google.com, mtklein@google.com, tfarina@chromium.org Author: caryclark@google.com Review URL: https://codereview.chromium.org/373383003
Diffstat (limited to 'src/core/SkPoint.cpp')
-rw-r--r--src/core/SkPoint.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/core/SkPoint.cpp b/src/core/SkPoint.cpp
index 719ee54b22..8a6d0564af 100644
--- a/src/core/SkPoint.cpp
+++ b/src/core/SkPoint.cpp
@@ -7,6 +7,7 @@
*/
+#include "SkMathPriv.h"
#include "SkPoint.h"
void SkIPoint::rotateCW(SkIPoint* dst) const {
@@ -168,7 +169,17 @@ bool SkPoint::setLength(float x, float y, float length) {
// divide by inf. and return (0,0) vector.
double xx = x;
double yy = y;
+ #ifdef SK_DISCARD_DENORMALIZED_FOR_SPEED
+ // The iOS ARM processor discards small denormalized numbers to go faster.
+ // Casting this to a float would cause the scale to go to zero. Keeping it
+ // as a double for the multiply keeps the scale non-zero.
+ double dscale = length / sqrt(xx * xx + yy * yy);
+ fX = x * dscale;
+ fY = y * dscale;
+ return true;
+ #else
scale = (float)(length / sqrt(xx * xx + yy * yy));
+ #endif
}
fX = x * scale;
fY = y * scale;