diff options
author | mingwax <mingwax@codeaurora.org> | 2017-03-01 16:33:30 +0800 |
---|---|---|
committer | mingwax <mingwax@codeaurora.org> | 2017-03-01 17:28:51 +0800 |
commit | 2624bca797eaa140b2602909913c19fff548e60c (patch) | |
tree | 4ae49cce6f95cbf11eb04af7488447653de83470 /src | |
parent | 727fdda2c1d3db4cc107825f8e6ab114f60b7064 (diff) | |
download | android_packages_apps_Snap-2624bca797eaa140b2602909913c19fff548e60c.tar.gz android_packages_apps_Snap-2624bca797eaa140b2602909913c19fff548e60c.tar.bz2 android_packages_apps_Snap-2624bca797eaa140b2602909913c19fff548e60c.zip |
SnapdragonCamera: Fix live shot image stretch when recording is 4K
(1) When the video is seted 4K UHD, the mVideoSnapshotSize should
be setted the similar aspect ratio to ensure the picture which live
shotted is not stretched.
(2) Fixed the width and height of the panorama image
CRs-Fixed: 2012167
Change-Id: I15d139c6d558923d6b4a32ee3613c44c7a974129
Diffstat (limited to 'src')
-rw-r--r--[-rwxr-xr-x] | src/com/android/camera/CaptureModule.java | 8 | ||||
-rw-r--r-- | src/com/android/camera/ui/PanoCaptureProcessView.java | 3 |
2 files changed, 9 insertions, 2 deletions
diff --git a/src/com/android/camera/CaptureModule.java b/src/com/android/camera/CaptureModule.java index e4c162a5b..d2545f448 100755..100644 --- a/src/com/android/camera/CaptureModule.java +++ b/src/com/android/camera/CaptureModule.java @@ -4446,8 +4446,14 @@ public class CaptureModule implements CameraModule, PhotoController, private Size getMaxPictureSizeLessThan4k() { Size[] sizes = mSettingsManager.getSupportedOutputSize(getMainCameraId(), ImageFormat.JPEG); + float ratio = (float) mVideoSize.getWidth() / mVideoSize.getHeight(); for (Size size : sizes) { - if (!is4kSize(size)) return size; + if (!is4kSize(size)) { + float pictureRatio = (float) size.getWidth() / size.getHeight(); + if (Math.abs(pictureRatio - ratio) < 0.01) { + return size; + } + } } return sizes[sizes.length - 1]; } diff --git a/src/com/android/camera/ui/PanoCaptureProcessView.java b/src/com/android/camera/ui/PanoCaptureProcessView.java index 95e9a095f..5a89fb247 100644 --- a/src/com/android/camera/ui/PanoCaptureProcessView.java +++ b/src/com/android/camera/ui/PanoCaptureProcessView.java @@ -628,9 +628,10 @@ public class PanoCaptureProcessView extends View implements SensorEventListener if(mDir == DIRECTION_UPDOWN) { orient = 0; } - final Uri uri = mController.savePanorama(jpegData, mFinalPictureWidth*8, mFinalPictureHeight, orient); Bitmap bm = BitmapFactory.decodeByteArray(jpegData, 0, jpegData.length); final Bitmap thumbBitmap = CameraUtil.rotate(bm, orient); + final Uri uri = mController.savePanorama(jpegData, + thumbBitmap.getWidth(), thumbBitmap.getHeight(), orient); if(uri != null) { mActivity.runOnUiThread(new Runnable() { public void run() { |