Fixes to center margin option
(cherry picked from commit d8c2baa135b8cdcac0c00e9b03beeecc132167d6)
This commit is contained in:
parent
212c1d3287
commit
f890a68f35
@ -358,7 +358,9 @@ class PagerPageHolder(
|
||||
private fun mergePages(imageStream: InputStream, imageStream2: InputStream?): InputStream {
|
||||
// Handle adding a center margin to wide images if requested
|
||||
if (imageStream2 == null) {
|
||||
return if (imageStream is BufferedInputStream && ImageUtil.isWideImage(imageStream) &&
|
||||
return if (imageStream is BufferedInputStream &&
|
||||
!ImageUtil.isAnimatedAndSupported(imageStream) &&
|
||||
ImageUtil.isWideImage(imageStream) &&
|
||||
viewer.config.centerMarginType and PagerConfig.CenterMarginType.WIDE_PAGE_CENTER_MARGIN > 0 &&
|
||||
!viewer.config.imageCropBorders
|
||||
) {
|
||||
@ -440,7 +442,7 @@ class PagerPageHolder(
|
||||
imageStream2.close()
|
||||
|
||||
val centerMargin = if (viewer.config.centerMarginType and PagerConfig.CenterMarginType.DOUBLE_PAGE_CENTER_MARGIN > 0 && !viewer.config.imageCropBorders) {
|
||||
96 / (getHeight().coerceAtLeast(1) / max(height, height2).coerceAtLeast(1)).coerceAtLeast(1)
|
||||
96 / (this.height.coerceAtLeast(1) / max(height, height2).coerceAtLeast(1)).coerceAtLeast(1)
|
||||
} else {
|
||||
0
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ object ImageUtil {
|
||||
val height = imageBitmap.height
|
||||
val width = imageBitmap.width
|
||||
|
||||
val centerPadding = 96 / (max(1, viewHeight) / height)
|
||||
val centerPadding = 96 / (max(1, viewHeight) / height).coerceAtLeast(1)
|
||||
|
||||
val leftSourcePart = Rect(0, 0, width / 2, height)
|
||||
val rightSourcePart = Rect(width / 2, 0, width, height)
|
||||
|
Loading…
x
Reference in New Issue
Block a user