OSDN Git Service

Switch Gallery over to RS compatibility library.
authorTim Murray <timmurray@google.com>
Mon, 4 Feb 2013 21:09:27 +0000 (13:09 -0800)
committerTim Murray <timmurray@google.com>
Mon, 4 Feb 2013 21:09:27 +0000 (13:09 -0800)
Change-Id: If27809236534f3b196949bf455faed45c99f3da5

Android.mk
proguard.flags
src/com/android/gallery3d/filtershow/cache/FilteringPipeline.java
src/com/android/gallery3d/filtershow/filters/ImageFilterRS.java

index 8b13183..7789619 100644 (file)
@@ -8,6 +8,11 @@ LOCAL_STATIC_JAVA_LIBRARIES := android-support-v13
 LOCAL_STATIC_JAVA_LIBRARIES += com.android.gallery3d.common2
 LOCAL_STATIC_JAVA_LIBRARIES += xmp_toolkit
 LOCAL_STATIC_JAVA_LIBRARIES += mp4parser
+LOCAL_STATIC_JAVA_LIBRARIES += android.support.v8.renderscript
+
+LOCAL_RENDERSCRIPT_TARGET_API := 18
+LOCAL_RENDERSCRIPT_COMPATIBILITY := 18
+LOCAL_RENDERSCRIPT_FLAGS := -rs-package-name=android.support.v8.renderscript
 
 LOCAL_SRC_FILES := $(call all-java-files-under, src) $(call all-renderscript-files-under, src)
 LOCAL_SRC_FILES += $(call all-java-files-under, src_pd)
@@ -27,9 +32,9 @@ LOCAL_SDK_VERSION := current
 # the libraries in the APK, otherwise just put them in /system/lib and
 # leave them out of the APK
 ifneq (,$(TARGET_BUILD_APPS))
-  LOCAL_JNI_SHARED_LIBRARIES := libjni_mosaic libjni_eglfence libjni_filtershow_filters
+  LOCAL_JNI_SHARED_LIBRARIES := libjni_mosaic libjni_eglfence libjni_filtershow_filters librsjni
 else
-  LOCAL_REQUIRED_MODULES := libjni_mosaic libjni_eglfence libjni_filtershow_filters
+  LOCAL_REQUIRED_MODULES := libjni_mosaic libjni_eglfence libjni_filtershow_filters librsjni
 endif
 
 LOCAL_PROGUARD_FLAG_FILES := proguard.flags
index b54b0c7..dce9d07 100644 (file)
@@ -45,6 +45,8 @@
 # Disable the warnings of using dynamic method calls in EffectsRecorder
 -dontnote com.android.camera.EffectsRecorder
 
+-keep class android.support.v8.renderscript.** { *; }
+
 # Required for ActionBarSherlock
 -keep class android.support.v4.app.** { *; }
 -keep interface android.support.v4.app.** { *; }
index 2dbd1f3..d415250 100644 (file)
@@ -19,9 +19,7 @@ package com.android.gallery3d.filtershow.cache;
 import android.graphics.Bitmap;
 import android.os.*;
 import android.os.Process;
-import android.renderscript.Allocation;
-import android.renderscript.Allocation.MipmapControl;
-import android.renderscript.RenderScript;
+import android.support.v8.renderscript.*;
 import android.util.Log;
 
 import com.android.gallery3d.filtershow.filters.ImageFilterRS;
@@ -164,13 +162,13 @@ public class FilteringPipeline implements Handler.Callback {
             mFiltersOnlyOriginalAllocation.destroy();
         }
         mFiltersOnlyOriginalAllocation = Allocation.createFromBitmap(RS, mOriginalBitmap,
-                MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
+                Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
         if (mOriginalAllocation != null) {
             mOriginalAllocation.destroy();
         }
         mResizedOriginalBitmap = preset.applyGeometry(mOriginalBitmap);
         mOriginalAllocation = Allocation.createFromBitmap(RS, mResizedOriginalBitmap,
-                MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
+                Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
         mPreviousGeometry = new GeometryMetadata(geometry);
         return true;
     }
index 63dc82c..368e29a 100644 (file)
@@ -18,9 +18,7 @@ package com.android.gallery3d.filtershow.filters;
 
 import android.app.Activity;
 import android.graphics.Bitmap;
-import android.renderscript.Allocation;
-import android.renderscript.Allocation.MipmapControl;
-import android.renderscript.RenderScript;
+import android.support.v8.renderscript.*;
 import android.util.Log;
 
 public class ImageFilterRS extends ImageFilter {
@@ -48,7 +46,7 @@ public class ImageFilterRS extends ImageFilter {
             }
             Bitmap bitmapBuffer = bitmap.copy(mBitmapConfig, true);
             mOutPixelsAllocation = Allocation.createFromBitmap(mRS, bitmapBuffer,
-                    MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
+                    Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_SCRIPT);
             mInPixelsAllocation = Allocation.createTyped(mRS,
                     mOutPixelsAllocation.getType());
             sOldBitmap = bitmap;