This commit is contained in:
jpirnay
2026-05-20 19:27:55 +02:00
parent 438ed0b47e
commit ba7c66dd36
2 changed files with 34 additions and 0 deletions
@@ -334,6 +334,11 @@ void EpubReaderActivity::onExit() {
Activity::onExit();
logReaderMemSnapshot("onExit_before_release");
// If a pre-render left the next page in the frame buffer, redraw the current page so the
// next activity (notably SleepActivity's OVERLAY mode) sees what the user was looking at.
// Must run before section.reset() and the orientation reset below.
restoreCurrentPageToBufferIfPreRendered();
// Save bookmarks before exit
bookmarkStore.save();
if (epub) {
@@ -2231,6 +2236,31 @@ void EpubReaderActivity::displayPreRenderedPage(const Page& page, const int orie
}
}
void EpubReaderActivity::restoreCurrentPageToBufferIfPreRendered() {
if (!preRenderedPage.ready || !section || !epub) {
return;
}
int orientedMarginTop, orientedMarginRight, orientedMarginBottom, orientedMarginLeft;
renderer.getOrientedViewableTRBL(&orientedMarginTop, &orientedMarginRight, &orientedMarginBottom,
&orientedMarginLeft);
const int statusBarTopHeight = UITheme::getStatusBarTopHeight(automaticPageTurnActive);
const int statusBarBottomHeight = UITheme::getStatusBarBottomHeight(automaticPageTurnActive);
orientedMarginTop += std::max(static_cast<int>(SETTINGS.screenMargin), statusBarTopHeight);
orientedMarginLeft += SETTINGS.screenMargin;
orientedMarginRight += SETTINGS.screenMargin;
orientedMarginBottom += std::max(static_cast<int>(SETTINGS.screenMargin), statusBarBottomHeight);
auto p = section->loadPageFromSectionFile();
if (!p) {
return;
}
renderPageContentOnly(*p, orientedMarginTop, orientedMarginRight, orientedMarginBottom, orientedMarginLeft);
preRenderedPage.ready = false;
pendingPreRender = false;
usePreRenderedBuffer = false;
}
void EpubReaderActivity::renderStatusBar() const {
// Calculate progress in book
const int currentPage = section->currentPage + 1;