42 lines
2.3 KiB
Markdown
42 lines
2.3 KiB
Markdown
|
|
# Cherry-pick Image Support from pablohc/crosspoint-reader@2d8cbcf (PR #556)
|
||
|
|
|
||
|
|
## Task
|
||
|
|
Merge EPUB embedded image support (JPEG/PNG) from pablohc's fork into the mod branch, based on upstream PR #556.
|
||
|
|
|
||
|
|
## Changes Made
|
||
|
|
|
||
|
|
### New Files (11)
|
||
|
|
- `lib/Epub/Epub/blocks/ImageBlock.h` / `.cpp` - Image block type for page layout
|
||
|
|
- `lib/Epub/Epub/converters/DitherUtils.h` - 4x4 Bayer dithering for 4-level grayscale
|
||
|
|
- `lib/Epub/Epub/converters/ImageDecoderFactory.h` / `.cpp` - Format-based decoder selection
|
||
|
|
- `lib/Epub/Epub/converters/ImageToFramebufferDecoder.h` / `.cpp` - Base decoder interface
|
||
|
|
- `lib/Epub/Epub/converters/JpegToFramebufferConverter.h` / `.cpp` - JPEG decoder (picojpeg)
|
||
|
|
- `lib/Epub/Epub/converters/PngToFramebufferConverter.h` / `.cpp` - PNG decoder (PNGdec)
|
||
|
|
- `lib/Epub/Epub/converters/PixelCache.h` - 2-bit pixel cache for fast re-render
|
||
|
|
- `scripts/generate_test_epub.py` - Test EPUB generator
|
||
|
|
|
||
|
|
### Modified Files (13)
|
||
|
|
- `lib/Epub/Epub/blocks/Block.h` - Removed unused `layout()` virtual
|
||
|
|
- `lib/Epub/Epub/blocks/TextBlock.h` - Removed unused `layout()` override
|
||
|
|
- `lib/Epub/Epub/Page.h` / `.cpp` - Added `PageImage` class, `TAG_PageImage=3`, `hasImages()`, `getImageBoundingBox()`
|
||
|
|
- `lib/Epub/Epub/parsers/ChapterHtmlSlimParser.h` / `.cpp` - Image extraction/decoding from EPUB, new constructor params
|
||
|
|
- `lib/Epub/Epub/Section.cpp` - Derive content base/image paths, bumped version 12→13
|
||
|
|
- `lib/GfxRenderer/GfxRenderer.h` / `.cpp` - Added `getRenderMode()`, implemented `displayWindow()`
|
||
|
|
- `lib/hal/HalDisplay.h` / `.cpp` - Added `displayWindow()` for partial refresh
|
||
|
|
- `src/activities/reader/EpubReaderActivity.cpp` - Image-aware refresh with double FAST_REFRESH optimization
|
||
|
|
- `platformio.ini` - Added `PNGdec` dependency, `PNG_MAX_BUFFERED_PIXELS=6402` build flag
|
||
|
|
|
||
|
|
## Key Conflict Resolutions
|
||
|
|
- `TAG_PageImage = 3` (not 2) to avoid collision with mod's `TAG_PageTableRow = 2`
|
||
|
|
- Preserved mod's bookmark ribbon rendering in `renderContents`
|
||
|
|
- Preserved mod's table rendering (`PageTableRow`) alongside new `PageImage`
|
||
|
|
- Section file version bumped to invalidate cached sections
|
||
|
|
|
||
|
|
## Build Result
|
||
|
|
- `mod` environment: SUCCESS (RAM 31.0%, Flash 77.5%)
|
||
|
|
|
||
|
|
## Follow-up Items
|
||
|
|
- Test on device with JPEG/PNG EPUBs
|
||
|
|
- Run `scripts/generate_test_epub.py` to create test EPUBs
|
||
|
|
- Consider whether `displayWindow()` experimental path should be enabled
|