Fix a few logic holes in dithering mode selection (#6419)

* Allow switching to SW dithering on a HW-capable device without that being lost on boot (and, worse, left in an undithered state).
* Make sure the automagic toggles between HW/SW in the Dev menu are properly saved.
This commit is contained in:
NiLuJe
2020-07-23 06:01:46 +02:00
committed by GitHub
parent fa55152465
commit b4d5cfccb7
3 changed files with 14 additions and 7 deletions

View File

@@ -356,11 +356,12 @@ function FileManagerMenu:setUpdateItemTable()
return not Device.screen.hw_dithering
end,
callback = function()
G_reader_settings:flipNilOrFalse("dev_no_hw_dither")
Device.screen:toggleHWDithering()
G_reader_settings:saveSetting("dev_no_hw_dither", not Device.screen.hw_dithering)
-- Make sure SW dithering gets disabled when we enable HW dithering
if Device.screen.hw_dithering and Device.screen.sw_dithering then
Device.screen:toggleSWDithering()
G_reader_settings:saveSetting("dev_no_sw_dither", true)
Device.screen:toggleSWDithering(false)
end
UIManager:setDirty("all", "full")
end,
@@ -376,11 +377,12 @@ function FileManagerMenu:setUpdateItemTable()
return not Device.screen.sw_dithering
end,
callback = function()
G_reader_settings:flipNilOrFalse("dev_no_sw_dither")
Device.screen:toggleSWDithering()
G_reader_settings:saveSetting("dev_no_sw_dither", not Device.screen.sw_dithering)
-- Make sure HW dithering gets disabled when we enable SW dithering
if Device.screen.hw_dithering and Device.screen.sw_dithering then
Device.screen:toggleHWDithering()
G_reader_settings:saveSetting("dev_no_hw_dither", true)
Device.screen:toggleHWDithering(false)
end
UIManager:setDirty("all", "full")
end,