mirror of
https://github.com/JakubMelka/PDF4QT.git
synced 2025-06-05 21:59:17 +02:00
Issue #123: Alternative software rendering backend
This commit is contained in:
@@ -24,7 +24,6 @@
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
QGuiApplication a(argc, argv);
|
||||
QGuiApplication::setAttribute(Qt::AA_DontCheckOpenGLContextThreadAffinity, true);
|
||||
QCoreApplication::setOrganizationName("MelkaJ");
|
||||
QCoreApplication::setApplicationName("PdfTool");
|
||||
QCoreApplication::setApplicationVersion(pdf::PDF_LIBRARY_VERSION);
|
||||
|
@@ -847,12 +847,12 @@ PDFToolOptions PDFToolAbstractApplication::getOptions(QCommandLineParser* parser
|
||||
}
|
||||
}
|
||||
|
||||
QString textValue = parser->value("render-hw-accel");
|
||||
QString textValue = parser->value("render-software");
|
||||
bool ok = false;
|
||||
bool value = textValue.toInt(&ok);
|
||||
if (ok)
|
||||
{
|
||||
options.renderUseHardwareRendering = value;
|
||||
options.renderUseSoftwareRendering = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@@ -135,7 +135,7 @@ struct PDFToolOptions
|
||||
|
||||
// For option 'RenderFlags'
|
||||
pdf::PDFRenderer::Features renderFeatures = pdf::PDFRenderer::getDefaultFeatures();
|
||||
bool renderUseHardwareRendering = true;
|
||||
bool renderUseSoftwareRendering = true;
|
||||
bool renderShowPageStatistics = false;
|
||||
int renderMSAAsamples = 4;
|
||||
int renderRasterizerCount = pdf::PDFRasterizerPool::getDefaultRasterizerCount();
|
||||
|
@@ -180,21 +180,11 @@ int PDFToolRenderBase::execute(const PDFToolOptions& options)
|
||||
fontCache.setDocument(md);
|
||||
fontCache.setCacheShrinkEnabled(nullptr, false);
|
||||
|
||||
QSurfaceFormat surfaceFormat;
|
||||
if (options.renderUseHardwareRendering)
|
||||
{
|
||||
surfaceFormat = QSurfaceFormat::defaultFormat();
|
||||
surfaceFormat.setProfile(QSurfaceFormat::CoreProfile);
|
||||
surfaceFormat.setSamples(options.renderMSAAsamples);
|
||||
surfaceFormat.setColorSpace(QColorSpace(QColorSpace::SRgb));
|
||||
surfaceFormat.setSwapBehavior(QSurfaceFormat::DefaultSwapBehavior);
|
||||
}
|
||||
|
||||
m_pageInfo.resize(document.getCatalog()->getPageCount());
|
||||
pdf::PDFRasterizerPool rasterizerPool(&document, &fontCache, &cmsManager,
|
||||
&optionalContentActivity, options.renderFeatures, meshQualitySettings,
|
||||
pdf::PDFRasterizerPool::getCorrectedRasterizerCount(options.renderRasterizerCount),
|
||||
options.renderUseHardwareRendering, surfaceFormat, nullptr);
|
||||
options.renderUseSoftwareRendering ? pdf::RendererEngine::QPainter : pdf::RendererEngine::Blend2D, nullptr);
|
||||
|
||||
auto onRenderError = [this](pdf::PDFInteger pageIndex, pdf::PDFRenderError error)
|
||||
{
|
||||
|
Reference in New Issue
Block a user