summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/app
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2011-09-12 12:45:16 +0800
committerOwen Lin <owenlin@google.com>2011-09-12 16:07:55 +0800
commitb251df22a421b5affb15d7a18700889647dbc856 (patch)
tree81ea21989ba614fd80197afbdf434baf2e42af47 /src/com/android/gallery3d/app
parent6a5a246ca7973054364f5ee8ca2df3164bf38458 (diff)
downloadandroid_packages_apps_Snap-b251df22a421b5affb15d7a18700889647dbc856.tar.gz
android_packages_apps_Snap-b251df22a421b5affb15d7a18700889647dbc856.tar.bz2
android_packages_apps_Snap-b251df22a421b5affb15d7a18700889647dbc856.zip
Fix picasa images rotate incorrectly.
fix: 5268469 Change-Id: I58fc4a6d4a10c2952040eedee5936efa949b66e2
Diffstat (limited to 'src/com/android/gallery3d/app')
-rw-r--r--src/com/android/gallery3d/app/PhotoDataAdapter.java26
1 files changed, 24 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/app/PhotoDataAdapter.java b/src/com/android/gallery3d/app/PhotoDataAdapter.java
index b976dec84..9b1c8c4c0 100644
--- a/src/com/android/gallery3d/app/PhotoDataAdapter.java
+++ b/src/com/android/gallery3d/app/PhotoDataAdapter.java
@@ -16,6 +16,7 @@
package com.android.gallery3d.app;
+import com.android.gallery3d.common.BitmapUtils;
import com.android.gallery3d.common.Utils;
import com.android.gallery3d.data.ContentListener;
import com.android.gallery3d.data.DataManager;
@@ -30,6 +31,8 @@ import com.android.gallery3d.ui.TileImageViewAdapter;
import com.android.gallery3d.util.Future;
import com.android.gallery3d.util.FutureListener;
import com.android.gallery3d.util.ThreadPool;
+import com.android.gallery3d.util.ThreadPool.Job;
+import com.android.gallery3d.util.ThreadPool.JobContext;
import android.graphics.Bitmap;
import android.graphics.BitmapRegionDecoder;
@@ -487,6 +490,25 @@ public class PhotoDataAdapter implements PhotoPage.Model {
}
}
+ private static class ScreenNailJob implements Job<Bitmap> {
+ private MediaItem mItem;
+
+ public ScreenNailJob(MediaItem item) {
+ mItem = item;
+ }
+
+ @Override
+ public Bitmap run(JobContext jc) {
+ Bitmap bitmap = mItem.requestImage(MediaItem.TYPE_THUMBNAIL).run(jc);
+ if (jc.isCancelled()) return null;
+ if (bitmap != null) {
+ bitmap = BitmapUtils.rotateBitmap(bitmap,
+ mItem.getRotation() - mItem.getFullImageRotation(), true);
+ }
+ return bitmap;
+ }
+ }
+
// Returns the task if we started the task or the task is already started.
private Future<?> startTaskIfNeeded(int index, int which) {
if (index < mActiveStart || index >= mActiveEnd) return null;
@@ -507,7 +529,7 @@ public class PhotoDataAdapter implements PhotoPage.Model {
&& (entry.requestedBits & BIT_SCREEN_NAIL) == 0) {
entry.requestedBits |= BIT_SCREEN_NAIL;
entry.screenNailTask = mThreadPool.submit(
- item.requestImage(MediaItem.TYPE_THUMBNAIL),
+ new ScreenNailJob(item),
new ScreenNailListener(item.getDataVersion()));
// request screen nail
return entry.screenNailTask;
@@ -547,7 +569,7 @@ public class PhotoDataAdapter implements PhotoPage.Model {
}
} else {
entry = new ImageEntry();
- entry.rotation = item.getRotation();
+ entry.rotation = item.getFullImageRotation();
mImageCache.put(version, entry);
}
}