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:
NiLuJe
2022-01-16 18:36:11 +01:00
committed by poire-z
parent 5e3790677e
commit 7018853940
3 changed files with 13 additions and 10 deletions

View File

@@ -1,7 +1,6 @@
local Blitbuffer = require("ffi/blitbuffer")
local CacheItem = require("cacheitem")
local Configurable = require("configurable")
local Device = require("device")
local DocCache = require("document/doccache")
local DrawContext = require("ffi/drawcontext")
local CanvasContext = require("document/canvascontext")
@@ -413,7 +412,7 @@ function Document:renderPage(pageno, rect, zoom, rotation, gamma, render_mode, h
end
if hinting then
Device:enableCPUCores(2)
CanvasContext:enableCPUCores(2)
end
self:preRenderPage()
@@ -429,7 +428,7 @@ function Document:renderPage(pageno, rect, zoom, rotation, gamma, render_mode, h
logger.warn("aborting, since we do not have a specification for that part")
-- required part not given, so abort
if hinting then
Device:enableCPUCores(1)
CanvasContext:enableCPUCores(1)
end
return
end
@@ -474,7 +473,7 @@ function Document:renderPage(pageno, rect, zoom, rotation, gamma, render_mode, h
self:postRenderPage()
if hinting then
Device:enableCPUCores(1)
CanvasContext:enableCPUCores(1)
end
return tile
end