mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Page prefetching, bugfixing
This commit is contained in:
@@ -633,6 +633,12 @@ void PDFViewerMainWindow::updateUI(bool fullUpdate)
|
||||
if (!currentPages.empty())
|
||||
{
|
||||
m_pageNumberSpinBox->setValue(currentPages.front() + 1);
|
||||
|
||||
// Prefetch pages, if it is enabled
|
||||
if (m_settings->isPagePrefetchingEnabled())
|
||||
{
|
||||
m_pdfWidget->getDrawWidgetProxy()->prefetchPages(currentPages.back());
|
||||
}
|
||||
}
|
||||
|
||||
m_sidebarWidget->setCurrentPages(currentPages);
|
||||
|
@@ -36,6 +36,7 @@ void PDFViewerSettings::readSettings(QSettings& settings)
|
||||
m_settings.m_rendererEngine = static_cast<pdf::RendererEngine>(settings.value("renderingEngine", static_cast<int>(pdf::RendererEngine::OpenGL)).toInt());
|
||||
m_settings.m_multisampleAntialiasing = settings.value("msaa", defaultSettings.m_multisampleAntialiasing).toBool();
|
||||
m_settings.m_rendererSamples = settings.value("rendererSamples", defaultSettings.m_rendererSamples).toInt();
|
||||
m_settings.m_prefetchPages = settings.value("prefetchPages", defaultSettings.m_prefetchPages).toBool();
|
||||
m_settings.m_preferredMeshResolutionRatio = settings.value("preferredMeshResolutionRatio", defaultSettings.m_preferredMeshResolutionRatio).toDouble();
|
||||
m_settings.m_minimalMeshResolutionRatio = settings.value("minimalMeshResolutionRatio", defaultSettings.m_minimalMeshResolutionRatio).toDouble();
|
||||
m_settings.m_colorTolerance = settings.value("colorTolerance", defaultSettings.m_colorTolerance).toDouble();
|
||||
@@ -54,6 +55,7 @@ void PDFViewerSettings::writeSettings(QSettings& settings)
|
||||
settings.setValue("renderingEngine", static_cast<int>(m_settings.m_rendererEngine));
|
||||
settings.setValue("msaa", m_settings.m_multisampleAntialiasing);
|
||||
settings.setValue("rendererSamples", m_settings.m_rendererSamples);
|
||||
settings.setValue("prefetchPages", m_settings.m_prefetchPages);
|
||||
settings.setValue("preferredMeshResolutionRatio", m_settings.m_preferredMeshResolutionRatio);
|
||||
settings.setValue("minimalMeshResolutionRatio", m_settings.m_minimalMeshResolutionRatio);
|
||||
settings.setValue("colorTolerance", m_settings.m_colorTolerance);
|
||||
|
@@ -43,6 +43,7 @@ public:
|
||||
m_rendererEngine(pdf::RendererEngine::OpenGL),
|
||||
m_multisampleAntialiasing(true),
|
||||
m_rendererSamples(16),
|
||||
m_prefetchPages(true),
|
||||
m_preferredMeshResolutionRatio(0.02),
|
||||
m_minimalMeshResolutionRatio(0.005),
|
||||
m_colorTolerance(0.01),
|
||||
@@ -57,6 +58,7 @@ public:
|
||||
pdf::RendererEngine m_rendererEngine;
|
||||
bool m_multisampleAntialiasing;
|
||||
int m_rendererSamples;
|
||||
bool m_prefetchPages;
|
||||
pdf::PDFReal m_preferredMeshResolutionRatio;
|
||||
pdf::PDFReal m_minimalMeshResolutionRatio;
|
||||
pdf::PDFReal m_colorTolerance;
|
||||
@@ -82,6 +84,7 @@ public:
|
||||
int getRendererSamples() const;
|
||||
void setRendererSamples(int rendererSamples);
|
||||
|
||||
bool isPagePrefetchingEnabled() const { return m_settings.m_prefetchPages; }
|
||||
bool isMultisampleAntialiasingEnabled() const { return m_settings.m_multisampleAntialiasing; }
|
||||
|
||||
pdf::PDFReal getPreferredMeshResolutionRatio() const { return m_settings.m_preferredMeshResolutionRatio; }
|
||||
|
@@ -133,6 +133,7 @@ void PDFViewerSettingsDialog::loadData()
|
||||
ui->multisampleAntialiasingSamplesCountComboBox->setEnabled(false);
|
||||
ui->multisampleAntialiasingSamplesCountComboBox->setCurrentIndex(-1);
|
||||
}
|
||||
ui->prefetchPagesCheckBox->setChecked(m_settings.m_prefetchPages);
|
||||
|
||||
// Rendering
|
||||
ui->antialiasingCheckBox->setChecked(m_settings.m_features.testFlag(pdf::PDFRenderer::Antialiasing));
|
||||
@@ -173,6 +174,10 @@ void PDFViewerSettingsDialog::saveData()
|
||||
{
|
||||
m_settings.m_rendererSamples = ui->multisampleAntialiasingSamplesCountComboBox->currentData().toInt();
|
||||
}
|
||||
else if (sender == ui->prefetchPagesCheckBox)
|
||||
{
|
||||
m_settings.m_prefetchPages = ui->prefetchPagesCheckBox->isChecked();
|
||||
}
|
||||
else if (sender == ui->antialiasingCheckBox)
|
||||
{
|
||||
m_settings.m_features.setFlag(pdf::PDFRenderer::Antialiasing, ui->antialiasingCheckBox->isChecked());
|
||||
|
@@ -26,7 +26,7 @@
|
||||
<item>
|
||||
<widget class="QStackedWidget" name="stackedWidget">
|
||||
<property name="currentIndex">
|
||||
<number>1</number>
|
||||
<number>0</number>
|
||||
</property>
|
||||
<widget class="QWidget" name="enginePage">
|
||||
<layout class="QVBoxLayout" name="enginePageLayout">
|
||||
@@ -50,16 +50,6 @@
|
||||
<layout class="QVBoxLayout" name="engineSettingsGroupBoxLayout">
|
||||
<item>
|
||||
<layout class="QGridLayout" name="engineSettingsGridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="renderingEngineLabel">
|
||||
<property name="text">
|
||||
<string>Rendering engine</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="renderingEngineComboBox"/>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QCheckBox" name="multisampleAntialiasingCheckBox">
|
||||
<property name="text">
|
||||
@@ -84,12 +74,36 @@
|
||||
<item row="2" column="1">
|
||||
<widget class="QComboBox" name="multisampleAntialiasingSamplesCountComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="renderingEngineComboBox"/>
|
||||
</item>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="renderingEngineLabel">
|
||||
<property name="text">
|
||||
<string>Rendering engine</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="0">
|
||||
<widget class="QLabel" name="prefetchPagesLabel">
|
||||
<property name="text">
|
||||
<string>Prefetch pages</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QCheckBox" name="prefetchPagesCheckBox">
|
||||
<property name="text">
|
||||
<string>Enable</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="engineInfoLabel">
|
||||
<property name="text">
|
||||
<string><html><head/><body><p>Select rendering method according to your needs. <span style=" font-weight:600;">Software rendering</span> is much slower than hardware accelerated rendering using <span style=" font-weight:600;">OpenGL rendering</span>, but it works when OpenGL is not available at your platform. OpenGL rendering is selected as default and is recommended.</p><p>OpenGL rendering uses<span style=" font-weight:600;"> multisample antialiasing (MSAA)</span>, which provides good quality antialiasing. You can turn this feature on or off, but without antialiasing, bad quality image can occur. Samples count affect how much samples per pixel are considered to determine pixel color. It can be a value 1, 2, 4, 8, and 16. Most modern GPUs support at least value 8. Lower this value, if your GPU doesn't support the desired sample count.</p></body></html></string>
|
||||
<string><html><head/><body><p>Select rendering method according to your needs. <span style=" font-weight:600;">Software rendering</span> is much slower than hardware accelerated rendering using <span style=" font-weight:600;">OpenGL rendering</span>, but it works when OpenGL is not available at your platform. OpenGL rendering is selected as default and is recommended.</p><p>OpenGL rendering uses<span style=" font-weight:600;"> multisample antialiasing (MSAA)</span>, which provides good quality antialiasing. You can turn this feature on or off, but without antialiasing, bad quality image can occur. Samples count affect how much samples per pixel are considered to determine pixel color. It can be a value 1, 2, 4, 8, and 16. Most modern GPUs support at least value 8. Lower this value, if your GPU doesn't support the desired sample count.</p><p><span style=" font-weight:600;">Prefetch pages </span>prefetches (pre-renders) pages next to currently viewed pages, to avoid flickering during scrolling. Prefetched pages are stored in the page cache.</p></body></html></string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
|
Reference in New Issue
Block a user