From e09baccf1dba860842f8baee65ff6ff27294d709 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 14 Sep 2026 10:31:39 +0800 Subject: [PATCH 1/2] fix(reader): clamp OFD render slices to page canvas MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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文档大图分片与放大镜渲染不再产生越界请求,页面右侧不再缺失。 --- reader/browser/BrowserPage.cpp | 12 ++++++++++-- reader/browser/PageRenderThread.cpp | 7 ++++--- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/reader/browser/BrowserPage.cpp b/reader/browser/BrowserPage.cpp index 2df1063f7..05122aadb 100644 --- a/reader/browser/BrowserPage.cpp +++ b/reader/browser/BrowserPage.cpp @@ -564,8 +564,16 @@ QImage BrowserPage::getImagePoint(double scaleFactor, QPoint point) int ss = static_cast(122 * scaleFactor / m_scaleFactor); - QRect rect = QRect(qRound(point.x() * scaleFactor / m_scaleFactor - ss / 2.0), - qRound(point.y() * scaleFactor / m_scaleFactor - ss / 2.0), ss, ss); + // 悬停点靠近页面边缘时,请求矩形可能超出整页画布; + // 文档模型拒绝越界渲染请求,需先与画布求交集(与 getImage 的取整方式保持一致) + const QRect canvas(0, 0, static_cast(m_originSizeF.width() * scaleFactor), + static_cast(m_originSizeF.height() * scaleFactor)); + const QRect rect = QRect(qRound(point.x() * scaleFactor / m_scaleFactor - ss / 2.0), + qRound(point.y() * scaleFactor / m_scaleFactor - ss / 2.0), ss, ss) + .intersected(canvas); + + if (rect.isEmpty()) + return QImage(); return m_sheet->renderer()->getImage(itemIndex(), static_cast(m_originSizeF.width() * scaleFactor), diff --git a/reader/browser/PageRenderThread.cpp b/reader/browser/PageRenderThread.cpp index 3bcb3c7bb..6dcdfb043 100644 --- a/reader/browser/PageRenderThread.cpp +++ b/reader/browser/PageRenderThread.cpp @@ -362,9 +362,10 @@ void PageRenderThread::run() //if has signature,render whole rect renderRects.append(task.rect); } else { - int wCount = task.rect.width() % 1000 == 0 ? (task.rect.width() / 1000) : (task.rect.width() / 1000 + 1); - for (int i = 0; i < wCount; ++i) {//只能以宽度前进(即只能分割宽度),如果x从0开始,每次都将消耗一定时间 - renderRects.append(QRect(i * 1000, 0, 1000, task.rect.height())); + // 末尾分片须截断到页面实际宽度,否则越界请求会被文档模型拒绝, + // 页面右侧会因取到空图而残留未绘制区域 + for (int i = 0; i < task.rect.width(); i += 1000) {//只能以宽度前进(即只能分割宽度),如果x从0开始,每次都将消耗一定时间 + renderRects.append(QRect(i, 0, qMin(1000, task.rect.width() - i), task.rect.height())); }; } From 4cbcc61a32ec587863fa08cc96f7cd8caf37cc23 Mon Sep 17 00:00:00 2001 From: zhanghongyuan Date: Mon, 14 Sep 2026 11:16:51 +0800 Subject: [PATCH 2/2] chore(reuse): cover docs/ directory in dep5 for license-check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ofd_support branch added four OFD design docs under docs/ without copyright or licensing declarations, which made the license-check workflow fail on every PR touching this branch. Add a dep5 entry covering docs/ with GPL-3.0-or-later, consistent with the source tree. ofd_support 分支在 docs/ 下新增了四个 OFD 设计文档,缺少版权与 许可声明,导致 license-check 流水线对所有 PR 都会失败。在 dep5 中补充 docs/ 条目,与源码目录一致使用 GPL-3.0-or-later。 Log: 补充docs目录REUSE声明修复流水线license-check失败 Influence: 仓库通过REUSE 3.3合规检查,docs目录许可与源码一致。 --- .reuse/dep5 | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.reuse/dep5 b/.reuse/dep5 index 72360531a..4d1fd6085 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -86,3 +86,8 @@ License: BSD-3-Clause Files: htmltopdf/* Copyright: UnionTech Software Technology Co., Ltd. License: GPL-3.0-or-later + +# docs +Files: docs/* +Copyright: UnionTech Software Technology Co., Ltd. +License: GPL-3.0-or-later