History log of /frameworks/base/core/java/android/gesture/GestureStroke.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
6de42dac4307a88fb99ced0a57293438600e3899 03-Oct-2014 Neil Fuller <nfuller@google.com> Removing some more FloatMath references

See frameworks/base commit 33253a4baa6279f81a73425b49dfb6abe5f5416e
for details.

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I46d4ee4c4be7972e3bcc6782fb50f024b6fff1ee
/frameworks/base/core/java/android/gesture/GestureStroke.java
33253a4baa6279f81a73425b49dfb6abe5f5416e 01-Oct-2014 Neil Fuller <nfuller@google.com> Switch from FloatMath -> Math and Math.hypot where possible

The motivation is an API change: FloatMath is going to be
deprecated and/or removed. Performance is not the goal of
this change.

That said...

Math is faster than FloatMath with AOT compilation.

While making the change, occurances of:

{Float}Math.sqrt(x * x + y * y) and
{Float}Math.sqrt({Float}Math.pow(x, 2) + {Float}Math.pow(y, 2))

have been replaced with:

{(float)} Math.hypot(x, y)

Right now there is no runtime intrinsic for hypot so is not faster
in all cases for AOT compilation:

Math.sqrt(x * x + y * y) is faster than Math.hypot(x, y) with
AOT, but all other combinations of FloatMath, use of pow() etc.
are slower than hypot().

hypot() has the advantage of being self documenting and
could be optimized in future. None of the behavior differences
around NaN and rounding appear to be important for the cases
looked at: they all assume results and arguments are in range
and usually the results are cast to float.

Different implementations measured on hammerhead / L:

AOT compiled:

[FloatMath.hypot(x, y)]
benchmark=Hypot_FloatMathHypot} 633.85 ns; σ=0.32 ns @ 3 trials

[FloatMath.sqrt(x*x + y*y)]
benchmark=Hypot_FloatMathSqrtMult} 684.17 ns; σ=4.83 ns @ 3 trials

[FloatMath.sqrt(FloatMath.pow(x, 2) + FloatMath.pow(y, 2))]
benchmark=Hypot_FloatMathSqrtPow} 1270.65 ns; σ=12.20 ns @ 6 trials

[(float) Math.hypot(x, y)]
benchmark=Hypot_MathHypot} 96.80 ns; σ=0.05 ns @ 3 trials

[(float) Math.sqrt(x*x + y*y)]
benchmark=Hypot_MathSqrtMult} 23.97 ns; σ=0.01 ns @ 3 trials

[(float) Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2))]
benchmark=Hypot_MathSqrtPow} 156.19 ns; σ=0.12 ns @ 3 trials

Interpreter:

benchmark=Hypot_FloatMathHypot} 1180.54 ns; σ=5.13 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtMult} 1121.05 ns; σ=3.80 ns @ 3 trials
benchmark=Hypot_FloatMathSqrtPow} 3327.14 ns; σ=7.33 ns @ 3 trials
benchmark=Hypot_MathHypot} 856.57 ns; σ=1.41 ns @ 3 trials
benchmark=Hypot_MathSqrtMult} 1028.92 ns; σ=9.11 ns @ 3 trials
benchmark=Hypot_MathSqrtPow} 2539.47 ns; σ=24.44 ns @ 3 trials

Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I06c91f682095e627cb547d60d936ef87941be692
/frameworks/base/core/java/android/gesture/GestureStroke.java
46c53129c6f27c9193ab195a69cb50591b8c1fa2 04-Feb-2010 Romain Guy <romainguy@android.com> Rename GestureUtilities to GestureUtils.
/frameworks/base/core/java/android/gesture/GestureStroke.java
c7f930f5a9a62470775e913945c771ca57e0b10f 26-Jan-2010 Yang Li <liyang@google.com> Made GestureUtilities's several methods public; Changed GestureStroke's smoothening threshold.
/frameworks/base/core/java/android/gesture/GestureStroke.java
6fc1f151341c628125e7d20c1667a23862f32ce4 15-Jan-2010 Yang Li <liyang@google.com> Added clone to these three classes and added more comments.
/frameworks/base/core/java/android/gesture/GestureStroke.java
d1c67d42abdf41d10c9a7589da1e0088af1e123a 29-May-2009 Romain Guy <romainguy@android.com> Fixes #1878499.

Ignore touch up events that happen after a gesture was cancelled. This fix also improves performance by ignoring move events that are within the touch threshold.
/frameworks/base/core/java/android/gesture/GestureStroke.java
f40f074c43fcef627131d4b631251192761b4daa 29-May-2009 Romain Guy <romainguy@android.com> Revert "Revert "Bug fixes and performance improvements""

This reverts commit 436466d75edb5f6fd848504d998f244426ea5a09.
/frameworks/base/core/java/android/gesture/GestureStroke.java
436466d75edb5f6fd848504d998f244426ea5a09 28-May-2009 Romain Guy <romainguy@android.com> Revert "Bug fixes and performance improvements"

This reverts commit 58b359041a29418876f12d37a7082ece9f8a38a4.
/frameworks/base/core/java/android/gesture/GestureStroke.java
58b359041a29418876f12d37a7082ece9f8a38a4 28-May-2009 Yang Li <liyang@google.com> Bug fixes and performance improvements

- Added affine transform functions in GestureUtilities to remove Matrix
- Fixed a bug with Instance.createInstance
- Updated letter recognition file
/frameworks/base/core/java/android/gesture/GestureStroke.java
82f3495b146b267f3786997752cef25310176349 25-May-2009 Romain Guy <romainguy@android.com> Cleanup Gestures API and make it easier to use in 3rd party apps. Also fix the events processing in the gestures overlay mechanism. Give better control of the various properties of the overlay through XML attributes.
/frameworks/base/core/java/android/gesture/GestureStroke.java
d6a463a9f23b3901bf729f2f27a6bb8f78b95248 22-May-2009 Romain Guy <romainguy@android.com> Add a new API to ListView: setGestures(int). This allows developers to enable gestures to jump inside the list or filter it. This change also introduces a new XML attribute to control this API. It also adds the ability to theme the GestureOverlayView from the gestures library. Finally, this adds a new VERSION header to the binary format used to store the letters for the recognizer.
/frameworks/base/core/java/android/gesture/GestureStroke.java
db567c390bd56c05614eaa83c02dbb99f97ad9cc 22-May-2009 Romain Guy <romainguy@android.com> Move the Gestures API to the framework in android.gesture.
/frameworks/base/core/java/android/gesture/GestureStroke.java