From cd5e7633dcb2c70df2397c5161890b4a8100d167 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 14 Apr 2022 12:28:25 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ui/book/read/page/provider/ChapterProvider.kt | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt index d8c821e6d..4b7fb2168 100644 --- a/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt +++ b/app/src/main/java/io/legado/app/ui/book/read/page/provider/ChapterProvider.kt @@ -208,22 +208,23 @@ object ChapterProvider { imageStyle: String?, ): Float { var durY = y - ImageProvider.getImageSize(book, src, ReadBook.bookSource).let { + val size = ImageProvider.getImageSize(book, src, ReadBook.bookSource) + if (size.width > 0 && size.height > 0) { if (durY > visibleHeight) { textPages.last().height = durY textPages.add(TextPage()) durY = 0f } - var height = it.height - var width = it.width + var height = size.height + var width = size.width when (imageStyle?.toUpperCase(Locale.ROOT)) { Book.imgStyleFull -> { width = visibleWidth - height = it.height * visibleWidth / it.width + height = size.height * visibleWidth / size.width } else -> { - if (it.width > visibleWidth) { - height = it.height * visibleWidth / it.width + if (size.width > visibleWidth) { + height = size.height * visibleWidth / size.width width = visibleWidth } if (height > visibleHeight) {