Files
crosspoint-reader-mod/chat-summaries/2026-02-09_16-29-summary.md
cottongin dfbc931c14 mod: Phase 1 - bring forward mod-exclusive files with ActivityManager migration
Brings ~55 mod-exclusive files to the upstream-based mod/master-resync branch:

Activities (migrated to new ActivityManager pattern):
- Clock/Time: SetTimeActivity, SetTimezoneOffsetActivity, NtpSyncActivity
- Dictionary: DictionaryDefinitionActivity, DictionarySuggestionsActivity,
  DictionaryWordSelectActivity, LookedUpWordsActivity
- Bookmark: EpubReaderBookmarkSelectionActivity
- Book management: BookManageMenuActivity, EndOfBookMenuActivity
- OPDS: OpdsServerListActivity, OpdsSettingsActivity
- Utility: DirectoryPickerActivity, NumericStepperActivity

Utilities (unchanged):
- BookManager, BookSettings, BookmarkStore, BootNtpSync
- Dictionary, LookupHistory, TimeSync, OpdsServerStore

Libraries: PlaceholderCover, TableData, ChapterXPathIndexer
Scripts: inject_mod_version, generate_book_icon, preview_placeholder_cover
Docs: KOReader sync XPath mapping

Migration changes:
- ActivityWithSubactivity -> Activity base class
- Callback constructors -> finish()/setResult() pattern
- enterNewActivity() -> startActivityForResult()
- Activity::RenderLock&& -> RenderLock&&

These files won't compile yet - they reference mod settings and I18n
strings that will be added in subsequent phases.

Made-with: Cursor
2026-03-07 15:10:00 -05:00

1.9 KiB

Edge Data Caching for Sleep Screen Letterbox Fill

Task

Cache the letterbox edge-sampling calculations so they are only computed once per cover image (on first sleep) and reused from a binary cache file on subsequent sleeps.

Changes Made

src/activities/boot_sleep/SleepActivity.h

  • Added #include <string> and updated renderBitmapSleepScreen signature to accept an optional edgeCachePath parameter (defaults to empty string for no caching).

src/activities/boot_sleep/SleepActivity.cpp

  • Added #include <Serialization.h> for binary read/write helpers.
  • Added loadEdgeCache() function in the anonymous namespace: loads edge data from a binary cache file, validates the cache version and screen dimensions against current values to detect stale data.
  • Added saveEdgeCache() function: writes edge data (edgeA, edgeB arrays + metadata) to a compact binary file (~10 bytes header + 2 * edgeCount bytes data, typically under 1KB).
  • Updated renderBitmapSleepScreen(): tries loading from cache before sampling. On cache miss, samples edges from bitmap and saves to cache. On cache hit, skips the bitmap sampling pass entirely.
  • Updated renderCoverSleepScreen(): derives the edge cache path from the cover BMP path (e.g. cover.bmp -> cover_edges.bin) and passes it to renderBitmapSleepScreen. The cache is stored alongside the cover BMP in the book's .crosspoint directory.
  • Custom sleep images (renderCustomSleepScreen) do not use caching since the image may change randomly each sleep.

Cache Design

  • Format: Binary file with version byte, screen dimensions, horizontal flag, edge count, letterbox sizes, and two edge color arrays.
  • Invalidation: Validated by cache version and screen dimensions. Naturally scoped per-book (lives in /.crosspoint/epub_<hash>/). Different cover modes (FIT vs CROP) produce different BMP files and thus different cache paths.
  • Size: ~970 bytes for a 480-wide image.

Follow-up Items

  • None