diff options
author | Wu-cheng Li <wuchengli@google.com> | 2012-05-30 16:02:24 +0800 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2012-05-30 16:38:33 +0800 |
commit | 40d99c1258ef297c18bf0857860b326d517bf4aa (patch) | |
tree | fb7f87c9a868d13562bc17811b6c427cff0b9ebb /src | |
parent | 1d622592aec9105cf659af6b7cfb33bf057f3589 (diff) | |
download | Camera-40d99c1258ef297c18bf0857860b326d517bf4aa.tar.gz |
Fix incorrect sizes in camera switch animation.
bug:5954954
Change-Id: I869df22e650e0cdc5488b96ed624883ac8ac398f
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/camera/ActivityBase.java | 15 | ||||
-rw-r--r-- | src/com/android/camera/CameraScreenNail.java | 3 |
2 files changed, 14 insertions, 4 deletions
diff --git a/src/com/android/camera/ActivityBase.java b/src/com/android/camera/ActivityBase.java index 9a102b16..ea8f837d 100644 --- a/src/com/android/camera/ActivityBase.java +++ b/src/com/android/camera/ActivityBase.java @@ -366,7 +366,16 @@ abstract public class ActivityBase extends AbstractGalleryActivity return; } - mCameraScreenNail.setPreviewFrameLayoutSize(right - left, bottom - top); + + int width = right - left; + int height = bottom - top; + if (Util.getDisplayRotation(this) % 180 == 0) { + mCameraScreenNail.setPreviewFrameLayoutSize(width, height); + } else { + // Swap the width and height. Camera screen nail draw() is based on + // natural orientation, not the view system orientation. + mCameraScreenNail.setPreviewFrameLayoutSize(height, width); + } // Find out the coordinates of the preview frame relative to GL // root view. @@ -378,8 +387,8 @@ abstract public class ActivityBase extends AbstractGalleryActivity int l = viewLocation[0] - rootLocation[0]; int t = viewLocation[1] - rootLocation[1]; - int r = l + (right - left); - int b = t + (bottom - top); + int r = l + width; + int b = t + height; Rect frame = new Rect(l, t, r, b); Log.d(TAG, "set CameraRelativeFrame as " + frame); mAppBridge.setCameraRelativeFrame(frame); diff --git a/src/com/android/camera/CameraScreenNail.java b/src/com/android/camera/CameraScreenNail.java index 18a1946c..1b1964a8 100644 --- a/src/com/android/camera/CameraScreenNail.java +++ b/src/com/android/camera/CameraScreenNail.java @@ -219,7 +219,8 @@ public class CameraScreenNail extends SurfaceTextureScreenNail { // We need to keep track of the size of preview frame on the screen because // it's needed when we do switch-camera animation. See comments in - // SwitchAnimManager.java. + // SwitchAnimManager.java. This is based on the natural orientation, not the + // view system orientation. public void setPreviewFrameLayoutSize(int width, int height) { mSwitchAnimManager.setPreviewFrameLayoutSize(width, height); } |