Merge remote-tracking branch 'origin/develop' into feat-bluetooth
This commit is contained in:
@@ -78,6 +78,21 @@ class EpubReaderActivity final : public Activity {
|
||||
// session with no shed ground to <2.2 KB free and aborted on a page load.
|
||||
static constexpr size_t RENDER_MIN_FREE_HEAP = 24 * 1024;
|
||||
|
||||
// Viewport of the last render(), captured so loop()'s lazy partial-extension start
|
||||
// builds with IDENTICAL layout parameters to the pages already rendered (a mismatch
|
||||
// would paginate differently than the partial being extended). 0 = no render yet.
|
||||
uint16_t buildViewportWidth = 0;
|
||||
uint16_t buildViewportHeight = 0;
|
||||
// Set when the lazy extension start failed, so loop() doesn't retry (and log) every
|
||||
// tick; the blocking extension in render() remains the fallback past the watermark.
|
||||
bool partialRebuildStartFailed = false;
|
||||
|
||||
// Last position persisted by render()'s saveProgress, used to skip redundant
|
||||
// writeAtomic calls on no-op re-renders (menu/bookmark/screenshot).
|
||||
int lastSavedSpineIndex = -1;
|
||||
int lastSavedPage = -1;
|
||||
int lastSavedPageCount = -1;
|
||||
|
||||
void renderContents(std::unique_ptr<Page> page, int orientedMarginTop, int orientedMarginRight,
|
||||
int orientedMarginBottom, int orientedMarginLeft);
|
||||
void renderStatusBar() const;
|
||||
@@ -116,6 +131,13 @@ class EpubReaderActivity final : public Activity {
|
||||
// in one sitting -- instant reopen comes from Section::suspendBuild() persisting the pages
|
||||
// already laid out as a partial file on exit/sleep.
|
||||
static constexpr int BUILD_WINDOW_AHEAD = 5;
|
||||
// Reopening a partial does NOT immediately restart its extension build (a whole-chapter
|
||||
// re-layout from page 0 -- minutes of background CPU + SD writes on a giant spine, wasted
|
||||
// when the reader never crosses the watermark that session). Instead loop() starts it once
|
||||
// the reader is within this many pages of the watermark: at ~30s per page read and ~100-300ms
|
||||
// per page rebuilt, this margin gives the rebuild ample runway to catch up (and finalize)
|
||||
// before the reader arrives.
|
||||
static constexpr int PARTIAL_REBUILD_START_MARGIN = 15;
|
||||
// Show the indexing popup when an initial build must lay out more than this many pages up front
|
||||
// (a deep resume/jump into a not-yet-built section), so it isn't a silent wait. Kept independent
|
||||
// of the small look-ahead window so ordinary landings stay popup-free.
|
||||
@@ -155,6 +177,11 @@ class EpubReaderActivity final : public Activity {
|
||||
void onExit() override;
|
||||
void loop() override;
|
||||
void render(RenderLock&& lock) override;
|
||||
// Full CPU speed + fast loop ticks while a section build runs: at the low-power
|
||||
// frequency a giant chapter's background rebuild stretches from ~40s to many
|
||||
// minutes, so the reader exits before it can finalize and the next open restarts
|
||||
// it from page 0. Reverts to normal power behavior the moment the build finishes.
|
||||
bool skipLoopDelay() override { return section && section->isBuilding(); }
|
||||
bool isReaderActivity() const override { return true; }
|
||||
void requestGhostCleanup() override { pagesUntilFullRefresh = 1; }
|
||||
ScreenshotInfo getScreenshotInfo() const override;
|
||||
|
||||
Reference in New Issue
Block a user