mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
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:
2
base
2
base
Submodule base updated: fac6e7c852...ac608dec40
@@ -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,
|
||||
|
||||
@@ -130,10 +130,15 @@ end
|
||||
if Device:hasEinkScreen() then
|
||||
Device.screen:setupDithering()
|
||||
if Device.screen.hw_dithering and G_reader_settings:isTrue("dev_no_hw_dither") then
|
||||
Device.screen:toggleHWDithering()
|
||||
Device.screen:toggleHWDithering(false)
|
||||
end
|
||||
if Device.screen.sw_dithering and G_reader_settings:isTrue("dev_no_sw_dither") then
|
||||
Device.screen:toggleSWDithering()
|
||||
Device.screen:toggleSWDithering(false)
|
||||
end
|
||||
-- NOTE: If device can HW dither (i.e., after setupDithering(), hw_dithering is true, but sw_dithering is false),
|
||||
-- but HW dither is explicitly disabled, and SW dither enabled, don't leave SW dither disabled (i.e., re-enable sw_dithering)!
|
||||
if Device:canHWDither() and G_reader_settings:isTrue("dev_no_hw_dither") and G_reader_settings:nilOrFalse("dev_no_sw_dither") then
|
||||
Device.screen:toggleSWDithering(true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user