summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorThe Android Open Source Project <initial-contribution@android.com>2010-02-11 10:03:02 -0800
committerThe Android Open Source Project <initial-contribution@android.com>2010-02-11 10:03:02 -0800
commit1e90ab542d675616e9370ab7e5add99d7af12587 (patch)
treeba207d9049c64f2acd4dcf02ba177be38a05a3bb /graphics/java
parent61bb25f2f92af10b685d6bd1452bc5505995c64e (diff)
parent27f3de6bac93140452ce131cbbd8c6df33e25a94 (diff)
downloadframeworks_base-1e90ab542d675616e9370ab7e5add99d7af12587.zip
frameworks_base-1e90ab542d675616e9370ab7e5add99d7af12587.tar.gz
frameworks_base-1e90ab542d675616e9370ab7e5add99d7af12587.tar.bz2
merge from open-source master
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/drawable/RotateDrawable.java24
1 files changed, 19 insertions, 5 deletions
diff --git a/graphics/java/android/graphics/drawable/RotateDrawable.java b/graphics/java/android/graphics/drawable/RotateDrawable.java
index c4a7822..2083e05 100644
--- a/graphics/java/android/graphics/drawable/RotateDrawable.java
+++ b/graphics/java/android/graphics/drawable/RotateDrawable.java
@@ -204,13 +204,27 @@ public class RotateDrawable extends Drawable implements Drawable.Callback {
com.android.internal.R.styleable.RotateDrawable_visible);
TypedValue tv = a.peekValue(com.android.internal.R.styleable.RotateDrawable_pivotX);
- boolean pivotXRel = tv.type == TypedValue.TYPE_FRACTION;
- float pivotX = pivotXRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
+ boolean pivotXRel;
+ float pivotX;
+ if (tv == null) {
+ pivotXRel = true;
+ pivotX = 0.5f;
+ } else {
+ pivotXRel = tv.type == TypedValue.TYPE_FRACTION;
+ pivotX = pivotXRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
+ }
tv = a.peekValue(com.android.internal.R.styleable.RotateDrawable_pivotY);
- boolean pivotYRel = tv.type == TypedValue.TYPE_FRACTION;
- float pivotY = pivotYRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
-
+ boolean pivotYRel;
+ float pivotY;
+ if (tv == null) {
+ pivotYRel = true;
+ pivotY = 0.5f;
+ } else {
+ pivotYRel = tv.type == TypedValue.TYPE_FRACTION;
+ pivotY = pivotYRel ? tv.getFraction(1.0f, 1.0f) : tv.getFloat();
+ }
+
float fromDegrees = a.getFloat(
com.android.internal.R.styleable.RotateDrawable_fromDegrees, 0.0f);
float toDegrees = a.getFloat(