diff options
author | Chet Haase <chet@google.com> | 2010-09-09 15:39:46 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-09-09 15:39:46 -0700 |
commit | f47f8bc31022010cb6b8f4c50f0f888bc5689163 (patch) | |
tree | 80f56bf348ff9e67ffe6494d153285e0aad69827 | |
parent | e611ad410abf5074105b96d1cf834e5f288dab91 (diff) | |
parent | 897247b2c419567d2d091b8da37a394f481f6f84 (diff) | |
download | frameworks_base-f47f8bc31022010cb6b8f4c50f0f888bc5689163.zip frameworks_base-f47f8bc31022010cb6b8f4c50f0f888bc5689163.tar.gz frameworks_base-f47f8bc31022010cb6b8f4c50f0f888bc5689163.tar.bz2 |
Merge "Fix bug with pivot point not including translationXY factors"
-rw-r--r-- | core/java/android/view/View.java | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 5d25896..833fa70 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5094,20 +5094,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } } mMatrix.reset(); - mMatrix.setTranslate(mTranslationX, mTranslationY); - mMatrix.preRotate(mRotation, mPivotX, mPivotY); - mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY); - if (nonzero(mRotationX) || nonzero(mRotationY)) { + if (!nonzero(mRotationX) && !nonzero(mRotationY)) { + mMatrix.setTranslate(mTranslationX, mTranslationY); + mMatrix.preRotate(mRotation, mPivotX, mPivotY); + mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY); + } else { if (mCamera == null) { mCamera = new Camera(); matrix3D = new Matrix(); } mCamera.save(); + mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY); mCamera.rotateX(mRotationX); mCamera.rotateY(mRotationY); + mCamera.rotateZ(-mRotation); mCamera.getMatrix(matrix3D); matrix3D.preTranslate(-mPivotX, -mPivotY); - matrix3D.postTranslate(mPivotX, mPivotY); + matrix3D.postTranslate(mPivotX + mTranslationX, mPivotY + mTranslationY); mMatrix.postConcat(matrix3D); mCamera.restore(); } @@ -5148,7 +5151,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } /** - * Sets the degrees that the view is rotated around the pivot point. + * Sets the degrees that the view is rotated around the pivot point. Increasing values + * result in clockwise rotation. * * @param rotation The degrees of rotation. * @see #getPivotX() @@ -5177,7 +5181,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } /** - * Sets the degrees that the view is rotated around the vertical axis through pivot point. + * Sets the degrees that the view is rotated around the vertical axis through the pivot point. + * Increasing values result in counter-clockwise rotation from the viewpoint of looking + * down the y axis. * * @param rotationY The degrees of Y rotation. * @see #getPivotX() @@ -5206,7 +5212,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility } /** - * Sets the degrees that the view is rotated around the horizontal axis through pivot point. + * Sets the degrees that the view is rotated around the horizontal axis through the pivot point. + * Increasing values result in clockwise rotation from the viewpoint of looking down the + * x axis. * * @param rotationX The degrees of X rotation. * @see #getPivotX() |