27 lines
1.8 KiB
Markdown
27 lines
1.8 KiB
Markdown
|
|
# Implement BmpViewer Activity (upstream PR #887)
|
||
|
|
|
||
|
|
## Task
|
||
|
|
Port the BmpViewer feature from upstream crosspoint-reader PR #887 to the mod/master fork, enabling .bmp file viewing from the file browser.
|
||
|
|
|
||
|
|
## Changes Made
|
||
|
|
|
||
|
|
### New Files
|
||
|
|
- **src/activities/util/BmpViewerActivity.h** -- Activity subclass declaration with file path, onGoBack callback, and loadFailed state
|
||
|
|
- **src/activities/util/BmpViewerActivity.cpp** -- BMP loading/rendering implementation: shows loading indicator, opens file via Storage HAL, parses BMP headers, computes centered position with aspect-ratio-preserving layout, renders via `renderer.drawBitmap()`, draws localized back button hint, handles back button input in loop
|
||
|
|
|
||
|
|
### Modified Files
|
||
|
|
- **src/activities/reader/ReaderActivity.h** -- Added `isBmpFile()` and `onGoToBmpViewer()` private declarations
|
||
|
|
- **src/activities/reader/ReaderActivity.cpp** -- Added BmpViewerActivity include, `isBmpFile()` implementation, `onGoToBmpViewer()` implementation (sets currentBookPath, exits, enters BmpViewerActivity with goToLibrary callback), BMP routing in `onEnter()` before XTC/TXT checks
|
||
|
|
- **src/activities/home/MyLibraryActivity.cpp** -- Added `.bmp` to the file extension filter in `loadFiles()`
|
||
|
|
- **src/components/themes/lyra/LyraTheme.cpp** -- Changed `fillRect` to `fillRoundedRect` in `drawButtonHints()` for both FULL and SMALL button sizes to prevent white rectangles overflowing rounded button borders
|
||
|
|
|
||
|
|
## Build Result
|
||
|
|
- PlatformIO build SUCCESS (default env)
|
||
|
|
- RAM: 32.7% (107,308 / 327,680 bytes)
|
||
|
|
- Flash: 71.1% (4,657,244 / 6,553,600 bytes)
|
||
|
|
|
||
|
|
## Follow-up Items
|
||
|
|
- Test on hardware with various BMP files (different sizes, bit depths)
|
||
|
|
- Consider adding image scaling for oversized BMPs (currently `drawBitmap` handles scaling)
|
||
|
|
- Future enhancements mentioned in upstream PR: next/prev image navigation, "display and sleep" button
|