diff options
author | Neil Fuller <nfuller@google.com> | 2014-10-02 16:00:27 +0100 |
---|---|---|
committer | Neil Fuller <nfuller@google.com> | 2014-10-02 16:00:27 +0100 |
commit | 8a55d3ae7486b798e4c26eeb91993916145f3cef (patch) | |
tree | de8f5d90d108cedd768d39a5cb9f816bab8ea4ed /gallerycommon/src/com/android | |
parent | 9cde04ed08f3a5201a007d78b3c89f43fb3003e0 (diff) | |
download | android_packages_apps_Gallery2-8a55d3ae7486b798e4c26eeb91993916145f3cef.tar.gz android_packages_apps_Gallery2-8a55d3ae7486b798e4c26eeb91993916145f3cef.tar.bz2 android_packages_apps_Gallery2-8a55d3ae7486b798e4c26eeb91993916145f3cef.zip |
Remove dependencies on FloatMath
See frameworks/base commit 33253a4baa6279f81a73425b49dfb6abe5f5416e
for details.
Bug: https://code.google.com/p/android/issues/detail?id=36199
Change-Id: I202064d78aeb125035c87257100e949da93c116c
Diffstat (limited to 'gallerycommon/src/com/android')
3 files changed, 6 insertions, 11 deletions
diff --git a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java index a671ed2b9..99b125168 100644 --- a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java +++ b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java @@ -23,7 +23,6 @@ import android.graphics.Canvas; import android.graphics.Matrix; import android.graphics.Paint; import android.os.Build; -import android.util.FloatMath; import android.util.Log; import java.io.ByteArrayOutputStream; @@ -72,7 +71,7 @@ public class BitmapUtils { && minSideLength == UNCONSTRAINED) return 1; int lowerBound = (maxNumOfPixels == UNCONSTRAINED) ? 1 : - (int) FloatMath.ceil(FloatMath.sqrt((float) (w * h) / maxNumOfPixels)); + (int) Math.ceil(Math.sqrt((double) (w * h) / maxNumOfPixels)); if (minSideLength == UNCONSTRAINED) { return lowerBound; @@ -96,7 +95,7 @@ public class BitmapUtils { // Find the min x that 1 / x >= scale public static int computeSampleSizeLarger(float scale) { - int initialSize = (int) FloatMath.floor(1f / scale); + int initialSize = (int) Math.floor(1d / scale); if (initialSize <= 1) return 1; return initialSize <= 8 @@ -107,7 +106,7 @@ public class BitmapUtils { // Find the max x that 1 / x <= scale. public static int computeSampleSize(float scale) { Utils.assertTrue(scale > 0); - int initialSize = Math.max(1, (int) FloatMath.ceil(1 / scale)); + int initialSize = Math.max(1, (int) Math.ceil(1 / scale)); return initialSize <= 8 ? Utils.nextPowerOf2(initialSize) : (initialSize + 7) / 8 * 8; diff --git a/gallerycommon/src/com/android/gallery3d/common/OverScroller.java b/gallerycommon/src/com/android/gallery3d/common/OverScroller.java index 1ab7953d2..a03c45196 100644 --- a/gallerycommon/src/com/android/gallery3d/common/OverScroller.java +++ b/gallerycommon/src/com/android/gallery3d/common/OverScroller.java @@ -18,7 +18,6 @@ package com.android.gallery3d.common; import android.content.Context; import android.hardware.SensorManager; -import android.util.FloatMath; import android.util.Log; import android.view.ViewConfiguration; import android.view.animation.AnimationUtils; @@ -175,9 +174,7 @@ public class OverScroller { * @return The original velocity less the deceleration, norm of the X and Y velocity vector. */ public float getCurrVelocity() { - float squaredNorm = mScrollerX.mCurrVelocity * mScrollerX.mCurrVelocity; - squaredNorm += mScrollerY.mCurrVelocity * mScrollerY.mCurrVelocity; - return FloatMath.sqrt(squaredNorm); + return (float) Math.hypot(mScrollerX.mCurrVelocity, mScrollerY.mCurrVelocity); } /** diff --git a/gallerycommon/src/com/android/gallery3d/common/Scroller.java b/gallerycommon/src/com/android/gallery3d/common/Scroller.java index 6cefd6fb0..cce0c9284 100644 --- a/gallerycommon/src/com/android/gallery3d/common/Scroller.java +++ b/gallerycommon/src/com/android/gallery3d/common/Scroller.java @@ -19,7 +19,6 @@ package com.android.gallery3d.common; import android.content.Context; import android.hardware.SensorManager; import android.os.Build; -import android.util.FloatMath; import android.view.ViewConfiguration; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; @@ -372,7 +371,7 @@ public class Scroller { float dx = mFinalX - mStartX; float dy = mFinalY - mStartY; - float hyp = FloatMath.sqrt(dx * dx + dy * dy); + float hyp = (float) Math.hypot(dx, dy); float ndx = dx / hyp; float ndy = dy / hyp; @@ -389,7 +388,7 @@ public class Scroller { mMode = FLING_MODE; mFinished = false; - float velocity = FloatMath.sqrt(velocityX * velocityX + velocityY * velocityY); + float velocity = (float) Math.hypot(velocityX, velocityY); mVelocity = velocity; final double l = Math.log(START_TENSION * velocity / ALPHA); |