Free native source in advance if image is not Animated

This commit is contained in:
tarsin committed 2022-12-23 18:58:03 +08:00
1 parent 9f3ad8142a
commit 70be405032
1 file changed
+4 -1
+4 -1
View File
@@ -53,6 +53,8 @@ class Image private constructor(source: Source?, val release: () -> Unit = {}) {
)
} // Should we lazy decode it?
}
if (mObtainedDrawable is BitmapDrawable)
release()
}
val width = mObtainedDrawable!!.intrinsicWidth
@@ -68,8 +70,9 @@ class Image private constructor(source: Source?, val release: () -> Unit = {}) {
(mObtainedDrawable as BitmapDrawable?)?.bitmap?.recycle()
}
mObtainedDrawable?.callback = null
if (mObtainedDrawable is AnimatedImageDrawable)
release()
mObtainedDrawable = null
release()
}
fun start() {