diff options
author | nicolasroard <nicolasroard@google.com> | 2013-07-02 13:21:31 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-07-02 13:22:38 -0700 |
commit | dbc7b1ebe939d68cbc7f01878e038ca3e9c35f89 (patch) | |
tree | f832719bc9d7f369757de8828ae3e105e6f5c787 /src/com/android/gallery3d | |
parent | e6af6d79fdaebcf566f9281ed6a29778d284dc42 (diff) | |
download | android_packages_apps_Snap-dbc7b1ebe939d68cbc7f01878e038ca3e9c35f89.tar.gz android_packages_apps_Snap-dbc7b1ebe939d68cbc7f01878e038ca3e9c35f89.tar.bz2 android_packages_apps_Snap-dbc7b1ebe939d68cbc7f01878e038ca3e9c35f89.zip |
Add stop check in ImageFilterFX
speed up switching / interrupting of rendering.
Change-Id: I3ef4b1d16047b00a062c86d72cdfff2bfe9817a2
Diffstat (limited to 'src/com/android/gallery3d')
-rw-r--r-- | src/com/android/gallery3d/filtershow/filters/IconUtilities.java | 5 | ||||
-rw-r--r-- | src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java | 19 |
2 files changed, 20 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/filtershow/filters/IconUtilities.java b/src/com/android/gallery3d/filtershow/filters/IconUtilities.java index 38211f3c9..e2a01472d 100644 --- a/src/com/android/gallery3d/filtershow/filters/IconUtilities.java +++ b/src/com/android/gallery3d/filtershow/filters/IconUtilities.java @@ -64,8 +64,9 @@ public class IconUtilities { int h = bitmap.getHeight(); int fxw = fxBitmap.getWidth(); int fxh = fxBitmap.getHeight(); - - nativeApplyFilter(bitmap, w, h, fxBitmap, fxw, fxh); + int start = 0; + int end = w * h * 4; + nativeApplyFilter(bitmap, w, h, fxBitmap, fxw, fxh, start, end); return bitmap; } }; diff --git a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java index 51c66127b..19bea593b 100644 --- a/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java +++ b/src/com/android/gallery3d/filtershow/filters/ImageFilterFx.java @@ -51,7 +51,9 @@ public class ImageFilterFx extends ImageFilter { return mParameters; } - native protected void nativeApplyFilter(Bitmap bitmap, int w, int h,Bitmap fxBitmap, int fxw, int fxh); + native protected void nativeApplyFilter(Bitmap bitmap, int w, int h, + Bitmap fxBitmap, int fxw, int fxh, + int start, int end); @Override public Bitmap apply(Bitmap bitmap, float scaleFactor, int quality) { @@ -85,7 +87,20 @@ public class ImageFilterFx extends ImageFilter { int fxw = mFxBitmap.getWidth(); int fxh = mFxBitmap.getHeight(); - nativeApplyFilter(bitmap, w, h, mFxBitmap, fxw, fxh); + int stride = w * 4; + int max = stride * h; + int increment = stride * 256; // 256 lines + for (int i = 0; i < max; i += increment) { + int start = i; + int end = i + increment; + if (end > max) { + end = max; + } + if (!getEnvironment().needsStop()) { + nativeApplyFilter(bitmap, w, h, mFxBitmap, fxw, fxh, start, end); + } + } + return bitmap; } |