mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-13 01:55:44 +00:00
Bug 1169427 - Replace FloatMath.*() calls with calls to Math.*(). r=snorp
--HG-- extra : transplant_source : %2B%1A%92%92%CC%D3%9AN%92v%EAr%E2%12%F4I%14%90s%E6
This commit is contained in:
parent
1d6d8d3af7
commit
5aa15ff7bc
@ -13,7 +13,6 @@ import org.json.JSONArray;
|
||||
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.util.FloatMath;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.HashMap;
|
||||
@ -184,10 +183,10 @@ final class DisplayPortCalculator {
|
||||
float top = metrics.viewportRectTop - margins.top;
|
||||
float right = metrics.viewportRectRight + margins.right;
|
||||
float bottom = metrics.viewportRectBottom + margins.bottom;
|
||||
left = Math.max(metrics.pageRectLeft, TILE_SIZE * FloatMath.floor(left / TILE_SIZE));
|
||||
top = Math.max(metrics.pageRectTop, TILE_SIZE * FloatMath.floor(top / TILE_SIZE));
|
||||
right = Math.min(metrics.pageRectRight, TILE_SIZE * FloatMath.ceil(right / TILE_SIZE));
|
||||
bottom = Math.min(metrics.pageRectBottom, TILE_SIZE * FloatMath.ceil(bottom / TILE_SIZE));
|
||||
left = (float) Math.max(metrics.pageRectLeft, TILE_SIZE * Math.floor(left / TILE_SIZE));
|
||||
top = (float) Math.max(metrics.pageRectTop, TILE_SIZE * Math.floor(top / TILE_SIZE));
|
||||
right = (float) Math.min(metrics.pageRectRight, TILE_SIZE * Math.ceil(right / TILE_SIZE));
|
||||
bottom = (float) Math.min(metrics.pageRectBottom, TILE_SIZE * Math.ceil(bottom / TILE_SIZE));
|
||||
return new DisplayPortMetrics(left, top, right, bottom, zoom);
|
||||
}
|
||||
|
||||
@ -747,7 +746,7 @@ final class DisplayPortCalculator {
|
||||
public boolean drawTimeUpdate(long millis, int pixels) {
|
||||
// calculate the number of frames it took to draw a viewport-sized area
|
||||
float normalizedTime = (float)mPixelArea * millis / pixels;
|
||||
int normalizedFrames = (int)FloatMath.ceil(normalizedTime * 60f / 1000f);
|
||||
int normalizedFrames = (int) Math.ceil(normalizedTime * 60f / 1000f);
|
||||
// broaden our range on how long it takes to draw if the draw falls outside
|
||||
// the range. this allows it to grow gradually. this heuristic may need to
|
||||
// be tweaked into more of a floating window average or something.
|
||||
|
@ -8,8 +8,6 @@ package org.mozilla.gecko.gfx;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import android.util.FloatMath;
|
||||
|
||||
public class IntSize {
|
||||
public final int width, height;
|
||||
|
||||
@ -75,7 +73,7 @@ public class IntSize {
|
||||
}
|
||||
|
||||
public static int largestPowerOfTwoLessThan(float value) {
|
||||
int val = (int)FloatMath.floor(value);
|
||||
int val = (int) Math.floor(value);
|
||||
if (val <= 0) {
|
||||
throw new IllegalArgumentException("Error: value must be > 0");
|
||||
}
|
||||
|
@ -21,7 +21,6 @@ import org.mozilla.gecko.util.ThreadUtils;
|
||||
|
||||
import android.graphics.PointF;
|
||||
import android.graphics.RectF;
|
||||
import android.util.FloatMath;
|
||||
import android.util.Log;
|
||||
import android.view.GestureDetector;
|
||||
import android.view.InputDevice;
|
||||
@ -668,7 +667,7 @@ class JavaPanZoomController
|
||||
private float panDistance(MotionEvent move) {
|
||||
float dx = mX.panDistance(move.getX(0));
|
||||
float dy = mY.panDistance(move.getY(0));
|
||||
return FloatMath.sqrt(dx * dx + dy * dy);
|
||||
return (float) Math.sqrt(dx * dx + dy * dy);
|
||||
}
|
||||
|
||||
private void track(float x, float y, long time) {
|
||||
@ -801,7 +800,7 @@ class JavaPanZoomController
|
||||
private float getVelocity() {
|
||||
float xvel = mX.getRealVelocity();
|
||||
float yvel = mY.getRealVelocity();
|
||||
return FloatMath.sqrt(xvel * xvel + yvel * yvel);
|
||||
return (float) Math.sqrt(xvel * xvel + yvel * yvel);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -9,7 +9,6 @@ import org.mozilla.gecko.gfx.LayerView;
|
||||
|
||||
import android.app.Instrumentation;
|
||||
import android.os.SystemClock;
|
||||
import android.util.FloatMath;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@ -133,7 +132,7 @@ class MotionEventHelper {
|
||||
// will trigger the fling.
|
||||
final float dx = (endX - startX) / 2;
|
||||
final float dy = (endY - startY) / 2;
|
||||
float distance = FloatMath.sqrt((dx * dx) + (dy * dy));
|
||||
float distance = (float) Math.sqrt((dx * dx) + (dy * dy));
|
||||
final long time = (long)(distance / velocity);
|
||||
if (time <= 0) {
|
||||
throw new IllegalArgumentException( "Fling parameters require too small a time period" );
|
||||
|
Loading…
Reference in New Issue
Block a user