kikoso / android-stackblur

Android StackBlur is a library that can perform a blurry effect on a Bitmap based on a gradient or radius, and return the result. The library is based on the code of Mario Klingemann.
Apache License 2.0
3.59k stars 648 forks source link

Add benchmark to StackBlurDemo #7

Closed Dr-Emann closed 10 years ago

Dr-Emann commented 10 years ago

Note: Native is currently disabled due to (uncatchable) errors when trying to use a large radius blur. Pretty sure this is an error in the native version.

kikoso commented 10 years ago

Hello @Dr-Emann

Can you provide more information about the errors while using large radius blur?

Dr-Emann commented 10 years ago

There's no errors thrown. Surrounding with try/catch can't catch anything. There's nothing in the logcat. The app just dies.Using the debugger, I can step through up to the point at which the native function is called.

As a minimal example, adding the following to the onCreate method of MainActivity:

try {
    _stackBlurManager.processNatively(86);
} catch (Throwable e) {
    e.printStackTrace();
}

causes the app to close. For some reason, in different circumstances, different radii are/are not acceptable. (Something to do with the image size?)

kikoso commented 10 years ago

Mmmm, that is strange. Can you provide a testcase (i.e., radius, image and emulator/phone), so I can reproduce it?

Dr-Emann commented 10 years ago

It seems like "android_platform_256.png" in the assets, blurred at 86 seems to exit on every emulator I've tried, and my own HTC one.

kikoso commented 10 years ago

Hello @Dr-Emann ,

I am accepting this PullRequest. Thanks for your contribution!

kikoso commented 10 years ago

Hello @Dr_Emann,

The problem with the native blurry error does happen in different circumstances, and it is apparently related to the issue 8 (https://github.com/kikoso/android-stackblur/issues/8).

Funnily, if the blurry radius moves fast to a high one, and then just play with some more smaller radius, it also causes the app to close. This might be something related to the memory management in the native code.