Minor flash tweaks after #6528 (#6540)

* Boundaries are now detected both when paging forward and backward.

Fixes potential false-negatives in the chapter boundary heuristic code, as mentioned in https://github.com/koreader/koreader/pull/6528#issuecomment-678610188 ;).

* Tweaked ReaderFooter to not repaint ReaderUI when it's unnecessary. (toggling/cycling it on a page with significant image content would flash the full screen).

* Only flash the first time a page w/ significant image content is shown. (Menus, among other things, could otherwise re-trip the flash).
reviewable/pr6549/r1
NiLuJe 4 years ago committed by GitHub
parent b5d3305876
commit 0e27963ae7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -1766,10 +1766,36 @@ function ReaderFooter:_updateFooterText(force_repaint, force_recompute)
-- NOTE: That's assuming using "fast" for pans was a good idea, which, it turned out, not so much ;).
-- NOTE: We skip repaints on page turns/pos update, as that's redundant (and slow).
if force_repaint then
-- NOTE: We need to repaint everything when toggling the progress bar, for some reason.
UIManager:setDirty(self.view.dialog, function()
return "ui", self.footer_content.dimen
end)
-- NOTE: Getting the dimensions of the widget is impossible without having drawn it first,
-- so, we'll fudge it if need be...
local refresh_dim = self.footer_content.dimen
-- No content yet...
if not refresh_dim then
-- So, instead, compute self.footer_content's height ourselves: i.e., self.vertical_frame + self.bottom_padding...
refresh_dim = self.dimen
if self.view.footer_visible then
refresh_dim.h = self.vertical_frame:getSize().h + self.bottom_padding
else
-- When going invisible, the text is no longer visible, so the frame's height is off by self.height
refresh_dim.h = self.vertical_frame:getSize().h + self.height + self.bottom_padding
end
refresh_dim.y = self._saved_screen_height - refresh_dim.h
end
-- If we're making the footer visible (or it already is), we don't need to repaint ReaderUI behind it
if self.view.footer_visible then
-- Unfortunately, it's not a modal (we never show() it), so it's not in the window stack,
-- instead, it's baked inside ReaderUI, so it gets slightly trickier...
-- NOTE: self.view.footer -> self ;).
UIManager:setDirty(self.view.footer, function()
return "ui", refresh_dim
end)
-- c.f., ReaderView:paintTo()
UIManager:widgetRepaint(self.view.footer, 0, 0)
else
UIManager:setDirty(self.view.dialog, function()
return "ui", refresh_dim
end)
end
end
end

@ -59,23 +59,29 @@ function ReaderToc:onUpdateToc()
end
function ReaderToc:onPageUpdate(pageno)
self.pageno = pageno
if UIManager.FULL_REFRESH_COUNT == -1 or G_reader_settings:isTrue("refresh_on_chapter_boundaries") then
local flash_on_second = G_reader_settings:nilOrFalse("no_refresh_on_second_chapter_page")
if self:isChapterEnd(pageno, 0) then
self.chapter_refresh = true
elseif self.chapter_refresh and self:isChapterStart(pageno, 0) then
UIManager:setDirty(nil, "full")
if not flash_on_second then
self.chapter_refresh = false
local paging_forward, paging_backward
if flash_on_second then
if self.pageno then
if pageno > self.pageno then
paging_forward = true
elseif pageno < self.pageno then
paging_backward = true
end
end
elseif self.chapter_refresh and self:isChapterSecondPage(pageno, 0) then
end
if paging_backward and self:isChapterEnd(pageno, 0) then
UIManager:setDirty(nil, "full")
elseif self:isChapterStart(pageno, 0) then
UIManager:setDirty(nil, "full")
elseif paging_forward and self:isChapterSecondPage(pageno, 0) then
UIManager:setDirty(nil, "full")
self.chapter_refresh = false
else
self.chapter_refresh = false
end
end
self.pageno = pageno
end
function ReaderToc:onPosUpdate(pos, pageno)

@ -223,9 +223,12 @@ function ReaderView:paintTo(bb, x, y)
-- With some nil guards because this may not be implemented in every engine ;).
if img_count and img_count > 0 and img_coverage and img_coverage >= 0.075 then
self.dialog.dithered = true
-- Request a flashing update while we're at it
UIManager:setDirty(nil, "full")
-- Request a flashing update while we're at it, but only if it's the first time we're painting it
if self.state.drawn == false then
UIManager:setDirty(nil, "full")
end
end
self.state.drawn = true
end
end
@ -760,6 +763,7 @@ end
function ReaderView:onPageUpdate(new_page_no)
self.state.page = new_page_no
self.state.drawn = false
self:recalculate()
self.highlight.temp = {}
self:checkAutoSaveSettings()

Loading…
Cancel
Save