summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/imageshow
diff options
context:
space:
mode:
authorRuben Brunk <rubenbrunk@google.com>2013-07-12 17:23:39 -0700
committerRuben Brunk <rubenbrunk@google.com>2013-07-15 10:02:43 -0700
commit0dca1b590f4cae2fe42afc9245f1a8ea81f9e6d3 (patch)
treef67b95279ee27db61031bd06e391cbc386015c5c /src/com/android/gallery3d/filtershow/imageshow
parent2212065e2de9ec6a2a105218a693a48145e9bfb6 (diff)
downloadandroid_packages_apps_Snap-0dca1b590f4cae2fe42afc9245f1a8ea81f9e6d3.tar.gz
android_packages_apps_Snap-0dca1b590f4cae2fe42afc9245f1a8ea81f9e6d3.tar.bz2
android_packages_apps_Snap-0dca1b590f4cae2fe42afc9245f1a8ea81f9e6d3.zip
Combine ImageLoader and CropLoader utility classes.
Bug: 9356969 Bug: 9170644 - Refactor to eliminate code duplication in image loading classes. - Fix bugs caused by the inability to determine MIME types for images that aren't in Gallery's content provider (causes b/9356969). Change-Id: I30c2ba5c0cd37aac624681a2cec9abddaa78f9c2
Diffstat (limited to 'src/com/android/gallery3d/filtershow/imageshow')
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/ImageShow.java3
-rw-r--r--src/com/android/gallery3d/filtershow/imageshow/MasterImage.java28
2 files changed, 17 insertions, 14 deletions
diff --git a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
index 8b9d57cb9..2da358c2c 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/ImageShow.java
@@ -40,6 +40,7 @@ import com.android.gallery3d.filtershow.FilterShowActivity;
import com.android.gallery3d.filtershow.cache.ImageLoader;
import com.android.gallery3d.filtershow.filters.ImageFilter;
import com.android.gallery3d.filtershow.pipeline.ImagePreset;
+import com.android.gallery3d.filtershow.tools.SaveCopyTask;
import java.io.File;
@@ -394,7 +395,7 @@ public class ImageShow extends View implements OnGestureListener,
}
public void saveImage(FilterShowActivity filterShowActivity, File file) {
- ImageLoader.saveImage(getImagePreset(), filterShowActivity, file);
+ SaveCopyTask.saveImage(getImagePreset(), filterShowActivity, file);
}
diff --git a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
index 7b11cf35e..08d8c45eb 100644
--- a/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
+++ b/src/com/android/gallery3d/filtershow/imageshow/MasterImage.java
@@ -26,29 +26,29 @@ import android.os.Handler;
import android.os.Message;
import com.android.gallery3d.filtershow.FilterShowActivity;
-import com.android.gallery3d.filtershow.history.HistoryManager;
-import com.android.gallery3d.filtershow.history.HistoryItem;
-import com.android.gallery3d.filtershow.pipeline.FilteringPipeline;
import com.android.gallery3d.filtershow.cache.ImageLoader;
-import com.android.gallery3d.filtershow.pipeline.RenderingRequest;
-import com.android.gallery3d.filtershow.pipeline.RenderingRequestCaller;
import com.android.gallery3d.filtershow.filters.FilterRepresentation;
import com.android.gallery3d.filtershow.filters.ImageFilter;
+import com.android.gallery3d.filtershow.history.HistoryItem;
+import com.android.gallery3d.filtershow.history.HistoryManager;
import com.android.gallery3d.filtershow.pipeline.Buffer;
+import com.android.gallery3d.filtershow.pipeline.FilteringPipeline;
+import com.android.gallery3d.filtershow.pipeline.ImagePreset;
+import com.android.gallery3d.filtershow.pipeline.RenderingRequest;
+import com.android.gallery3d.filtershow.pipeline.RenderingRequestCaller;
import com.android.gallery3d.filtershow.pipeline.SharedBuffer;
import com.android.gallery3d.filtershow.pipeline.SharedPreset;
-import com.android.gallery3d.filtershow.pipeline.ImagePreset;
import com.android.gallery3d.filtershow.state.StateAdapter;
import java.util.Vector;
public class MasterImage implements RenderingRequestCaller {
-
-
private static final String LOGTAG = "MasterImage";
private boolean DEBUG = false;
private static final boolean DISABLEZOOM = false;
+ public static final int SMALL_BITMAP_DIM = 160;
+ public static final int MAX_BITMAP_DIM = 900;
private static MasterImage sMasterImage = null;
private boolean mSupportsHighRes = false;
@@ -188,13 +188,16 @@ public class MasterImage implements RenderingRequestCaller {
public boolean loadBitmap(Uri uri, int size) {
setUri(uri);
- mOrientation = ImageLoader.getOrientation(mActivity, uri);
- mOriginalBitmapLarge = ImageLoader.loadOrientedScaledBitmap(this, mActivity, uri, size,
- true, mOrientation);
+ mOrientation = ImageLoader.getMetadataOrientation(mActivity, uri);
+ Rect originalBounds = new Rect();
+ mOriginalBitmapLarge = ImageLoader.loadOrientedConstrainedBitmap(uri, mActivity,
+ Math.min(MAX_BITMAP_DIM, size),
+ mOrientation, originalBounds);
+ setOriginalBounds(originalBounds);
if (mOriginalBitmapLarge == null) {
return false;
}
- int sw = ImageLoader.SMALL_BITMAP_DIM;
+ int sw = SMALL_BITMAP_DIM;
int sh = (int) (sw * (float) mOriginalBitmapLarge.getHeight() / (float) mOriginalBitmapLarge
.getWidth());
mOriginalBitmapSmall = Bitmap.createScaledBitmap(mOriginalBitmapLarge, sw, sh, true);
@@ -547,7 +550,6 @@ public class MasterImage implements RenderingRequestCaller {
}
}
-
public float getScaleFactor() {
return mScaleFactor;
}