feat(reader): support OFD documents rendering - #383
Conversation
There was a problem hiding this comment.
Sorry @add-uos, your pull request is larger than the review limit of 150,000 diff characters
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: ['代码空指针检查、整数溢出检查、浮点数有限性检查均十分完善,边界条件处理得当'] 2. 代码质量 ✅评价: 良好 ✅ 通过 潜在问题: 建议: ['统一 OfdModel.cpp/h 的版权声明格式,移除冗余的 Copyright (C) 行', '统一"Warnings"的中文翻译', "测试代码中使用 friend 类替代 '#define private public' 宏技巧", '考虑将 renderPage 中的 Cairo 表面创建和诊断处理拆分为辅助函数'] 3. 代码性能 ✅评价: 优秀 ✅ 通过 潜在问题: 建议: ['ThumbnailDelegate 的 nightPixmap 缓存避免了重复逐像素反色计算,设计合理', 'OfdDocument 的导航页矩形缓存和目录缓存采用懒加载+互斥锁保护,性能优良', '渲染分片机制限制了内存使用上限,避免了大图渲染的内存爆炸'] 4. 代码安全 🔒评价: 优秀 ✅ 通过
安全漏洞详情: 建议: ['URI 安全处理设计优秀:allowedUri() 仅允许 http/https/mailto 协议,显式拒绝 file://、javascript:、data: 等危险协议', '外部 URI 打开前通过 SecurityDialog 确认,防止恶意链接自动打开', 'resolveNavigationUri() 使用 StrictMode 解析并二次验证,防止 URI 注入', '渲染函数对画布边界、步长限制、光栅字节上限均有校验,防止缓冲区溢出', '所有 rofd 资源使用 unique_ptr + 自定义删除器管理,无资源泄漏风险', 'size_t 到 int 转换均有 numeric_limits 上限检查,防止整数溢出'] 💡 改进建议代码示例// 暂无代码示例本报告由 AI 代码审查工具自动生成 |
47e45fa to
7ced724
Compare
The big-image task split pages into 1000px-wide tiles without clamping the last tile to the actual page width. Pages whose width was not a multiple of 1000 produced out-of-canvas requests that the OFD document model rejects, leaving the right edge unpainted. The magnifier (getImagePoint) could also request rects beyond the canvas near page edges; intersect the rect with the canvas first. 大图任务按1000px分片时末尾未截断到页面实际宽度,页宽非1000整数倍 时越界请求被OFD文档模型拒绝,页面右侧无法绘制;放大镜在页边悬停 时同样可能越界,先与整页画布求交集。 Log: 修复OFD分片越界导致页面右侧渲染缺失 Influence: OFD文档大图分片与放大镜渲染不再产生越界请求,页面右侧不再缺失。
docs/superpowers 目录为开发过程中的临时设计记录与计划文档, 不符合项目正式文档规范,按维护要求整体移除。相关设计说明由 代码注释与 rofd 仓库文档承载。 Log: 移除不规范的docs/superpowers目录 Influence: 仅删除开发期文档,不影响编译、功能与打包。
7ced724 to
ce3b75d
Compare
|
/merge |
Summary
将
ofd_support分支的 OFD 文档支持作为新功能整体进入 master,并包含渲染修复与文档清理。功能内容(基于 rofd C ABI)
feat(reader): add OFD document support via rofd C ABI)build: depend on distro librofd-ffi packages for OFD support)附加提交
fix(reader): clamp OFD render slices to page canvas:大图渲染任务按 1000px 分片时末尾分片未截断到页宽,导致OfdDocument::renderPage拒绝越界请求(OFD render region outside canvas);同时放大镜请求矩形收敛到画布内chore(docs): remove non-standard docs/superpowers directory:移除开发期临时设计文档目录(不规范),REUSE 检查恢复全绿依赖说明
rofd侧的诊断修复见 linuxdeepin/rofd#3(新增ROFD_DIAGNOSTIC_SINGULAR_TRANSFORMABI 常量),建议 rofd PR 先行合入。Checklist
reuse lint1953/1953 合规obj-tests,QT_QPA_PLATFORM=offscreen)Summary by Sourcery
Correct OFD page rendering near canvas boundaries and remove temporary development documentation.
Bug Fixes:
Documentation: