am c467ac37: am 06ff2f72: Merge "Fixes the issue with preview when ratio is 1:1" into jb-dev
* commit 'c467ac37f213957acfb1ae1cd8e6335aed7bc6a8':
Fixes the issue with preview when ratio is 1:1
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
index 9989057..bc4e5f0 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
@@ -401,9 +401,15 @@
float widthRatio = mNextPreviewSize.width / (float)mPreviewTexWidth;
float heightRatio = mNextPreviewSize.height / (float)mPreviewTexHeight;
- transform.setScale(1, heightRatio/widthRatio);
- transform.postTranslate(0,
+ if (heightRatio < widthRatio) {
+ transform.setScale(1, heightRatio/widthRatio);
+ transform.postTranslate(0,
mPreviewTexHeight * (1 - heightRatio/widthRatio)/2);
+ } else {
+ transform.setScale(widthRatio/heightRatio, 1);
+ transform.postTranslate(mPreviewTexWidth * (1 - widthRatio/heightRatio)/2,
+ 0);
+ }
mPreviewView.setTransform(transform);
@@ -719,4 +725,4 @@
}
}
-}
\ No newline at end of file
+}