Fix issue #249
This commit is contained in:
@@ -334,6 +334,11 @@ void EpubReaderActivity::onExit() {
|
|||||||
Activity::onExit();
|
Activity::onExit();
|
||||||
logReaderMemSnapshot("onExit_before_release");
|
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
|
// Save bookmarks before exit
|
||||||
bookmarkStore.save();
|
bookmarkStore.save();
|
||||||
if (epub) {
|
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 {
|
void EpubReaderActivity::renderStatusBar() const {
|
||||||
// Calculate progress in book
|
// Calculate progress in book
|
||||||
const int currentPage = section->currentPage + 1;
|
const int currentPage = section->currentPage + 1;
|
||||||
|
|||||||
@@ -261,6 +261,10 @@ class EpubReaderActivity final : public Activity {
|
|||||||
// that was last rendered into the buffer (needed for image AA re-render).
|
// that was last rendered into the buffer (needed for image AA re-render).
|
||||||
void displayPreRenderedPage(const Page& page, int orientedMarginTop, int orientedMarginRight,
|
void displayPreRenderedPage(const Page& page, int orientedMarginTop, int orientedMarginRight,
|
||||||
int orientedMarginBottom, int orientedMarginLeft);
|
int orientedMarginBottom, int orientedMarginLeft);
|
||||||
|
// If the frame buffer currently holds a pre-rendered next page, redraw the current page
|
||||||
|
// into it (no status bar, no flush). Restores the invariant other activities — notably
|
||||||
|
// SleepActivity's OVERLAY mode — rely on when transitioning out of the reader.
|
||||||
|
void restoreCurrentPageToBufferIfPreRendered();
|
||||||
void renderStatusBar() const;
|
void renderStatusBar() const;
|
||||||
// Snapshot of the three status-bar signals that can change while a page is otherwise idle.
|
// Snapshot of the three status-bar signals that can change while a page is otherwise idle.
|
||||||
// Compared in shouldSkipPeriodicUpdate() to suppress no-op minute-tick re-renders that on
|
// Compared in shouldSkipPeriodicUpdate() to suppress no-op minute-tick re-renders that on
|
||||||
|
|||||||
Reference in New Issue
Block a user