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 3f362843..e2f5d12f 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 @@ -4,6 +4,7 @@ import android.content.Context import android.graphics.Bitmap import android.graphics.Point import android.graphics.Rect +import android.os.Build import android.util.Log import com.davemorrissey.labs.subscaleview.provider.InputProvider import tachiyomi.decoder.ImageDecoder @@ -52,7 +53,10 @@ class Decoder( * @return The decoded region. It is safe to return null if decoding fails. */ override fun decodeRegion(sRect: Rect, sampleSize: Int): Bitmap { - val bitmap = decoder?.decode(sRect, sampleSize) + var bitmap = decoder?.decode(sRect, sampleSize) + if (Build.VERSION.SDK_INT >= 26) { + bitmap = bitmap?.copy(Bitmap.Config.HARDWARE, false) + } return bitmap ?: error("Null region bitmap") } diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index e6c6619c..ec699c86 100755 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -9,7 +9,7 @@ android { defaultConfig { applicationId = "com.davemorrissey.labs.subscaleview.test" - minSdk = 24 + minSdk = 21 targetSdk = 34 versionCode = 4