Commit Graph

6 Commits

Author SHA1 Message Date
Martin Brook
a2d32640f2 style: fix clang-format issues 2026-02-01 09:24:04 +00:00
Martin Brook
ff28388b04 fix: isFormatSupported now correctly extracts extension
Address review comment #6:
- isFormatSupported() was passing the full path to supportsFormat()
  which only matches extensions like ".jpg", so it always returned false
- Delegate to getDecoder() which correctly extracts the extension first
2026-02-01 09:24:04 +00:00
Martin Brook
12b1e8e2cb refactor: use shared DitherUtils and PixelCache in JPEG decoder
Address review comments #2 and #3:
- Remove duplicated bayer4x4, applyBayerDither4Level(),
  drawPixelWithRenderMode(), and PixelCache from JPEG decoder
- Include shared DitherUtils.h and PixelCache.h instead
2026-02-01 09:24:04 +00:00
Martin Brook
8a31d05c38 refactor: replace PNG global state with PngContext struct
Address review comments #1 and #7:
- Replace all file-scope global variables (gRenderer, gConfig, gScale,
  gCacheBuffer, etc.) with a PngContext struct passed through pDraw->pUser
- Unify file I/O callbacks to use pFile->fHandle instead of global FsFile*
- Remove the unused FsFile opened at the start of decodeToFramebuffer()
  that was never used for actual decoding (duplicate open)
- Use shared PixelCache from PixelCache.h instead of hand-rolled globals
2026-02-01 09:24:04 +00:00
Martin Brook
b8e61130f2 refactor: extract shared DitherUtils.h and PixelCache.h
Address review comments #2, #3, and #10:
- Extract duplicated bayer4x4 matrix, applyBayerDither4Level(), and
  drawPixelWithRenderMode() into shared DitherUtils.h
- Extract duplicated PixelCache struct into shared PixelCache.h so both
  JPEG and PNG decoders use the same implementation
- Add MAX_CACHE_BYTES (256KB) size limit to PixelCache::allocate() to
  proactively guard against oversized allocations on embedded targets
2026-02-01 09:24:04 +00:00
Martin Brook
f807953ee3 feat: epub add png jpeg support 2026-02-01 09:24:00 +00:00