From 1e33de955973996db59f08db6b843d9cd732c631 Mon Sep 17 00:00:00 2001 From: Chih-Chung Chang Date: Fri, 10 Feb 2012 17:08:58 -0800 Subject: Revert "Use FloatMath instead of Math." This reverts commit 6bb8b2eb8695c042798f0eb798032cd30d642a65 --- .../src/com/android/gallery3d/common/BitmapUtils.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'gallerycommon/src/com/android/gallery3d/common') diff --git a/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java b/gallerycommon/src/com/android/gallery3d/common/BitmapUtils.java index 67aa6d77b..2192cf8ec 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 { // Fin 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(1f / 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; @@ -117,7 +116,8 @@ public class BitmapUtils { Bitmap bitmap, int targetPixels, boolean recycle) { int width = bitmap.getWidth(); int height = bitmap.getHeight(); - float scale = FloatMath.sqrt((float) targetPixels / (width * height)); + float scale = (float) Math.sqrt( + (double) targetPixels / (width * height)); if (scale >= 1.0f) return bitmap; return resizeBitmapByScale(bitmap, scale, recycle); } -- cgit v1.2.3