diff options
author | Eino-Ville Talvala <etalvala@google.com> | 2014-07-29 11:16:17 -0700 |
---|---|---|
committer | Eino-Ville Talvala <etalvala@google.com> | 2014-07-29 11:16:17 -0700 |
commit | 0ccba97ebec0e0c5a20f8859ebac03d5fd14c97f (patch) | |
tree | b78c3138b8a923da90cbb8d586968e7891b60563 /camera | |
parent | 7d70c5e5fe787ae5d7af8830864d208749d6337f (diff) | |
download | frameworks_av-0ccba97ebec0e0c5a20f8859ebac03d5fd14c97f.zip frameworks_av-0ccba97ebec0e0c5a20f8859ebac03d5fd14c97f.tar.gz frameworks_av-0ccba97ebec0e0c5a20f8859ebac03d5fd14c97f.tar.bz2 |
Camera2: Fix transforms for front-facing cameras
Mirror, mirror on the wall, who is the best rotated of them all?
Also, use consistent enum names.
Bug: 16637957
Change-Id: Ie211d3b57b9e7d01122192ad03b73ceba5bf1bd3
Diffstat (limited to 'camera')
-rw-r--r-- | camera/CameraUtils.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/camera/CameraUtils.cpp b/camera/CameraUtils.cpp index 3ff181d..1ff63ab 100644 --- a/camera/CameraUtils.cpp +++ b/camera/CameraUtils.cpp @@ -73,18 +73,25 @@ status_t CameraUtils::getRotationTransform(const CameraMetadata& staticInfo, return INVALID_OPERATION; } } else { + // Front camera needs to be horizontally flipped for + // mirror-like behavior. + // Note: Flips are applied before rotates. switch (orientation) { case 0: - flags = HAL_TRANSFORM_FLIP_H; + flags = NATIVE_WINDOW_TRANSFORM_FLIP_H; break; case 90: - flags = HAL_TRANSFORM_FLIP_H | HAL_TRANSFORM_ROT_90; + flags = NATIVE_WINDOW_TRANSFORM_FLIP_H | + NATIVE_WINDOW_TRANSFORM_ROT_270; break; case 180: - flags = HAL_TRANSFORM_FLIP_V; + flags = NATIVE_WINDOW_TRANSFORM_FLIP_H | + NATIVE_WINDOW_TRANSFORM_ROT_180; break; case 270: - flags = HAL_TRANSFORM_FLIP_V | HAL_TRANSFORM_ROT_90; + flags = NATIVE_WINDOW_TRANSFORM_FLIP_H | + NATIVE_WINDOW_TRANSFORM_ROT_90; + break; default: ALOGE("%s: Invalid HAL android.sensor.orientation value: %d", |