Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Long strip split fixes 2.0 (#7882)

options was having issues in returning width for some reason

Fixes #7880
Fixes #7881
Cette révision appartient à :
AntsyLich 2022-08-28 19:46:42 +06:00 révisé par GitHub
Parent a83d29f058
révision 0e526c36be
Aucune clé n'a été trouvée pour cette signature dans la base de données
ID de la clé GPG: 4AEE18F83AFDEB23

Voir le fichier

@ -217,16 +217,13 @@ object ImageUtil {
inJustDecodeBounds = false
}
// Values are stored as they get modified during split loop
val imageWidth = options.outWidth
val splitDataList = options.splitData
return try {
splitDataList.forEach { splitData ->
val splitPath = splitImagePath(imageFilePath, splitData.index)
val region = Rect(0, splitData.topOffset, imageWidth, splitData.bottomOffset)
val region = Rect(0, splitData.topOffset, splitData.outputImageWidth, splitData.bottomOffset)
FileOutputStream(splitPath).use { outputStream ->
val splitBitmap = bitmapRegionDecoder.decodeRegion(region, options)
@ -282,7 +279,7 @@ object ImageUtil {
val options = extractImageOptions(imageStream).apply { inJustDecodeBounds = false }
val region = Rect(0, splitData.topOffset, options.outWidth, splitData.bottomOffset)
val region = Rect(0, splitData.topOffset, splitData.outputImageWidth, splitData.bottomOffset)
try {
val splitBitmap = bitmapRegionDecoder.decodeRegion(region, options)
@ -303,6 +300,7 @@ object ImageUtil {
private val BitmapFactory.Options.splitData
get(): List<SplitData> {
val imageHeight = outHeight
val imageWidth = outWidth
val splitHeight = (getDisplayMaxHeightInPx * 1.5).toInt()
// -1 so it doesn't try to split when imageHeight = splitHeight
@ -328,7 +326,7 @@ object ImageUtil {
if (remainingHeight <= (optimalSplitHeight / 10)) {
outputImageHeight += remainingHeight
}
add(SplitData(index, topOffset, outputImageHeight))
add(SplitData(index, topOffset, outputImageHeight, imageWidth))
}
}
}
@ -337,6 +335,7 @@ object ImageUtil {
val index: Int,
val topOffset: Int,
val outputImageHeight: Int,
val outputImageWidth: Int,
) {
val bottomOffset = topOffset + outputImageHeight
}