Skip to content

Commit

Permalink
优化
Browse files Browse the repository at this point in the history
  • Loading branch information
gedoor committed May 26, 2022
1 parent 9c27375 commit 681bf6d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/src/main/java/io/legado/app/utils/BitmapUtils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ object BitmapUtils {
height: Int? = null
): Int {
//获取比例大小
val wRatio = width?.let { ceil((options.outWidth / it.toFloat())).toInt() } ?: -1
val hRatio = height?.let { ceil((options.outHeight / it.toFloat())).toInt() } ?: -1
val wRatio = width?.let { options.outWidth / it } ?: -1
val hRatio = height?.let { options.outHeight / it } ?: -1
//如果超出指定大小,则缩小相应的比例
return when {
wRatio > 1 && hRatio > 1 -> max(wRatio, hRatio)
Expand Down

0 comments on commit 681bf6d

Please sign in to comment.