Loading gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java +3 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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 Loading @@ -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; Loading gallerycommon/src/com/android/gallery3d/common/OverScroller.java +1 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } /** Loading gallerycommon/src/com/android/gallery3d/common/Scroller.java +2 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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); Loading src/com/android/gallery3d/app/EyePosition.java +7 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.SystemClock; import android.util.FloatMath; import android.view.Display; import android.view.Surface; import android.view.WindowManager; Loading @@ -44,9 +43,9 @@ public class EyePosition { private static final float GYROSCOPE_RESTORE_FACTOR = 0.995f; private static final float USER_ANGEL = (float) Math.toRadians(10); private static final float USER_ANGEL_COS = FloatMath.cos(USER_ANGEL); private static final float USER_ANGEL_SIN = FloatMath.sin(USER_ANGEL); private static final float MAX_VIEW_RANGE = (float) 0.5; private static final float USER_ANGEL_COS = (float) Math.cos(USER_ANGEL); private static final float USER_ANGEL_SIN = (float) Math.sin(USER_ANGEL); private static final float MAX_VIEW_RANGE = 0.5f; private static final int NOT_STARTED = -1; private static final float USER_DISTANCE_METER = 0.3f; Loading Loading @@ -128,8 +127,8 @@ public class EyePosition { float ty = -1 + t * y; float tz = t * z; float length = FloatMath.sqrt(tx * tx + ty * ty + tz * tz); float glength = FloatMath.sqrt(temp); float length = (float) Math.sqrt(tx * tx + ty * ty + tz * tz); float glength = (float) Math.sqrt(temp); mX = Utils.clamp((x * USER_ANGEL_COS / glength + tx * USER_ANGEL_SIN / length) * mUserDistance, Loading @@ -137,7 +136,7 @@ public class EyePosition { mY = -Utils.clamp((y * USER_ANGEL_COS / glength + ty * USER_ANGEL_SIN / length) * mUserDistance, -mLimit, mLimit); mZ = -FloatMath.sqrt( mZ = (float) -Math.sqrt( mUserDistance * mUserDistance - mX * mX - mY * mY); mListener.onEyePositionChanged(mX, mY, mZ); } Loading Loading @@ -175,7 +174,7 @@ public class EyePosition { mY = Utils.clamp((float) (mY + y * t / Math.hypot(mZ, mY)), -mLimit, mLimit) * GYROSCOPE_RESTORE_FACTOR; mZ = -FloatMath.sqrt( mZ = (float) -Math.sqrt( mUserDistance * mUserDistance - mX * mX - mY * mY); mListener.onEyePositionChanged(mX, mY, mZ); } Loading src/com/android/gallery3d/data/DecodeUtils.java +1 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.graphics.BitmapRegionDecoder; import android.os.Build; import android.util.FloatMath; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.BitmapUtils; Loading Loading @@ -135,7 +134,7 @@ public class DecodeUtils { final int MAX_PIXEL_COUNT = 640000; // 400 x 1600 if ((w / options.inSampleSize) * (h / options.inSampleSize) > MAX_PIXEL_COUNT) { options.inSampleSize = BitmapUtils.computeSampleSize( FloatMath.sqrt((float) MAX_PIXEL_COUNT / (w * h))); (float) Math.sqrt((double) MAX_PIXEL_COUNT / (w * h))); } } else { // For screen nail, we only want to keep the longer side >= targetSize. Loading Loading
gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java +3 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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 Loading @@ -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; Loading
gallerycommon/src/com/android/gallery3d/common/OverScroller.java +1 −4 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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); } /** Loading
gallerycommon/src/com/android/gallery3d/common/Scroller.java +2 −3 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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; Loading @@ -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); Loading
src/com/android/gallery3d/app/EyePosition.java +7 −8 Original line number Diff line number Diff line Loading @@ -22,7 +22,6 @@ import android.hardware.SensorEvent; import android.hardware.SensorEventListener; import android.hardware.SensorManager; import android.os.SystemClock; import android.util.FloatMath; import android.view.Display; import android.view.Surface; import android.view.WindowManager; Loading @@ -44,9 +43,9 @@ public class EyePosition { private static final float GYROSCOPE_RESTORE_FACTOR = 0.995f; private static final float USER_ANGEL = (float) Math.toRadians(10); private static final float USER_ANGEL_COS = FloatMath.cos(USER_ANGEL); private static final float USER_ANGEL_SIN = FloatMath.sin(USER_ANGEL); private static final float MAX_VIEW_RANGE = (float) 0.5; private static final float USER_ANGEL_COS = (float) Math.cos(USER_ANGEL); private static final float USER_ANGEL_SIN = (float) Math.sin(USER_ANGEL); private static final float MAX_VIEW_RANGE = 0.5f; private static final int NOT_STARTED = -1; private static final float USER_DISTANCE_METER = 0.3f; Loading Loading @@ -128,8 +127,8 @@ public class EyePosition { float ty = -1 + t * y; float tz = t * z; float length = FloatMath.sqrt(tx * tx + ty * ty + tz * tz); float glength = FloatMath.sqrt(temp); float length = (float) Math.sqrt(tx * tx + ty * ty + tz * tz); float glength = (float) Math.sqrt(temp); mX = Utils.clamp((x * USER_ANGEL_COS / glength + tx * USER_ANGEL_SIN / length) * mUserDistance, Loading @@ -137,7 +136,7 @@ public class EyePosition { mY = -Utils.clamp((y * USER_ANGEL_COS / glength + ty * USER_ANGEL_SIN / length) * mUserDistance, -mLimit, mLimit); mZ = -FloatMath.sqrt( mZ = (float) -Math.sqrt( mUserDistance * mUserDistance - mX * mX - mY * mY); mListener.onEyePositionChanged(mX, mY, mZ); } Loading Loading @@ -175,7 +174,7 @@ public class EyePosition { mY = Utils.clamp((float) (mY + y * t / Math.hypot(mZ, mY)), -mLimit, mLimit) * GYROSCOPE_RESTORE_FACTOR; mZ = -FloatMath.sqrt( mZ = (float) -Math.sqrt( mUserDistance * mUserDistance - mX * mX - mY * mY); mListener.onEyePositionChanged(mX, mY, mZ); } Loading
src/com/android/gallery3d/data/DecodeUtils.java +1 −2 Original line number Diff line number Diff line Loading @@ -23,7 +23,6 @@ import android.graphics.BitmapFactory; import android.graphics.BitmapFactory.Options; import android.graphics.BitmapRegionDecoder; import android.os.Build; import android.util.FloatMath; import com.android.gallery3d.common.ApiHelper; import com.android.gallery3d.common.BitmapUtils; Loading Loading @@ -135,7 +134,7 @@ public class DecodeUtils { final int MAX_PIXEL_COUNT = 640000; // 400 x 1600 if ((w / options.inSampleSize) * (h / options.inSampleSize) > MAX_PIXEL_COUNT) { options.inSampleSize = BitmapUtils.computeSampleSize( FloatMath.sqrt((float) MAX_PIXEL_COUNT / (w * h))); (float) Math.sqrt((double) MAX_PIXEL_COUNT / (w * h))); } } else { // For screen nail, we only want to keep the longer side >= targetSize. Loading