mirror of
https://github.com/wasabeef/glide-transformations.git
synced 2025-06-28 12:23:09 +08:00
refactor support rs (#142)
This commit is contained in:
parent
3aa8e53c6a
commit
2e2846d354
@ -6,6 +6,9 @@ android {
|
||||
defaultConfig {
|
||||
minSdkVersion MIN_SDK_VERSION as int
|
||||
targetSdkVersion TARGET_SDK_VERSION as int
|
||||
|
||||
renderscriptTargetApi TARGET_SDK_VERSION as int
|
||||
renderscriptSupportModeEnabled true
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -21,7 +21,6 @@ import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Build;
|
||||
import android.renderscript.RSRuntimeException;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
|
||||
@ -29,6 +28,7 @@ import java.security.MessageDigest;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import jp.wasabeef.glide.transformations.internal.FastBlur;
|
||||
import jp.wasabeef.glide.transformations.internal.RSBlur;
|
||||
import jp.wasabeef.glide.transformations.internal.SupportRSBlur;
|
||||
|
||||
public class SupportRSBlurTransformation extends BitmapTransformation {
|
||||
@ -76,7 +76,9 @@ public class SupportRSBlurTransformation extends BitmapTransformation {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
|
||||
try {
|
||||
bitmap = SupportRSBlur.blur(context, bitmap, radius);
|
||||
} catch (RSRuntimeException e) {
|
||||
} catch (NoClassDefFoundError e) {
|
||||
bitmap = RSBlur.blur(context, bitmap, radius);
|
||||
} catch (RuntimeException e) {
|
||||
bitmap = FastBlur.blur(bitmap, radius, true);
|
||||
}
|
||||
} else {
|
||||
|
@ -26,7 +26,6 @@ import android.renderscript.ScriptIntrinsicBlur;
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
@Deprecated
|
||||
public class RSBlur {
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2)
|
||||
|
@ -4,11 +4,12 @@ import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.os.Build;
|
||||
import android.renderscript.Allocation;
|
||||
import android.renderscript.Element;
|
||||
import android.renderscript.RSRuntimeException;
|
||||
import android.renderscript.RenderScript;
|
||||
import android.renderscript.ScriptIntrinsicBlur;
|
||||
|
||||
import androidx.renderscript.Allocation;
|
||||
import androidx.renderscript.Element;
|
||||
import androidx.renderscript.RSRuntimeException;
|
||||
import androidx.renderscript.RenderScript;
|
||||
import androidx.renderscript.ScriptIntrinsicBlur;
|
||||
|
||||
/**
|
||||
* Copyright (C) 2018 Wasabeef
|
||||
|
Loading…
x
Reference in New Issue
Block a user