Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 10 additions & 2 deletions reader/browser/BrowserPage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,16 @@ QImage BrowserPage::getImagePoint(double scaleFactor, QPoint point)

int ss = static_cast<int>(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<int>(m_originSizeF.width() * scaleFactor),
static_cast<int>(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<int>(m_originSizeF.width() * scaleFactor),
Expand Down
7 changes: 4 additions & 3 deletions reader/browser/PageRenderThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
};
}

Expand Down
Loading