Skip to content

Commit f9433c0

Browse files
author
mochangsheng
committed
fix blur RSInvalidStateException: bitmap_F16 for Samsung n9600
1 parent aac2384 commit f9433c0

File tree

1 file changed

+5
-0
lines changed
  • modules_base/base/src/main/java/com/m4coding/coolhub/base/utils

1 file changed

+5
-0
lines changed

modules_base/base/src/main/java/com/m4coding/coolhub/base/utils/ImageUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import android.os.Build;
1111
import android.renderscript.Allocation;
1212
import android.renderscript.Element;
13+
import android.renderscript.RSInvalidStateException;
1314
import android.renderscript.RenderScript;
1415
import android.renderscript.ScriptIntrinsicBlur;
1516
import android.support.annotation.FloatRange;
@@ -130,6 +131,10 @@ public static Bitmap renderScriptBlur(final Bitmap src,
130131
blurScript.setRadius(radius);
131132
blurScript.forEach(output);
132133
output.copyTo(ret);
134+
} catch (RSInvalidStateException e){
135+
//捕捉异常,避免Bad bitmap type: RGBA_F16 在三星 SM N9600 android9.0出现过
136+
e.printStackTrace();
137+
ret = stackBlur(src, (int) radius, recycle);
133138
} finally {
134139
if (rs != null) {
135140
rs.destroy();

0 commit comments

Comments
 (0)