Skip to content

fix(reader): invert sidebar thumbnails only under dark theme - #1

Closed
add-uos wants to merge 4 commits into
fix-pin-render-task-lifetimefrom
fix-invert-sidebar-thumbnails-dark-theme
Closed

add-uos wants to merge 4 commits into
fix-pin-render-task-lifetimefrom
fix-invert-sidebar-thumbnails-dark-theme

Conversation

@add-uos

@add-uos add-uos commented Sep 15, 2026

Copy link
Copy Markdown
Owner

⚠️ 堆叠 PR(Stacked PR)

修改说明

侧栏缩略图此前无条件做夜间反色,浅色主题下观感异常。现改为仅在夜间/深色模式下反色,且反色时跳过图片对象区域(与主视图 BrowserPage 的蒙版行为一致):

  • 渲染线程生成缩略图时预取图片对象 bbox(与 174×174 缩略图同尺寸请求,蒙版与输出像素一一对齐),避免 UI 线程与渲染争文档锁
  • DocSheet 随缩略图一同缓存每页 imageRectsthumbnailImageRects / setThumbnail 新签名,带默认参数保持兼容)
  • 缩略图/书签/注释/搜索结果各 delegate 绘制时按 bbox 蒙版跳过图片区域

自测

  • 浅色主题下侧栏缩略图不再反色
  • 深色/夜间模式下反色正常,图片区域不被蒙版覆盖

Render task structs now carry a renderer shared reference and a uuid
snapshot; workers dereference only those and skip tasks whose sheet is
gone (existSheetByUuid). DocSheet owns SheetRenderer via QSharedPointer
and purges queued tasks (clearAllTasksForSheet/Page) before
destruction. BrowserPage validates page aliveness before writing render
results back, and the pinch-zoom timer callback is bound to its
receiver to avoid UAF.

渲染任务结构体改为携带渲染器共享引用与入队时快照的 uuid:worker 线
程仅解引用这两者,并经 existSheetByUuid 跳过已销毁文档的任务。
DocSheet 改用 QSharedPointer 持有 SheetRenderer,析构前排空排队任务
(clearAllTasksForSheet/Page);BrowserPage 回写渲染结果前校验页面
存活;捏合缩放定时器回调绑定 receiver,消除悬空指针。

Log: 渲染任务生命周期加固,消除文档销毁后 worker/回包路径悬空指针
PMS: BUG-377151
Influence: 文档关闭/缩放过程中渲染回调不再有悬空指针风险;正常渲染行为不变。
…han states

Cleanup could leave dangling references because bookmarks and tab
groups were removed independently while ownership records were still
being reconciled; the residue was re-persisted by later sync runs.

孤立状态下的书签与标签组独立清理时归属记录仍在协调,残留项会被
后续同步再次落盘。

Log: 修复孤立状态下书签与标签组清理不同步导致残留引用的问题
Influence: 数据库书签与标签组清理逻辑,孤立状态下不再残留悬挂引用。
Sidebar thumbnails followed eye-protection mode and stayed white in
dark theme. Now they follow the system theme only: white pages are
inverted via the shared NightFilter (CIELAB L*), image objects keep
original colors through a mask prefetched by the worker and cached
with the thumbnail, and scanned pages (>70% coverage) are fully
inverted. Bookmark/notes lists and the search-result page thumbnails
follow the same rules, and mask rects are scaled to the scaled pixmap
before filtering.

侧边栏缩略图原先跟随护眼模式,深色主题下仍是白底。现改为只跟随系统
深浅主题:白底经主干夜间滤镜(CIELAB L*)反转为黑底白字,照片区域按
worker 预取、随缩略图缓存的图片对象蒙版保持原色,扫描页(覆盖率超
70%)整页反色;书签/注释列表与搜索结果页的页面小图同规则,蒙版坐标
先映射到缩放后的像素图再进滤镜。

Log: 侧边栏缩略图/书签/注释/搜索结果深色主题反色并支持图片对象蒙版
PMS: BUG-377151
Influence: 深色主题下侧边栏(含触发搜索后的结果页)观感与主视图一致,浅色主题显示不变。
@add-uos
add-uos force-pushed the fix-invert-sidebar-thumbnails-dark-theme branch from 5b7201b to d1a9a9c Compare September 15, 2026 11:02
Model.cpp is compiled with the global OFD_SUPPORT_ENABLED definition,
but batchprint-convert neither built OfdModel.cpp (which implements
OfdDocument::loadDocument) nor linked rofd_ffi/cairo, so linking
deepin-reader-batchprint failed with an undefined reference. Add
OfdModel.cpp and Navigation.cpp plus the rofd/cairo include dirs,
compile options and link libraries behind OFD_SUPPORT_ENABLED,
mirroring the existing XPS handling.

batchprint-convert 编译 Model.cpp 时继承了全局 OFD_SUPPORT_ENABLED 宏,
但既未编译实现 OfdDocument::loadDocument 的 OfdModel.cpp,也未链接
rofd_ffi/cairo,导致 deepin-reader-batchprint 链接报未定义引用。仿照
XPS 的处理方式,在 OFD_SUPPORT_ENABLED 下补充 OfdModel.cpp、
Navigation.cpp 及 rofd/cairo 头文件路径、编译选项与链接库。

Log: 修复批量打印 OFD 开启时缺少 OfdModel/rofd 链接导致的编译失败
Influence: 仅构建调整:OFD 支持开启时 batchprint 可正常编译链接,关闭 OFD 时行为不变。
@add-uos add-uos closed this Sep 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant