mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Settings of cache size
This commit is contained in:
@ -92,6 +92,11 @@ void PDFAsynchronousPageCompiler::reset()
|
||||
start();
|
||||
}
|
||||
|
||||
void PDFAsynchronousPageCompiler::setCacheLimit(int limit)
|
||||
{
|
||||
m_cache.setMaxCost(limit);
|
||||
}
|
||||
|
||||
const PDFPrecompiledPage* PDFAsynchronousPageCompiler::getCompiledPage(PDFInteger pageIndex, bool compile)
|
||||
{
|
||||
if (m_state != State::Active || !m_proxy->getDocument())
|
||||
@ -112,6 +117,7 @@ const PDFPrecompiledPage* PDFAsynchronousPageCompiler::getCompiledPage(PDFIntege
|
||||
return compiledPage;
|
||||
};
|
||||
|
||||
m_proxy->getFontCache()->setCacheShrinkEnabled(false);
|
||||
CompileTask& task = m_tasks[pageIndex];
|
||||
task.taskFuture = QtConcurrent::run(compilePage);
|
||||
task.taskWatcher = new QFutureWatcher<PDFPrecompiledPage>(this);
|
||||
@ -160,6 +166,9 @@ void PDFAsynchronousPageCompiler::onPageCompiled()
|
||||
}
|
||||
}
|
||||
|
||||
// We allow font cache shrinking, when we aren't doing something in parallel.
|
||||
m_proxy->getFontCache()->setCacheShrinkEnabled(m_tasks.empty());
|
||||
|
||||
if (!compiledPages.empty())
|
||||
{
|
||||
Q_ASSERT(std::is_sorted(compiledPages.cbegin(), compiledPages.cend()));
|
||||
|
Reference in New Issue
Block a user