Remove dependencies on FloatMath
See frameworks/base commit 33253a4baa6279f81a73425b49dfb6abe5f5416e for details. Bug: https://code.google.com/p/android/issues/detail?id=36199 Change-Id: I01126788f34b9a464b873bc2fff03acedc43bb52
This commit is contained in:
@@ -22,7 +22,6 @@ import android.content.Context;
|
||||
import android.graphics.*;
|
||||
import android.os.Bundle;
|
||||
import android.view.*;
|
||||
import android.util.FloatMath;
|
||||
|
||||
public class BitmapMesh extends GraphicsActivity {
|
||||
|
||||
@@ -92,7 +91,7 @@ public class BitmapMesh extends GraphicsActivity {
|
||||
float dx = cx - x;
|
||||
float dy = cy - y;
|
||||
float dd = dx*dx + dy*dy;
|
||||
float d = FloatMath.sqrt(dd);
|
||||
float d = (float) Math.sqrt(dd);
|
||||
float pull = K / (dd + 0.000001f);
|
||||
|
||||
pull /= (d + 0.000001f);
|
||||
|
||||
@@ -167,7 +167,7 @@ public class ColorPickerDialog extends Dialog {
|
||||
public boolean onTouchEvent(MotionEvent event) {
|
||||
float x = event.getX() - CENTER_X;
|
||||
float y = event.getY() - CENTER_Y;
|
||||
boolean inCenter = java.lang.Math.sqrt(x*x + y*y) <= CENTER_RADIUS;
|
||||
boolean inCenter = java.lang.Math.hypot(x, y) <= CENTER_RADIUS;
|
||||
|
||||
switch (event.getAction()) {
|
||||
case MotionEvent.ACTION_DOWN:
|
||||
|
||||
@@ -483,7 +483,7 @@ public class GameView extends View {
|
||||
}
|
||||
|
||||
static float pythag(float x, float y) {
|
||||
return (float) Math.sqrt(x * x + y * y);
|
||||
return (float) Math.hypot(x, y);
|
||||
}
|
||||
|
||||
static int blend(float alpha, int from, int to) {
|
||||
|
||||
@@ -448,7 +448,7 @@ public class GameView extends View implements InputDeviceListener {
|
||||
}
|
||||
|
||||
private static float pythag(float x, float y) {
|
||||
return (float) Math.sqrt(x * x + y * y);
|
||||
return (float) Math.hypot(x, y);
|
||||
}
|
||||
|
||||
private static int blend(float alpha, int from, int to) {
|
||||
|
||||
@@ -634,7 +634,7 @@ class LunarView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
canvas.drawRect(mScratchRect, mLinePaint);
|
||||
|
||||
// Draw the speed gauge, with a two-tone effect
|
||||
double speed = Math.sqrt(mDX * mDX + mDY * mDY);
|
||||
double speed = Math.hypot(mDX, mDY);
|
||||
int speedWidth = (int) (UI_BAR * speed / PHYS_SPEED_MAX);
|
||||
|
||||
if (speed <= mGoalSpeed) {
|
||||
@@ -756,7 +756,7 @@ class LunarView extends SurfaceView implements SurfaceHolder.Callback {
|
||||
int result = STATE_LOSE;
|
||||
CharSequence message = "";
|
||||
Resources res = mContext.getResources();
|
||||
double speed = Math.sqrt(mDX * mDX + mDY * mDY);
|
||||
double speed = Math.hypot(mDX, mDY);
|
||||
boolean onGoal = (mGoalX <= mX - mLanderWidth / 2 && mX
|
||||
+ mLanderWidth / 2 <= mGoalX + mGoalWidth);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user