From b8e1b0ed2b2e10916213ab2b7dc6d967ba9ba4fe Mon Sep 17 00:00:00 2001 From: w Date: Sat, 20 Apr 2024 06:41:34 -0700 Subject: [PATCH] HARDWARE bitmap null (#4) --- .../com/davemorrissey/labs/subscaleview/decoder/Decoder.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/Decoder.kt b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/Decoder.kt index e2f5d12f..85e375e4 100755 --- a/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/Decoder.kt +++ b/library/src/main/java/com/davemorrissey/labs/subscaleview/decoder/Decoder.kt @@ -53,9 +53,9 @@ class Decoder( * @return The decoded region. It is safe to return null if decoding fails. */ override fun decodeRegion(sRect: Rect, sampleSize: Int): Bitmap { - var bitmap = decoder?.decode(sRect, sampleSize) + val bitmap = decoder?.decode(sRect, sampleSize) if (Build.VERSION.SDK_INT >= 26) { - bitmap = bitmap?.copy(Bitmap.Config.HARDWARE, false) + bitmap?.copy(Bitmap.Config.HARDWARE, false)?.let { return it; } } return bitmap ?: error("Null region bitmap") }