diff options
author | Mike Dodd <mdodd@google.com> | 2011-09-26 06:59:20 -0700 |
---|---|---|
committer | Wu-cheng Li <wuchengli@google.com> | 2011-10-04 18:45:08 +0800 |
commit | b416f542580970aeac320219b80137b1e9f8d4cd (patch) | |
tree | 731e8169066294a89528a279d96d63fc8867ff9d /src/com/android/camera/Util.java | |
parent | a90deafe482fafe3109668491287c94710c02fdc (diff) | |
download | packages_apps_LegacyCamera-b416f542580970aeac320219b80137b1e9f8d4cd.zip packages_apps_LegacyCamera-b416f542580970aeac320219b80137b1e9f8d4cd.tar.gz packages_apps_LegacyCamera-b416f542580970aeac320219b80137b1e9f8d4cd.tar.bz2 |
Fix display of preview thumbnail after recording video.
The first was that the code was trying to rotate the video thumbnail
retrieved from MetadataRetriever back by just reversing whatever
rotation we set as a playback hint when we started recording. But
this isn't actually correct -- the bitmap we get back from MetadataRetriever
is going to be oriented correctly for display if the device is oriented
in the locked UI orientation (landscape), and we need to rotate it
to compensate for what the actual device orientation is relative to
that.
Phrased another way, we were taking into account the camera and
device orientation, but not the UI orientation. This just happened
to work on some devices because of their camera orientations, but not all.
bug:5360349
Change-Id: I8b481907c211328726ecd91fa054b9e9a4798601
Diffstat (limited to 'src/com/android/camera/Util.java')
-rw-r--r-- | src/com/android/camera/Util.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/com/android/camera/Util.java b/src/com/android/camera/Util.java index c5bc79d..61a55dd 100644 --- a/src/com/android/camera/Util.java +++ b/src/com/android/camera/Util.java @@ -115,8 +115,8 @@ public class Util { public static Bitmap rotateAndMirror(Bitmap b, int degrees, boolean mirror) { if ((degrees != 0 || mirror) && b != null) { Matrix m = new Matrix(); - m.setRotate(degrees, - (float) b.getWidth() / 2, (float) b.getHeight() / 2); + // Mirror first. + // horizontal flip + rotation = -rotation + horizontal flip if (mirror) { m.postScale(-1, 1); degrees = (degrees + 360) % 360; @@ -128,6 +128,11 @@ public class Util { throw new IllegalArgumentException("Invalid degrees=" + degrees); } } + if (degrees != 0) { + // clockwise + m.postRotate(degrees, + (float) b.getWidth() / 2, (float) b.getHeight() / 2); + } try { Bitmap b2 = Bitmap.createBitmap( |