summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Xavier Ducrohet <xav@android.com> 2010-11-04 11:03:45 -0700
committer Android (Google) Code Review <android-gerrit@google.com> 2010-11-04 11:03:45 -0700
commitf5a6c67fbef585967ef42bacc6970807c49034af (patch)
tree9069d6e8cd4e0bce6ee1b0fbb5851fd4e1206190
parentde2dfc91e66d1b142fe573f5d3ffbc82c620bcb3 (diff)
parent9c05b3972872d83c60bf5afe1a05f08c7753cd9a (diff)
Merge "Layoutlib native delegate: FloatMath."
-rw-r--r--tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java (renamed from tools/layoutlib/bridge/src/android/util/FloatMath.java)30
-rw-r--r--tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java2
2 files changed, 17 insertions, 15 deletions
diff --git a/tools/layoutlib/bridge/src/android/util/FloatMath.java b/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java
index aae44f261e18..ed24e167b2b9 100644
--- a/tools/layoutlib/bridge/src/android/util/FloatMath.java
+++ b/tools/layoutlib/bridge/src/android/util/FloatMath_Delegate.java
@@ -16,20 +16,22 @@
package android.util;
+import com.android.layoutlib.bridge.DelegateManager;
+
/**
- * Reimplements _Original_FloatMath with the standard libraries.
- *
- * Math routines similar to those found in {@link java.lang.Math}. Performs
- * computations on {@code float} values directly without incurring the overhead
- * of conversions to and from {@code double}.
+ * Delegate implementing the native methods of android.util.FloatMath
+ *
+ * Through the layoutlib_create tool, the original native methods of FloatMath have been replaced
+ * by calls to methods of the same name in this delegate class.
+ *
+ * Because it's a stateless class to start with, there's no need to keep a {@link DelegateManager}
+ * around to map int to instance of the delegate.
*
- * <p>On one platform, {@code FloatMath.sqrt(100)} executes in one third of the
- * time required by {@code java.lang.Math.sqrt(100)}.</p>
*/
-public class FloatMath {
+/*package*/ final class FloatMath_Delegate {
/** Prevents instantiation. */
- private FloatMath() {}
+ private FloatMath_Delegate() {}
/**
* Returns the float conversion of the most positive (i.e. closest to
@@ -38,7 +40,7 @@ public class FloatMath {
* @param value to be converted
* @return the floor of value
*/
- public static float floor(float value) {
+ /*package*/ static float floor(float value) {
return (float)Math.floor(value);
}
@@ -49,7 +51,7 @@ public class FloatMath {
* @param value to be converted
* @return the ceiling of value
*/
- public static float ceil(float value) {
+ /*package*/ static float ceil(float value) {
return (float)Math.ceil(value);
}
@@ -59,7 +61,7 @@ public class FloatMath {
* @param angle to compute the cosine of, in radians
* @return the sine of angle
*/
- public static float sin(float angle) {
+ /*package*/ static float sin(float angle) {
return (float)Math.sin(angle);
}
@@ -69,7 +71,7 @@ public class FloatMath {
* @param angle to compute the cosine of, in radians
* @return the cosine of angle
*/
- public static float cos(float angle) {
+ /*package*/ static float cos(float angle) {
return (float)Math.cos(angle);
}
@@ -80,7 +82,7 @@ public class FloatMath {
* @param value to compute sqrt of
* @return the square root of value
*/
- public static float sqrt(float value) {
+ /*package*/ static float sqrt(float value) {
return (float)Math.sqrt(value);
}
}
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
index 19bdb2c374bd..8e05c312e743 100644
--- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
+++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java
@@ -116,6 +116,7 @@ public final class CreateInfo implements ICreateInfo {
"android.graphics.SweepGradient",
"android.graphics.Typeface",
"android.graphics.Xfermode",
+ "android.util.FloatMath",
};
/**
@@ -137,7 +138,6 @@ public final class CreateInfo implements ICreateInfo {
"android.graphics.BitmapFactory", "android.graphics._Original_BitmapFactory",
"android.graphics.Path", "android.graphics._Original_Path",
"android.os.ServiceManager", "android.os._Original_ServiceManager",
- "android.util.FloatMath", "android.util._Original_FloatMath",
"android.view.SurfaceView", "android.view._Original_SurfaceView",
"android.view.accessibility.AccessibilityManager", "android.view.accessibility._Original_AccessibilityManager",
};