mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Stash enableCPUCores in CanvasContext
Avoids requring Device direction in Document. The method needs complete access to the Device object, though, so it's just another layer of indirection, with an extra reference on the Device object stashed in CanvasContext... (much like it already does for Screen)
This commit is contained in:
@@ -35,6 +35,7 @@ The following key is required for a device object:
|
||||
* isColorEnabled() -> boolean
|
||||
]]--
|
||||
function CanvasContext:init(device)
|
||||
self.device = device
|
||||
self.screen = device.screen
|
||||
self.isAndroid = device.isAndroid
|
||||
self.isDesktop = device.isDesktop
|
||||
@@ -45,7 +46,7 @@ function CanvasContext:init(device)
|
||||
self.hasSystemFonts = device.hasSystemFonts
|
||||
self:setColorRenderingEnabled(device.screen.isColorEnabled())
|
||||
|
||||
-- NOTE: Kobo's fb is BGR, not RGB. Handle the conversion in MuPDF if needed.
|
||||
-- NOTE: At 32bpp, Kobo's fb is BGR, not RGB. Handle the conversion in MuPDF if needed.
|
||||
if device:hasBGRFrameBuffer() then
|
||||
self.is_bgr = true
|
||||
Mupdf.bgr = true
|
||||
@@ -77,4 +78,8 @@ function CanvasContext:scaleBySize(px)
|
||||
return self.screen:scaleBySize(px)
|
||||
end
|
||||
|
||||
function CanvasContext:enableCPUCores(amount)
|
||||
return self.device:enableCPUCores(amount)
|
||||
end
|
||||
|
||||
return CanvasContext
|
||||
|
||||
Reference in New Issue
Block a user