diff options
author | ztenghui <ztenghui@google.com> | 2013-10-07 14:54:55 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2013-10-07 17:19:41 -0700 |
commit | 06578b59bf15c1ac35dbbffd979f40479b1cbda9 (patch) | |
tree | d5b5c1310f9aaf178238c5e3a26fddbf2b149c3c /src/com/android/camera/data | |
parent | 4de788063b51cc2d3f65122bdcc7f862170ba761 (diff) | |
download | android_packages_apps_Snap-06578b59bf15c1ac35dbbffd979f40479b1cbda9.tar.gz android_packages_apps_Snap-06578b59bf15c1ac35dbbffd979f40479b1cbda9.tar.bz2 android_packages_apps_Snap-06578b59bf15c1ac35dbbffd979f40479b1cbda9.zip |
Keep the ImageData size info consistent with MediaStore and Exif
Basically, the width and hight in the ImageData will be pre-rotation.
bug:11067085
Change-Id: I377caf2f1d49d26b4d6823d4e72168a055d80858
Diffstat (limited to 'src/com/android/camera/data')
-rw-r--r-- | src/com/android/camera/data/LocalMediaData.java | 17 | ||||
-rw-r--r-- | src/com/android/camera/data/RotationTask.java | 12 |
2 files changed, 5 insertions, 24 deletions
diff --git a/src/com/android/camera/data/LocalMediaData.java b/src/com/android/camera/data/LocalMediaData.java index 8e4b2f280..1f9c725d0 100644 --- a/src/com/android/camera/data/LocalMediaData.java +++ b/src/com/android/camera/data/LocalMediaData.java @@ -379,11 +379,7 @@ public abstract class LocalMediaData implements LocalData { } } } - if (orientation == 90 || orientation == 270) { - int b = width; - width = height; - height = b; - } + long sizeInBytes = c.getLong(COL_SIZE); double latitude = c.getDouble(COL_LATITUDE); double longitude = c.getDouble(COL_LONGITUDE); @@ -519,18 +515,11 @@ public abstract class LocalMediaData implements LocalData { decodedHeight = justBoundsOpts.outHeight; } - int viewWidth = decodedWidth; - int viewHeight = decodedHeight; - if (mOrientation == 90 || mOrientation == 270) { - viewWidth = decodedHeight; - viewHeight = decodedWidth; - } - // If the width and height is valid and not matching the values // from MediaStore, then update the MediaStore. This only // happened when the MediaStore had been told a wrong data. - if (viewWidth > 0 && viewHeight > 0 && - (viewWidth != mWidth || viewHeight != mHeight)) { + if (decodedWidth > 0 && decodedHeight > 0 && + (decodedWidth != mWidth || decodedHeight != mHeight)) { ContentValues values = new ContentValues(); values.put(Images.Media.WIDTH, decodedWidth); values.put(Images.Media.HEIGHT, decodedHeight); diff --git a/src/com/android/camera/data/RotationTask.java b/src/com/android/camera/data/RotationTask.java index 950ae9371..558815a50 100644 --- a/src/com/android/camera/data/RotationTask.java +++ b/src/com/android/camera/data/RotationTask.java @@ -121,14 +121,6 @@ public class RotationTask extends AsyncTask<LocalData, Void, LocalData> { PhotoData result = null; if (success) { - // Swap width and height after rotation. The new width and height - // will be used to create the PhotoData, not used to update - // MediaStore or Exif. Because we will re-calculate the width and - // height based on the orientation info. - int oldWidth = imageData.getWidth(); - int newWidth = imageData.getHeight(); - int newHeight = oldWidth; - // MediaStore using SQLite is thread safe. values.put(Images.Media.ORIENTATION, finalRotationDegrees); mContext.getContentResolver().update(imageData.getContentUri(), @@ -143,8 +135,8 @@ public class RotationTask extends AsyncTask<LocalData, Void, LocalData> { result = new PhotoData(data.getContentId(), data.getTitle(), data.getMimeType(), data.getDateTaken(), data.getDateModified(), - data.getPath(), newOrientation, newWidth, newHeight, - data.getSizeInBytes(), latitude, longitude); + data.getPath(), newOrientation, imageData.getWidth(), + imageData.getHeight(), data.getSizeInBytes(), latitude, longitude); } return result; |