more performance optimizations + cleanup
This commit is contained in:
15 files changed
+396
-469
No files matched your search
@@ -37,7 +37,7 @@ QVariant ReadingModel::data(const QModelIndex &index, int role) const
|
||||
if (!index.isValid() || !m_isTextMode || index.row() < 0 || index.row() >= m_chunks.size())
|
||||
return {};
|
||||
if (role == ContentRole)
|
||||
return m_chunks.at(index.row());
|
||||
return m_chunks.at(index.row()).sectionHref;
|
||||
if (role == LayoutRole && index.row() < m_chunks.size()) {
|
||||
ensureChunkLayout(index.row());
|
||||
return QVariant::fromValue(m_chunkLayouts.at(index.row()));
|
||||
@@ -310,8 +310,8 @@ void ReadingModel::startLayoutMeasurement(int restoreChunk, qreal restoreIntraOf
|
||||
// Phase 2: Compute remaining chunks in the background
|
||||
QPointer<ReadingModel> self(this);
|
||||
m_layoutFuture = QtConcurrent::run([self, generation, chunks, params, resolver, startIdx, endIdx]() {
|
||||
auto prepared = QtConcurrent::blockingMapped(chunks, [params, resolver](const QString &chunkHtml) {
|
||||
return ChunkLayoutEngine::prepareChunk(chunkHtml, params.fontSize, resolver);
|
||||
auto prepared = QtConcurrent::blockingMapped(chunks, [params, resolver](const ContentChunk &chunk) {
|
||||
return ChunkLayoutEngine::prepareChunk(chunk, params.fontSize, resolver);
|
||||
});
|
||||
|
||||
if (!self || self->m_layoutGeneration != generation)
|
||||
|
||||
Reference in new issue
Block a user