summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2015-01-07 01:32:34 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2015-01-07 01:32:34 -0800
commit300be7c5bf8796c015a95365cad03e0ef11b1595 (patch)
treea4c8c85c8401cad3191e1a9080d4611399978919 /src/com
parentac99f21a2a7efe9dfd4223cbb42eb3e33ba97479 (diff)
parent1ea460a89823864216b47aae767b0d8f5dceb3ee (diff)
downloadandroid_packages_apps_Snap-300be7c5bf8796c015a95365cad03e0ef11b1595.tar.gz
android_packages_apps_Snap-300be7c5bf8796c015a95365cad03e0ef11b1595.tar.bz2
android_packages_apps_Snap-300be7c5bf8796c015a95365cad03e0ef11b1595.zip
Merge "SnapdragonCamera: Fixed aspect ratio in panormic shoot"
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/camera/WideAnglePanoramaModule.java34
1 files changed, 28 insertions, 6 deletions
diff --git a/src/com/android/camera/WideAnglePanoramaModule.java b/src/com/android/camera/WideAnglePanoramaModule.java
index 40878581e..bc9fd8602 100644
--- a/src/com/android/camera/WideAnglePanoramaModule.java
+++ b/src/com/android/camera/WideAnglePanoramaModule.java
@@ -44,6 +44,7 @@ import android.view.OrientationEventListener;
import android.view.View;
import android.view.ViewGroup;
import android.view.WindowManager;
+import android.view.Display;
import android.widget.Toast;
import com.android.camera.PhotoModule;
import com.android.camera.CameraManager.CameraProxy;
@@ -109,6 +110,8 @@ public class WideAnglePanoramaModule
private boolean mUsingFrontCamera;
private int mCameraPreviewWidth;
private int mCameraPreviewHeight;
+ private int mScreenWidth;
+ private int mScreenHeight;
private int mCameraState;
private int mCaptureState;
private PowerManager.WakeLock mPartialWakeLock;
@@ -369,14 +372,13 @@ public class WideAnglePanoramaModule
return true;
}
- private boolean findBestPreviewSize(List<Size> supportedSizes, boolean need4To3,
+ private boolean findBestPreviewSize(List<Size> supportedSizes, boolean need4To3, boolean need16To9,
boolean needSmaller) {
int pixelsDiff = DEFAULT_CAPTURE_PIXELS;
boolean hasFound = false;
for (Size size : supportedSizes) {
int h = size.height;
int w = size.width;
- // we only want 4:3 format.
int d = DEFAULT_CAPTURE_PIXELS - h * w;
if (needSmaller && d < 0) { // no bigger preview than 960x720.
continue;
@@ -384,6 +386,9 @@ public class WideAnglePanoramaModule
if (need4To3 && (h * 4 != w * 3)) {
continue;
}
+ if (need16To9 && (h * 16 != w * 9)) {
+ continue;
+ }
d = Math.abs(d);
if (d < pixelsDiff) {
mCameraPreviewWidth = w;
@@ -396,12 +401,26 @@ public class WideAnglePanoramaModule
}
private void setupCaptureParams(Parameters parameters) {
+ boolean need4To3 = false;
+ boolean need16To9 = false;
List<Size> supportedSizes = parameters.getSupportedPreviewSizes();
- if (!findBestPreviewSize(supportedSizes, true, true)) {
- Log.w(TAG, "No 4:3 ratio preview size supported.");
- if (!findBestPreviewSize(supportedSizes, false, true)) {
+ Display mDisplay = mActivity.getWindowManager().getDefaultDisplay();
+ mScreenWidth = mDisplay.getWidth();
+ mScreenHeight = mDisplay.getHeight();
+
+ if(mScreenHeight * 4 == mScreenWidth * 3) {
+ need4To3 = true;
+ }
+
+ if(mScreenHeight * 16 == mScreenWidth * 9) {
+ need16To9 = true;
+ }
+
+ if (!findBestPreviewSize(supportedSizes, need4To3, need16To9, true)) {
+ Log.w(TAG, "No preview size supported matching the screen aspect ratio");
+ if (!findBestPreviewSize(supportedSizes, false, false, true)) {
Log.w(TAG, "Can't find a supported preview size smaller than 960x720.");
- findBestPreviewSize(supportedSizes, false, false);
+ findBestPreviewSize(supportedSizes, false, false, false);
}
}
Log.d(TAG, "camera preview h = "
@@ -492,6 +511,9 @@ public class WideAnglePanoramaModule
}
mPreviewUIWidth = r - l;
mPreviewUIHeight = b - t;
+ Parameters parameters = mCameraDevice.getParameters();
+ setupCaptureParams(parameters);
+ configureCamera(parameters);
configMosaicPreview();
if (capturePending == true){
mMainHandler.post(new Runnable() {