From: nicolasroard Date: Sat, 13 Apr 2013 00:47:14 +0000 (-0700) Subject: Add direct rendering for border X-Git-Tag: android-x86-6.0-r3~68^2~28^2~213^2~19^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2^2~428^2~2^2~201^2~40 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=4b6ea5bc;p=android-x86%2Fpackages-apps-Camera2.git Add direct rendering for border bug:8603245 Change-Id: Ibc1bde9adb19f930b474e4076a0c2720fbe0bc8d --- diff --git a/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java b/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java index b8dc466d9..8cb8f8f9e 100644 --- a/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java +++ b/src/com/android/gallery3d/filtershow/cache/CachingPipeline.java @@ -308,6 +308,8 @@ public class CachingPipeline { setupEnvironment(preset, false); mFiltersManager.freeFilterResources(preset); preset.applyFilters(-1, -1, in, out, mEnvironment); + // TODO: we should render the border onto a different bitmap instead + preset.applyBorder(in, out, mEnvironment); } } diff --git a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java index 791164f5c..00f5977d1 100644 --- a/src/com/android/gallery3d/filtershow/presets/ImagePreset.java +++ b/src/com/android/gallery3d/filtershow/presets/ImagePreset.java @@ -22,6 +22,7 @@ import android.support.v8.renderscript.Allocation; import android.util.Log; import com.android.gallery3d.filtershow.ImageStateAdapter; +import com.android.gallery3d.filtershow.cache.CachingPipeline; import com.android.gallery3d.filtershow.cache.ImageLoader; import com.android.gallery3d.filtershow.filters.BaseFiltersManager; import com.android.gallery3d.filtershow.filters.FilterRepresentation; @@ -228,6 +229,10 @@ public class ImagePreset { mBorder = filter; } + public void resetBorder() { + mBorder = null; + } + public boolean isFx() { return mIsFxPreset; } @@ -474,6 +479,16 @@ public class ImagePreset { return bitmap; } + public void applyBorder(Allocation in, Allocation out, FilterEnvironment environment) { + if (mBorder != null && mDoApplyGeometry) { + mBorder.synchronizeRepresentation(); + // TODO: should keep the bitmap around + Allocation bitmapIn = Allocation.createTyped(CachingPipeline.getRenderScriptContext(), in.getType()); + bitmapIn.copyFrom(out); + environment.applyRepresentation(mBorder, bitmapIn, out); + } + } + public void applyFilters(int from, int to, Allocation in, Allocation out, FilterEnvironment environment) { if (mDoApplyFilters) { if (from < 0) {