ReaderRolling: quicker partial rerenderings with EPUBs

Only available with EPUBs containing 2 or more fragments,
and a file size large enough to ensure a cache file is used.
The idea is simply, on any rendering setting change, to
skip the rerendering of the full book and to defer any
rerendering to the moment we draw a DocFragment, and
render only it.
So, on a setting change, only the fragment containing the
current page will be rerendered, and the new fragments we
may cross while turning pages.
When having done so, KOReader is in a degraded state (the
full page count is incorrect, the ToC is invalid...).
So, a full rerendering is needed, and one will happen
in the background, and when the user is idle, we reload
seamlessly and quickly from the cache file it has made.
ReaderFlipping will show some icons in the top left
corner to let it know at which steps in this procress
we are.
This commit is contained in:
poire-z
2023-02-16 23:30:58 +01:00
parent 15499434df
commit 81f2aed086
8 changed files with 615 additions and 15 deletions

View File

@@ -190,6 +190,14 @@ function ReaderView:paintTo(bb, x, y)
elseif self.view_mode == "scroll" then
self:drawScrollView(bb, x, y)
end
local should_repaint = self.ui.rolling:handlePartialRerendering()
if should_repaint then
-- ReaderRolling may have repositionned on another page containing
-- the xpointer of the top of the original page: recalling this is
-- all there is to do.
self:paintTo(bb, x, y)
return
end
end
-- dim last read area
@@ -226,7 +234,8 @@ function ReaderView:paintTo(bb, x, y)
self.footer:paintTo(bb, x, y)
end
-- paint flipping or select mode sign
if self.flipping_visible or self.ui.highlight.select_mode then
if self.flipping_visible or self.ui.highlight.select_mode
or (self.ui.rolling and self.ui.rolling.rendering_state) then
self.flipping:paintTo(bb, x, y)
end
for _, m in pairs(self.view_modules) do