diff options
author | Likai Ding <likaid@codeaurora.org> | 2014-09-04 17:43:28 +0800 |
---|---|---|
committer | Ethan Chen <intervigil@gmail.com> | 2014-10-28 21:48:24 +0000 |
commit | fd45a6389727dd2c47ec01d4f3931cc64379636e (patch) | |
tree | d54651a1e235df0f69185dd6ccaa0c5d6cbea2b0 | |
parent | 4fff272e958b014037f06cb362fe79ba2c63dfcb (diff) | |
download | android_packages_apps_Camera2-fd45a6389727dd2c47ec01d4f3931cc64379636e.tar.gz android_packages_apps_Camera2-fd45a6389727dd2c47ec01d4f3931cc64379636e.tar.bz2 android_packages_apps_Camera2-fd45a6389727dd2c47ec01d4f3931cc64379636e.zip |
Camera2: fix sawtooth in camera preview
Under certain combination of preview/screen resolution, sawtooth is
seen on preview image. In setTransformMatrix(),
scaledTextureWidth/Height is unnecessarily rounded to integers,
losing precision. Removing the rounding fixes the problem.
CRs-Fixed: 705322
Change-Id: Ia78b012cf530528b3677a8684279862a81b145ed
-rw-r--r-- | src/com/android/camera/PhotoUI.java | 12 | ||||
-rw-r--r-- | src/com/android/camera/VideoUI.java | 12 |
2 files changed, 8 insertions, 16 deletions
diff --git a/src/com/android/camera/PhotoUI.java b/src/com/android/camera/PhotoUI.java index 3a1e7c0bf..83a7e474d 100644 --- a/src/com/android/camera/PhotoUI.java +++ b/src/com/android/camera/PhotoUI.java @@ -318,15 +318,11 @@ public class PhotoUI implements PieListener, } } else { if (width > height) { - scaledTextureWidth = Math.max(width, - (int) (height * mAspectRatio)); - scaledTextureHeight = Math.max(height, - (int)(width / mAspectRatio)); + scaledTextureWidth = Math.max(width, height * mAspectRatio); + scaledTextureHeight = Math.max(height, width / mAspectRatio); } else { - scaledTextureWidth = Math.max(width, - (int) (height / mAspectRatio)); - scaledTextureHeight = Math.max(height, - (int) (width * mAspectRatio)); + scaledTextureWidth = Math.max(width, height / mAspectRatio); + scaledTextureHeight = Math.max(height, width * mAspectRatio); } } diff --git a/src/com/android/camera/VideoUI.java b/src/com/android/camera/VideoUI.java index 6a77637ad..5d5b1c427 100644 --- a/src/com/android/camera/VideoUI.java +++ b/src/com/android/camera/VideoUI.java @@ -307,15 +307,11 @@ public class VideoUI implements PieRenderer.PieListener, } } else { if (width > height) { - scaledTextureWidth = Math.max(width, - (int) (height * mAspectRatio)); - scaledTextureHeight = Math.max(height, - (int)(width / mAspectRatio)); + scaledTextureWidth = Math.max(width, height * mAspectRatio); + scaledTextureHeight = Math.max(height, width / mAspectRatio); } else { - scaledTextureWidth = Math.max(width, - (int) (height / mAspectRatio)); - scaledTextureHeight = Math.max(height, - (int) (width * mAspectRatio)); + scaledTextureWidth = Math.max(width, height / mAspectRatio); + scaledTextureHeight = Math.max(height, width * mAspectRatio); } } |