Allow disabling automagic image inversion in Nightmode in CRe (#5095)

* Allow disabling automagic image inversion in NightMode

Fix #4986
This commit is contained in:
NiLuJe
2019-06-26 00:23:41 +02:00
committed by GitHub
parent fca51757af
commit 4ccb1f3dd5
5 changed files with 59 additions and 4 deletions

View File

@@ -23,6 +23,7 @@ local CreDocument = Document:new{
_loaded = false,
_view_mode = nil,
_smooth_scaling = false,
_nightmode_images = true,
line_space_percent = 100,
default_font = "Noto Serif",
@@ -378,7 +379,7 @@ function CreDocument:drawCurrentView(target, x, y, rect, pos)
-- local start_clock = os.clock()
self._drawn_images_count, self._drawn_images_surface_ratio =
self._document:drawCurrentPage(self.buffer, self.render_color, Screen.night_mode, self._smooth_scaling, Screen.sw_dithering)
self._document:drawCurrentPage(self.buffer, self.render_color, Screen.night_mode and self._nightmode_images, self._smooth_scaling, Screen.sw_dithering)
-- print(string.format("CreDocument:drawCurrentView: Rendering took %9.3f ms", (os.clock() - start_clock) * 1000))
-- start_clock = os.clock()
@@ -736,6 +737,11 @@ function CreDocument:setImageScaling(toggle)
self._smooth_scaling = toggle
end
function CreDocument:setNightmodeImages(toggle)
logger.dbg("CreDocument: set nightmode images", toggle)
self._nightmode_images = toggle
end
function CreDocument:setFloatingPunctuation(enabled)
-- FIXME: occasional segmentation fault when toggling floating punctuation
logger.dbg("CreDocument: set floating punctuation", enabled)