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 authored and poire-z committed 2022-01-19 12:44:35 +01:00
1 parent 5e3790677e
commit 7018853940
3 files changed
+13 -10

No files matched your search

+3 -4
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