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

@@ -322,9 +322,9 @@ function CreDocument:render()
logger.dbg("CreDocument: rendering done.")
end
function CreDocument:getDocumentRenderingHash()
function CreDocument:getDocumentRenderingHash(extended)
if self.been_rendered then
return self._document:getDocumentRenderingHash()
return self._document:getDocumentRenderingHash(extended)
end
return 0
end
@@ -1390,6 +1390,26 @@ function CreDocument:setCallback(func)
return self._document:setCallback(func)
end
function CreDocument:canBePartiallyRerendered()
return self._document:canBePartiallyRerendered()
end
function CreDocument:isPartialRerenderingEnabled()
return self._document:isPartialRerenderingEnabled()
end
function CreDocument:enablePartialRerendering(enable)
return self._document:enablePartialRerendering(enable)
end
function CreDocument:getPartialRerenderingsCount()
return self._document:getPartialRerenderingsCount()
end
function CreDocument:isRerenderingDelayed()
return self._document:isRerenderingDelayed()
end
function CreDocument:isBuiltDomStale()
return self._document:isBuiltDomStale()
end
@@ -1398,6 +1418,10 @@ function CreDocument:hasCacheFile()
return self._document:hasCacheFile()
end
function CreDocument:isCacheFileStale()
return self._document:isCacheFileStale()
end
function CreDocument:invalidateCacheFile()
self._document:invalidateCacheFile()
end
@@ -1794,6 +1818,8 @@ function CreDocument:setupCallCache()
elseif name == "getPageFlow" then no_wrap = true
elseif name == "getPageNumberInFlow" then no_wrap = true
elseif name == "getTotalPagesLeft" then no_wrap = true
elseif name == "getDocumentRenderingHash" then no_wrap = true
elseif name == "getPartialRerenderingsCount" then no_wrap = true
-- Some get* have different results by page/pos
elseif name == "getLinkFromPosition" then cache_by_tag = true