Xteink-X4-crosspoint-reader/src/activities
Maeve Andrews 51c5c3c0aa
fix: rotate origin in drawImage (#557)
## 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, `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 #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"
/>


https://github.com/crosspoint-reader/crosspoint-reader/compare/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 <maeve@git.mail.maeveandrews.com>
2026-01-27 22:59:41 +11:00
..
boot_sleep fix: rotate origin in drawImage (#557) 2026-01-27 22:59:41 +11:00
browser Refactors Calibre Wireless Device & Calibre Library (#404) 2026-01-27 22:02:38 +11:00
home feat: Extract author from XTC/XTCH files (#563) 2026-01-27 22:56:51 +11:00
network Refactors Calibre Wireless Device & Calibre Library (#404) 2026-01-27 22:02:38 +11:00
reader fix: add txt books to recent tab (#526) 2026-01-27 22:53:31 +11:00
settings Refactors Calibre Wireless Device & Calibre Library (#404) 2026-01-27 22:02:38 +11:00
util feat: Change keyboard "caps" to "shift" & Wrap Keyboard (#377) 2026-01-19 22:50:34 +11:00
Activity.h Prevent device sleep during WiFi file transfer and OTA updates (#203) 2026-01-02 17:44:17 +11:00
ActivityWithSubactivity.cpp Give activities names and log when entering and exiting them (#92) 2025-12-21 21:17:00 +11:00
ActivityWithSubactivity.h Support swapping the functionality of the front buttons (#133) 2025-12-29 14:59:14 +11:00