fix: rotate origin in drawImage#557
Merged
daveallie merged 1 commit intocrosspoint-reader:masterfrom Jan 27, 2026
Merged
Conversation
0b1ada0 to
92eddc6
Compare
daveallie
approved these changes
Jan 27, 2026
jdk2pq
added a commit
to jdk2pq/crosspoint-reader
that referenced
this pull request
Jan 28, 2026
* master: (33 commits) feat: add HalDisplay and HalGPIO (crosspoint-reader#522) feat: Display epub metadata on Recents (crosspoint-reader#511) chore: Cut release 0.16.0 fix: Correctly render italics on image alt placeholders (crosspoint-reader#569) chore: .gitignore: add compile_commands.json & .cache (crosspoint-reader#568) fix: Render keyboard entry over multiple lines (crosspoint-reader#567) fix: missing front layout in mapLabels() (crosspoint-reader#564) refactor: Re-work for OTA feature (crosspoint-reader#509) perf: optimize large EPUB indexing from O(n^2) to O(n) (crosspoint-reader#458) feat: Add Spanish hyphenation support (crosspoint-reader#558) feat: Add support to B&W filters to image covers (crosspoint-reader#476) feat(ux): page turning on button pressed if long-press chapter skip is disabled (crosspoint-reader#451) feat: Add status bar option "Full w/ Progress Bar" (crosspoint-reader#438) fix: Validate settings on read. (crosspoint-reader#492) fix: rotate origin in drawImage (crosspoint-reader#557) feat: Extract author from XTC/XTCH files (crosspoint-reader#563) fix: add txt books to recent tab (crosspoint-reader#526) docs: add font generation commands to builtin font headers (crosspoint-reader#547) docs: Update README with supported languages for EPUB (crosspoint-reader#530) fix: Fix KOReader document md5 calculation for binary matching progress sync (crosspoint-reader#529) ...
Jessica765
pushed a commit
to Jessica765/crosspoint-reader
that referenced
this pull request
Feb 3, 2026
## Summary This was originally a comment in crosspoint-reader#499, but I'm making it its own PR, because it doesn't depend on anything there and then I can base that PR on this one. Currently, `drawBitmap` is used for covers and sleep wallpaper, and `drawImage` is used for the boot logo. `drawBitmap` goes row by row and pixel by pixel, so it respects the renderer orientation. `drawImage` just calls the `EInkDisplay`'s `drawImage`, which works in the eink panel's native display orientation. `drawImage` rotates the x,y coordinates where it's going to draw the image, but doesn't account for the fact that the northwest corner in portrait orientation becomes, the southwest corner of the image rectangle in the native orientation. The boot and sleep activities currently work around this by calculating the north*east* corner of where the image should go, which becomes the northwest corner after `rotateCoordinates`. I think this wasn't really apparent because the CrossPoint logo is rotationally symmetrical. The `EInkDisplay` `drawImage` always draws the image in native orientation, but that looks the same for the "X" image. If we rotate the origin coordinate in `GfxRenderer`'s `drawImage`, we can use a much clearer northwest corner coordinate in the boot and sleep activities. (And then, in crosspoint-reader#499, we can actually rotate the boot screen to the user's preferred orientation). This does *not* yet rotate the actual bits in the image; it's still displayed in native orientation. This doesn't affect the rotationally-symmetric logo, but if it's ever changed, we will probably want to allocate a new `u8int[]` and transpose rows and columns if necessary. ## Additional Context I've created an additional branch on top of this to demonstrate by replacing the logo with a non-rotationally-symmetrical image: <img width="128" height="128" alt="Cat-in-a-pan-128-bw" src="https://github.com/user-attachments/assets/d0b239bc-fe75-4ec8-bc02-9cf9436ca65f" /> crosspoint-reader/crosspoint-reader@master...maeveynot:rotated-cat (many thanks to https://notisrac.github.io/FileToCArray/) As you can see, it is always drawn in native orientation, which makes it sideways (turned clockwise) in portrait. --- ### AI Usage No Co-authored-by: Maeve Andrews <[email protected]>
Unintendedsideeffects
pushed a commit
to Unintendedsideeffects/crosspoint-reader
that referenced
this pull request
Feb 17, 2026
## Summary This was originally a comment in crosspoint-reader#499, but I'm making it its own PR, because it doesn't depend on anything there and then I can base that PR on this one. Currently, `drawBitmap` is used for covers and sleep wallpaper, and `drawImage` is used for the boot logo. `drawBitmap` goes row by row and pixel by pixel, so it respects the renderer orientation. `drawImage` just calls the `EInkDisplay`'s `drawImage`, which works in the eink panel's native display orientation. `drawImage` rotates the x,y coordinates where it's going to draw the image, but doesn't account for the fact that the northwest corner in portrait orientation becomes, the southwest corner of the image rectangle in the native orientation. The boot and sleep activities currently work around this by calculating the north*east* corner of where the image should go, which becomes the northwest corner after `rotateCoordinates`. I think this wasn't really apparent because the CrossPoint logo is rotationally symmetrical. The `EInkDisplay` `drawImage` always draws the image in native orientation, but that looks the same for the "X" image. If we rotate the origin coordinate in `GfxRenderer`'s `drawImage`, we can use a much clearer northwest corner coordinate in the boot and sleep activities. (And then, in crosspoint-reader#499, we can actually rotate the boot screen to the user's preferred orientation). This does *not* yet rotate the actual bits in the image; it's still displayed in native orientation. This doesn't affect the rotationally-symmetric logo, but if it's ever changed, we will probably want to allocate a new `u8int[]` and transpose rows and columns if necessary. ## Additional Context I've created an additional branch on top of this to demonstrate by replacing the logo with a non-rotationally-symmetrical image: <img width="128" height="128" alt="Cat-in-a-pan-128-bw" src="https://github.com/user-attachments/assets/d0b239bc-fe75-4ec8-bc02-9cf9436ca65f" /> crosspoint-reader/crosspoint-reader@master...maeveynot:rotated-cat (many thanks to https://notisrac.github.io/FileToCArray/) As you can see, it is always drawn in native orientation, which makes it sideways (turned clockwise) in portrait. --- ### AI Usage No Co-authored-by: Maeve Andrews <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This was originally a comment in #499, but I'm making it its own PR, because it doesn't depend on anything there and then I can base that PR on this one.
Currently,
drawBitmapis used for covers and sleep wallpaper, anddrawImageis used for the boot logo.drawBitmapgoes row by row and pixel by pixel, so it respects the renderer orientation.drawImagejust calls theEInkDisplay'sdrawImage, which works in the eink panel's native display orientation.drawImagerotates the x,y coordinates where it's going to draw the image, but doesn't account for the fact that the northwest corner in portrait orientation becomes, the southwest corner of the image rectangle in the native orientation. The boot and sleep activities currently work around this by calculating the northeast corner of where the image should go, which becomes the northwest corner afterrotateCoordinates.I think this wasn't really apparent because the CrossPoint logo is rotationally symmetrical. The
EInkDisplaydrawImagealways draws the image in native orientation, but that looks the same for the "X" image.If we rotate the origin coordinate in
GfxRenderer'sdrawImage, we can use a much clearer northwest corner coordinate in the boot and sleep activities. (And then, in #499, we can actually rotate the boot screen to the user's preferred orientation).This does not yet rotate the actual bits in the image; it's still displayed in native orientation. This doesn't affect the rotationally-symmetric logo, but if it's ever changed, we will probably want to allocate a new
u8int[]and transpose rows and columns if necessary.Additional Context
I've created an additional branch on top of this to demonstrate by replacing the logo with a non-rotationally-symmetrical image:
master...maeveynot:rotated-cat
(many thanks to https://notisrac.github.io/FileToCArray/)
As you can see, it is always drawn in native orientation, which makes it sideways (turned clockwise) in portrait.
AI Usage
No