Don't recycle scaled bitmap if it's the same one

This commit is contained in:
Suphon Thanakornpakapong
2022-05-28 09:14:04 +07:00
parent ba9ba65c0a
commit 20dfa02f3c

View File

@@ -199,7 +199,7 @@ fun Bitmap.scaleDownTo(size: Size, keepOriginal: Boolean = false): Bitmap {
if (size.width > width || size.height > height) return this
val newBitmap = Bitmap.createScaledBitmap(this, size.width, size.height, true)
if (!keepOriginal) {
if (newBitmap != this && !keepOriginal) {
recycle()
}
return newBitmap