Skip to content

Commit

Permalink
优化解码大图时的压缩倍率判断逻辑
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaojieonly committed Nov 21, 2024
1 parent aad975c commit d451fc6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/src/main/java/com/hippo/lib/image/Image.kt
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ class Image private constructor(
init {
mObtainedDrawable = null
source?.let {
var simpleSize = 1
var simpleSize: Int? = null
if (source.available() > 10485760) {
simpleSize = source.available() / 10485760 + 1
}
Expand All @@ -77,7 +77,7 @@ class Image private constructor(
info.size.height / (2 * screenHeight)
).coerceAtLeast(1)
decoder.setTargetSampleSize(
max(screenSize, simpleSize)
max(screenSize, simpleSize ?: 1)
)
// Don't
}
Expand Down Expand Up @@ -227,6 +227,7 @@ class Image private constructor(
return 0
}

@get:SuppressWarnings("deprecation")
val isOpaque: Boolean
get() {
return mObtainedDrawable?.opacity == PixelFormat.OPAQUE
Expand Down

0 comments on commit d451fc6

Please sign in to comment.