OSDN Git Service

Fix crash on applying borders
authornicolasroard <nicolasroard@google.com>
Tue, 26 Feb 2013 04:38:25 +0000 (20:38 -0800)
committernicolasroard <nicolasroard@google.com>
Tue, 26 Feb 2013 04:38:38 +0000 (20:38 -0800)
bug:8265497

Change-Id: I7e6b22cb7666fd3876119051552e34e91df894a2

src/com/android/gallery3d/filtershow/cache/FilteringPipeline.java
src/com/android/gallery3d/filtershow/cache/ImageLoader.java
src/com/android/gallery3d/filtershow/presets/ImagePreset.java

index 0af4063..0e735bf 100644 (file)
@@ -250,7 +250,8 @@ public class FilteringPipeline implements Handler.Callback {
         setPresetParameters(preset);
 
         if (request.getType() == RenderingRequest.PARTIAL_RENDERING) {
-            bitmap = MasterImage.getImage().getImageLoader().getScaleOneImageForPreset(null, preset, request.getBounds(), request.getDestination(), false);
+            bitmap = MasterImage.getImage().getImageLoader().getScaleOneImageForPreset(null, preset,
+                    request.getBounds(), request.getDestination(), false);
             if (bitmap == null) {
                 return;
             }
index b502a2f..b5ed9ee 100644 (file)
@@ -315,6 +315,7 @@ public class ImageLoader {
             // decode with inSampleSize
             BitmapFactory.Options o2 = new BitmapFactory.Options();
             o2.inSampleSize = scale;
+            o2.inMutable = true;
 
             Utils.closeSilently(is);
             is = mContext.getContentResolver().openInputStream(uri);
@@ -376,9 +377,9 @@ public class ImageLoader {
         mLoadingLock.lock();
         Bitmap bmp = mZoomCache.getImage(imagePreset, bounds);
         if (force || bmp == null) {
-            BitmapFactory.Options options = null;
+            BitmapFactory.Options options = new BitmapFactory.Options();
+            options.inMutable = true;
             if (destination != null) {
-                options = new BitmapFactory.Options();
                 if (bounds.width() > destination.width()) {
                     int sampleSize = 1;
                     int w = bounds.width();
index ae5a034..752f72d 100644 (file)
@@ -428,6 +428,9 @@ public class ImagePreset {
         if (mGeoData.hasModifications()) {
             return false;
         }
+        if (mBorder != null && !mBorder.supportsPartialRendering()) {
+            return false;
+        }
         for (int i = 0; i < mFilters.size(); i++) {
             FilterRepresentation representation = null;
             synchronized (mFilters) {