diff options
author | nicolasroard <nicolasroard@google.com> | 2013-06-26 16:56:31 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-06-27 10:40:59 -0700 |
commit | 06ed7651d1022d7649de94265f1a382feb791084 (patch) | |
tree | 120a55305b516ec047b275fb4318b93f9fd623b0 /src/com/android/gallery3d/filtershow/imageshow/MasterImage.java | |
parent | 38afc164c9df332dd3789a924db577b67758e673 (diff) | |
download | android_packages_apps_Snap-06ed7651d1022d7649de94265f1a382feb791084.tar.gz android_packages_apps_Snap-06ed7651d1022d7649de94265f1a382feb791084.tar.bz2 android_packages_apps_Snap-06ed7651d1022d7649de94265f1a382feb791084.zip |
ImagePreset cleanup
Get rid of remaining ivars related to history
Change-Id: Ic106ef6a96f4727c6dd46d7be3d059bdc42e5a2a
Diffstat (limited to 'src/com/android/gallery3d/filtershow/imageshow/MasterImage.java')
-rw-r--r-- | src/com/android/gallery3d/filtershow/imageshow/MasterImage.java | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java index 839f638c1..f2e9b6308 100644 --- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java +++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java @@ -23,6 +23,7 @@ import android.os.Message; import android.util.Log; import com.android.gallery3d.filtershow.FilterShowActivity; import com.android.gallery3d.filtershow.HistoryAdapter; +import com.android.gallery3d.filtershow.HistoryItem; import com.android.gallery3d.filtershow.cache.*; import com.android.gallery3d.filtershow.filters.FilterRepresentation; import com.android.gallery3d.filtershow.filters.ImageFilter; @@ -139,7 +140,9 @@ public class MasterImage implements RenderingRequestCaller { return mFiltersOnlyPreset; } - public synchronized void setPreset(ImagePreset preset, boolean addToHistory) { + public synchronized void setPreset(ImagePreset preset, + FilterRepresentation change, + boolean addToHistory) { if (DEBUG) { preset.showFilters(); } @@ -148,7 +151,8 @@ public class MasterImage implements RenderingRequestCaller { setGeometry(); mPreset.fillImageStateAdapter(mState); if (addToHistory) { - mHistory.addHistoryItem(mPreset); + HistoryItem historyItem = new HistoryItem(mPreset, change); + mHistory.addHistoryItem(historyItem); } updatePresets(true); GeometryMetadata geo = mPreset.getGeometry(); @@ -158,23 +162,6 @@ public class MasterImage implements RenderingRequestCaller { mPreviousGeometry = new GeometryMetadata(geo); } - private void renderHistoryPreview() { - ImagePreset historyPreset = mPreset; - if (historyPreset != null) { - Bitmap preview = mLoader.getOriginalBitmapSmall(); - if (preview != null) { - float s = Math.min(preview.getWidth(), preview.getHeight()); - float f = sHistoryPreviewSize / s; - int w = (int) (preview.getWidth() * f); - int h = (int) (preview.getHeight() * f); - Bitmap historyPreview = Bitmap.createScaledBitmap(preview, w, h, true); - historyPreset.setPreviewImage(historyPreview); - RenderingRequest.post(historyPreview, - historyPreset, RenderingRequest.ICON_RENDERING, this); - } - } - } - private void setGeometry() { Bitmap image = mLoader.getOriginalBitmapLarge(); if (image == null) { @@ -194,8 +181,11 @@ public class MasterImage implements RenderingRequestCaller { } public void onHistoryItemClick(int position) { - setPreset(new ImagePreset(mHistory.getItem(position)), false); + HistoryItem historyItem = mHistory.getItem(position); // We need a copy from the history + ImagePreset newPreset = new ImagePreset(historyItem.getImagePreset()); + // don't need to add it to the history + setPreset(newPreset, historyItem.getFilterRepresentation(), false); mHistory.setCurrentPreset(position); } @@ -417,13 +407,6 @@ public class MasterImage implements RenderingRequestCaller { mHighresBitmap = request.getBitmap(); notifyObservers(); } - - if (request.getType() == RenderingRequest.ICON_RENDERING) { - // History preview images - ImagePreset preset = request.getOriginalImagePreset(); - preset.setPreviewImage(request.getBitmap()); - mHistory.notifyDataSetChanged(); - } } public static void reset() { |