decouple device from document modules

This commit is contained in:
Qingping Hou
2018-10-26 08:29:07 -07:00
committed by Frans de Jonge
parent 2ba480b41d
commit 02eca23649
11 changed files with 47 additions and 24 deletions

View File

@@ -1,6 +1,6 @@
local Document = require("document/document")
local DrawContext = require("ffi/drawcontext")
local Screen = require("device").screen
local Runtimectl = require("runtimectl")
local pic = nil
local PicDocument = Document:new{
@@ -15,7 +15,7 @@ function PicDocument:init()
self:updateColorRendering()
if not pic then pic = require("ffi/pic") end
-- pic.color needs to be true before opening document to allow toggling color
pic.color = Screen.isColorScreen()
pic.color = Runtimectl.is_color_rendering_enabled
local ok
ok, self._document = pcall(pic.openDocument, self.file)
if not ok then