Recycle Bitmap in transformation

This commit is contained in:
Stypox 2021-03-27 14:44:45 +01:00
parent fcef783bbb
commit 314964c5f9
No known key found for this signature in database
GPG Key ID: 4BDF1B40A49FDD23
1 changed files with 7 additions and 1 deletions

View File

@ -1235,12 +1235,18 @@ public final class Player implements
context.getResources()
.getDimension(R.dimen.player_notification_thumbnail_width),
source.getWidth());
return Bitmap.createScaledBitmap(
final Bitmap result = Bitmap.createScaledBitmap(
source,
(int) notificationThumbnailWidth,
(int) (source.getHeight()
/ (source.getWidth() / notificationThumbnailWidth)),
true);
if (result != source) {
source.recycle();
}
return result;
}
@Override