Skip to content

CoverImage: fix inconsistent vertical alignment of cover image#14987

Merged
Frenzie merged 1 commit into
koreader:masterfrom
msk:fix/coverimage-centering
Feb 16, 2026
Merged

CoverImage: fix inconsistent vertical alignment of cover image#14987
Frenzie merged 1 commit into
koreader:masterfrom
msk:fix/coverimage-centering

Conversation

@msk

@msk msk commented Feb 16, 2026

Copy link
Copy Markdown
Contributor

Fixes #14986.

Center the scaled cover image on both axes unconditionally instead of branching on which dimension is the limiting factor. When a dimension has no margin, math.floor(0 / 2) evaluates to 0, so the centering is a no-op on that axis.


This change is Reviewable

Center the scaled cover image on both axes unconditionally instead
of branching on which dimension is the limiting factor. The branch
was susceptible to floating point rounding in math.floor causing
scaled_w to be 1 pixel less than s_w, flipping the alignment from
vertically centered to top-aligned depending on the cover's pixel
dimensions.
@Frenzie Frenzie added this to the 2026.02 milestone Feb 16, 2026
@Frenzie Frenzie changed the title Fix inconsistent vertical alignment of cover image CoverImage: fix inconsistent vertical alignment of cover image Feb 16, 2026
@Frenzie Frenzie merged commit 2932a4a into koreader:master Feb 16, 2026
4 checks passed
@msk msk deleted the fix/coverimage-centering branch March 3, 2026 18:38
0xstillb pushed a commit to 0xstillb/koreader-thai that referenced this pull request May 9, 2026
…der#14987)

Center the scaled cover image on both axes unconditionally instead
of branching on which dimension is the limiting factor. The branch
was susceptible to floating point rounding in math.floor causing
scaled_w to be 1 pixel less than s_w, flipping the alignment from
vertically centered to top-aligned depending on the cover's pixel
dimensions.

Fixes koreader#14986.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cover image screensaver sometimes top-aligned instead of vertically centered

2 participants