Skip to content

Commit

Permalink
fix blur RSInvalidStateException: bitmap_F16 for Samsung n9600
Browse files Browse the repository at this point in the history
  • Loading branch information
mochangsheng committed Feb 11, 2019
1 parent aac2384 commit f9433c0
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.os.Build;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RSInvalidStateException;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import android.support.annotation.FloatRange;
Expand Down Expand Up @@ -130,6 +131,10 @@ public static Bitmap renderScriptBlur(final Bitmap src,
blurScript.setRadius(radius);
blurScript.forEach(output);
output.copyTo(ret);
} catch (RSInvalidStateException e){
//捕捉异常,避免Bad bitmap type: RGBA_F16 在三星 SM N9600 android9.0出现过
e.printStackTrace();
ret = stackBlur(src, (int) radius, recycle);
} finally {
if (rs != null) {
rs.destroy();
Expand Down

0 comments on commit f9433c0

Please sign in to comment.