Fix tall image split math issues

- Round up per-split height to ensure the entire page ends up being split
- Handle the last split of a page potentially being shorter than the others
This commit is contained in:
arkon
2022-05-06 23:10:56 -04:00
parent a9e629aea6
commit 39c0b74250
4 changed files with 16 additions and 8 deletions

View File

@@ -18,6 +18,7 @@ import androidx.core.graphics.green
import androidx.core.graphics.red
import tachiyomi.decoder.Format
import tachiyomi.decoder.ImageDecoder
import java.io.BufferedInputStream
import java.io.ByteArrayInputStream
import java.io.ByteArrayOutputStream
import java.io.InputStream
@@ -103,7 +104,7 @@ object ImageUtil {
*
* @return true if the width is greater than the height
*/
fun isWideImage(imageStream: InputStream): Boolean {
fun isWideImage(imageStream: BufferedInputStream): Boolean {
val options = extractImageOptions(imageStream)
imageStream.reset()
return options.outWidth > options.outHeight