mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user