lint changed its opinion on whether FloatMath is faster than Math. need to do some benchmarks..
http://code.google.com/p/android/issues/detail?id=36199
This commit is contained in:
@@ -18,8 +18,6 @@ import org.oscim.renderer.layer.TextItem;
|
||||
import org.oscim.theme.renderinstruction.Text;
|
||||
import org.oscim.utils.GeometryUtils;
|
||||
|
||||
import android.util.FloatMath;
|
||||
|
||||
public final class WayDecorator {
|
||||
// /**
|
||||
// * Minimum distance in pixels before the symbol is repeated.
|
||||
@@ -168,7 +166,7 @@ public final class WayDecorator {
|
||||
continue;
|
||||
}
|
||||
|
||||
float segmentLengthInPixel = FloatMath.sqrt(diffX * diffX + diffY * diffY);
|
||||
double segmentLengthInPixel = Math.sqrt(diffX * diffX + diffY * diffY);
|
||||
|
||||
if (skipPixels > 0) {
|
||||
skipPixels -= segmentLengthInPixel;
|
||||
@@ -181,7 +179,7 @@ public final class WayDecorator {
|
||||
|
||||
if (segmentLengthInPixel > wayNameWidth * 0.80) {
|
||||
|
||||
float s = (wayNameWidth + 25) / segmentLengthInPixel;
|
||||
float s = (wayNameWidth + 25) / (float) segmentLengthInPixel;
|
||||
int width, height;
|
||||
int x1, y1, x2, y2;
|
||||
|
||||
@@ -241,21 +239,6 @@ public final class WayDecorator {
|
||||
continue;
|
||||
}
|
||||
|
||||
// Log.d("mapsforge", "add " + text + " " + first + " " +
|
||||
// last);
|
||||
|
||||
// if (previousX < currentX) {
|
||||
// x1 = previousX;
|
||||
// y1 = previousY;
|
||||
// x2 = currentX;
|
||||
// y2 = currentY;
|
||||
// } else {
|
||||
// x1 = currentX;
|
||||
// y1 = currentY;
|
||||
// x2 = previousX;
|
||||
// y2 = previousY;
|
||||
// }
|
||||
|
||||
// if (t == null)
|
||||
t = TextItem.get();
|
||||
// t = new TextItem(x1 + (x2 - x1) / 2, y1 + (y2 - y1) / 2,
|
||||
|
||||
@@ -19,7 +19,6 @@ import org.oscim.renderer.GLRenderer;
|
||||
import org.oscim.theme.renderinstruction.Line;
|
||||
|
||||
import android.graphics.Paint.Cap;
|
||||
import android.util.FloatMath;
|
||||
|
||||
public final class LineLayer extends Layer {
|
||||
|
||||
@@ -122,7 +121,7 @@ public final class LineLayer extends Layer {
|
||||
vx = nextX - x;
|
||||
vy = nextY - y;
|
||||
|
||||
a = FloatMath.sqrt(vx * vx + vy * vy);
|
||||
a = (float) Math.sqrt(vx * vx + vy * vy);
|
||||
|
||||
vx = (vx / a);
|
||||
vy = (vy / a);
|
||||
@@ -289,14 +288,14 @@ public final class LineLayer extends Layer {
|
||||
// Unit vector pointing back to previous node
|
||||
vx = prevX - x;
|
||||
vy = prevY - y;
|
||||
a = FloatMath.sqrt(vx * vx + vy * vy);
|
||||
a = (float) Math.sqrt(vx * vx + vy * vy);
|
||||
vx = (vx / a);
|
||||
vy = (vy / a);
|
||||
|
||||
// Unit vector pointing forward to next node
|
||||
wx = nextX - x;
|
||||
wy = nextY - y;
|
||||
a = FloatMath.sqrt(wx * wx + wy * wy);
|
||||
a = (float) Math.sqrt(wx * wx + wy * wy);
|
||||
wx = (wx / a);
|
||||
wy = (wy / a);
|
||||
|
||||
@@ -369,7 +368,7 @@ public final class LineLayer extends Layer {
|
||||
vx = prevX - x;
|
||||
vy = prevY - y;
|
||||
|
||||
a = FloatMath.sqrt(vx * vx + vy * vy);
|
||||
a = (float) Math.sqrt(vx * vx + vy * vy);
|
||||
|
||||
vx = (vx / a);
|
||||
vy = (vy / a);
|
||||
|
||||
Reference in New Issue
Block a user