summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/FilterShowActivity.java
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-07-02 15:02:43 -0700
committernicolasroard <nicolasroard@google.com>2013-07-02 15:12:27 -0700
commit68ce09f03fdf73c48295d3d2b6615b21d72b1399 (patch)
tree98c0ca3cf2766fdee0b41f6f355a7ff11ad91a0a /src/com/android/gallery3d/filtershow/FilterShowActivity.java
parentdbc7b1ebe939d68cbc7f01878e038ca3e9c35f89 (diff)
downloadandroid_packages_apps_Snap-68ce09f03fdf73c48295d3d2b6615b21d72b1399.tar.gz
android_packages_apps_Snap-68ce09f03fdf73c48295d3d2b6615b21d72b1399.tar.bz2
android_packages_apps_Snap-68ce09f03fdf73c48295d3d2b6615b21d72b1399.zip
Speed up load times
Compute the small res image on the fly Load the high res preview image after first load Change-Id: Icc556c2204cb4fd25766d90064a5756c877b11cc
Diffstat (limited to 'src/com/android/gallery3d/filtershow/FilterShowActivity.java')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 830289348..0d9205a86 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -498,6 +498,24 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
mCategoryBordersAdapter.reflectImagePreset(preset);
}
+ private class LoadHighresBitmapTask extends AsyncTask<Void, Void, Boolean> {
+ @Override
+ protected Boolean doInBackground(Void... params) {
+ mImageLoader.loadHighResBitmap();
+ return true;
+ }
+
+ @Override
+ protected void onPostExecute(Boolean result) {
+ Bitmap highresBitmap = mImageLoader.getOriginalBitmapHighres();
+ if (highresBitmap != null) {
+ FilteringPipeline pipeline = FilteringPipeline.getPipeline();
+ float highResPreviewScale = (float) highresBitmap.getWidth() / (float) mImageLoader.getOriginalBounds().width();
+ pipeline.setHighResPreviewScaleFactor(highResPreviewScale);
+ }
+ }
+ }
+
private class LoadBitmapTask extends AsyncTask<Uri, Boolean, Boolean> {
int mBitmapSize;
@@ -550,11 +568,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
pipeline.setOriginal(largeBitmap);
float previewScale = (float) largeBitmap.getWidth() / (float) mImageLoader.getOriginalBounds().width();
pipeline.setPreviewScaleFactor(previewScale);
- Bitmap highresBitmap = mImageLoader.getOriginalBitmapHighres();
- if (highresBitmap != null) {
- float highResPreviewScale = (float) highresBitmap.getWidth() / (float) mImageLoader.getOriginalBounds().width();
- pipeline.setHighResPreviewScaleFactor(highResPreviewScale);
- }
if (!mShowingTinyPlanet) {
mCategoryFiltersAdapter.removeTinyPlanet();
}
@@ -578,6 +591,8 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
mLoading = false;
MasterImage.getImage().notifyGeometryChange();
+ LoadHighresBitmapTask highresLoad = new LoadHighresBitmapTask();
+ highresLoad.execute();
super.onPostExecute(result);
}