mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
fix rounded corners memory thrash
// FREEBIE
This commit is contained in:
parent
102a151127
commit
a2d63d117b
@ -10,6 +10,7 @@ import android.graphics.RectF;
|
||||
import android.graphics.Shader.TileMode;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
|
||||
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
|
||||
@ -32,7 +33,11 @@ public class RoundedCorners extends BitmapTransformation {
|
||||
{
|
||||
final Bitmap toRound = crop ? centerCrop(pool, toTransform, outWidth, outHeight)
|
||||
: fitCenter(pool, toTransform, outWidth, outHeight);
|
||||
return round(pool, toRound);
|
||||
final Bitmap rounded = round(pool, toRound);
|
||||
if (toRound != null && toRound != rounded && !pool.put(toRound)) {
|
||||
toRound.recycle();
|
||||
}
|
||||
return rounded;
|
||||
}
|
||||
|
||||
private Bitmap centerCrop(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
|
||||
|
Loading…
Reference in New Issue
Block a user