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

@@ -2,8 +2,12 @@
Simple math helper functions
]]
local bit = require("bit")
local Math = {}
local band = bit.band
function Math.roundAwayFromZero(num)
if num > 0 then
return math.ceil(num)
@@ -17,7 +21,7 @@ function Math.round(num)
end
function Math.oddEven(number)
if number % 2 == 1 then
if band(number, 1) == 1 then
return "odd"
else
return "even"