diff options
Diffstat (limited to 'tools/layoutlib/bridge/src/android/graphics')
-rw-r--r-- | tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java | 9 | ||||
-rw-r--r-- | tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java | 2 |
2 files changed, 3 insertions, 8 deletions
diff --git a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java index ebfe9bc..e9b5211 100644 --- a/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/Matrix_Delegate.java @@ -716,9 +716,8 @@ public final class Matrix_Delegate { float[] src = new float[] { radius, 0.f, 0.f, radius }; d.mapVectors(src, 0, src, 0, 2); - float l1 = getPointLength(src, 0); - float l2 = getPointLength(src, 2); - + float l1 = (float) Math.hypot(src[0], src[1]); + float l2 = (float) Math.hypot(src[2], src[3]); return (float) Math.sqrt(l1 * l2); } @@ -973,10 +972,6 @@ public final class Matrix_Delegate { } } - private static float getPointLength(float[] src, int index) { - return (float) Math.sqrt(src[index] * src[index] + src[index + 1] * src[index + 1]); - } - /** * multiply two matrices and store them in a 3rd. * <p/>This in effect does dest = a*b diff --git a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java index 4f16dcf..b640ece 100644 --- a/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/RadialGradient_Delegate.java @@ -198,7 +198,7 @@ public class RadialGradient_Delegate extends Gradient_Delegate { float _x = pt2[0]; float _y = pt2[1]; - float distance = (float) Math.sqrt(_x * _x + _y * _y); + float distance = (float) Math.hypot(_x, _y); data[index++] = getGradientColor(distance / mRadius); } |