diff --git a/source/FFImageLoading.Transformations.Droid/BlurredTransformation.cs b/source/FFImageLoading.Transformations.Droid/BlurredTransformation.cs index 837a34a49..d90476369 100644 --- a/source/FFImageLoading.Transformations.Droid/BlurredTransformation.cs +++ b/source/FFImageLoading.Transformations.Droid/BlurredTransformation.cs @@ -64,22 +64,13 @@ public static Bitmap ToBlurred(Bitmap source, Context context, float radius) script.ForEach(outAlloc); outAlloc.CopyTo(output); + // NOTE: Xamarin.Android Dispose() doesn't call 'destroy' on the allocations or scripts. Therefore, we must manually call it. + outAlloc.Destroy(); + inAlloc.Destroy(); + script.Destroy(); rs.Destroy(); return output; } - - //Bitmap output = Bitmap.createBitmap(smallBitmap.getWidth(), smallBitmap.getHeight(), smallBitmap.getConfig()); - - //RenderScript rs = RenderScript.create(getContext()); - //ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs)); - //Allocation inAlloc = Allocation.createFromBitmap(rs, smallBitmap, Allocation.MipmapControl.MIPMAP_NONE, Allocation.USAGE_GRAPHICS_TEXTURE); - //Allocation outAlloc = Allocation.createFromBitmap(rs, output); - //script.setRadius(BLUR_RADIUS); - //script.setInput(inAlloc); - //script.forEach(outAlloc); - //outAlloc.copyTo(output); - - //rs.destroy(); } return ToLegacyBlurred(source, context, (int)radius);