pull/1915/head 3.22.052621
kunfei 3 years ago
parent 9c27375a1f
commit 681bf6d106
  1. 4
      app/src/main/java/io/legado/app/utils/BitmapUtils.kt

@ -52,8 +52,8 @@ object BitmapUtils {
height: Int? = null height: Int? = null
): Int { ): Int {
//获取比例大小 //获取比例大小
val wRatio = width?.let { ceil((options.outWidth / it.toFloat())).toInt() } ?: -1 val wRatio = width?.let { options.outWidth / it } ?: -1
val hRatio = height?.let { ceil((options.outHeight / it.toFloat())).toInt() } ?: -1 val hRatio = height?.let { options.outHeight / it } ?: -1
//如果超出指定大小,则缩小相应的比例 //如果超出指定大小,则缩小相应的比例
return when { return when {
wRatio > 1 && hRatio > 1 -> max(wRatio, hRatio) wRatio > 1 && hRatio > 1 -> max(wRatio, hRatio)

Loading…
Cancel
Save