Faster blitting @ BB8/BBRGB32 when no processing is needed (#4847)

* Pickup the eponymous blitting performance tweaks from koreader/koreader-base#878
* Cleanup BitOpts usage (require & cache)
* Unify oddness checks (MOD -> AND)
* Enforce the native Portrait orientation on Kobo (except @ 16bpp, i.e., KSM w/ 8bpp swap disabled), to allow for faster blitting when unrotted.
* Switch CRe BB to 32BPP on color screens
* Minor cleanups
This commit is contained in:
NiLuJe
2019-03-27 22:50:44 +01:00
committed by GitHub
parent fe3fc78171
commit 7210fb478d
12 changed files with 64 additions and 51 deletions

View File

@@ -1,3 +1,4 @@
local bit = require("bit")
local Blitbuffer = require("ffi/blitbuffer")
local ConfirmBox = require("ui/widget/confirmbox")
local Device = require("device")
@@ -11,6 +12,8 @@ local Input = Device.input
local Screen = Device.screen
local T = require("ffi/util").template
local band = bit.band
--[[
Rolling is just like paging in page-based documents except that
sometimes (in scroll mode) there is no concept of page number to indicate
@@ -789,12 +792,12 @@ function ReaderRolling:_gotoPage(new_page, free_first_page)
if self.ui.document:getVisiblePageCount() > 1 and not free_first_page then
-- Ensure we always have the first of the two pages odd
if self.odd_or_even_first_page == 1 then -- odd
if new_page % 2 == 0 then
if band(new_page, 1) == 0 then
-- requested page will be shown as the right page
new_page = new_page - 1
end
elseif self.odd_or_even_first_page == 2 then -- (or 'even' if requested)
if new_page % 2 == 1 then
if band(new_page, 1) == 1 then
-- requested page will be shown as the right page
new_page = new_page - 1
end