Bugfixing

This commit is contained in:
Jakub Melka 2020-10-28 17:25:42 +01:00
parent 3c512d0e98
commit b6d29f0b03
4 changed files with 16 additions and 5 deletions

View File

@ -492,7 +492,7 @@ int PDFRasterizerPool::getDefaultRasterizerCount()
int PDFRasterizerPool::getCorrectedRasterizerCount(int rasterizerCount)
{
return qBound(1, rasterizerCount, 16);
return qBound(1, rasterizerCount, 256);
}
PDFImageWriterSettings::PDFImageWriterSettings()

View File

@ -288,6 +288,7 @@ void PDFToolAbstractApplication::initializeCommandLineParser(QCommandLineParser*
}
parser->addOption(QCommandLineOption("render-hw-accel", "Use hardware acceleration (using GPU).", "bool", "1"));
parser->addOption(QCommandLineOption("render-show-page-stat", "Show page rendering statistics."));
parser->addOption(QCommandLineOption("render-msaa-samples", "MSAA sample count for GPU rendering.", "samples", "4"));
parser->addOption(QCommandLineOption("render-rasterizers", "Number of rasterizer contexts.", "rasterizers", QString::number(pdf::PDFRasterizerPool::getDefaultRasterizerCount())));
}
@ -616,7 +617,7 @@ PDFToolOptions PDFToolAbstractApplication::getOptions(QCommandLineParser* parser
PDFConsole::writeError(PDFToolTranslationContext::tr("Dpi must be in range from %1 to %2. Defaulting to %3.").arg(pdf::PDFPageImageExportSettings::getMinDPIResolution()).arg(pdf::PDFPageImageExportSettings::getMaxDPIResolution()).arg(boundedDpi), options.outputCodec);
}
options.imageExportSettings.setDpiResolution(dpi);
options.imageExportSettings.setDpiResolution(boundedDpi);
}
else
{
@ -642,7 +643,7 @@ PDFToolOptions PDFToolAbstractApplication::getOptions(QCommandLineParser* parser
PDFConsole::writeError(PDFToolTranslationContext::tr("Pixel value must be in range from %1 to %2. Defaulting to %3.").arg(pdf::PDFPageImageExportSettings::getMinPixelResolution()).arg(pdf::PDFPageImageExportSettings::getMaxPixelResolution()).arg(boundedPixel), options.outputCodec);
}
options.imageExportSettings.setPixelResolution(pixel);
options.imageExportSettings.setPixelResolution(boundedPixel);
}
else
{
@ -794,6 +795,8 @@ PDFToolOptions PDFToolAbstractApplication::getOptions(QCommandLineParser* parser
PDFConsole::writeError(PDFToolTranslationContext::tr("Invalid raterizer count: %1. Correcting to use %2 rasterizers.").arg(options.renderRasterizerCount).arg(correctedRasterizerCount), options.outputCodec);
options.renderRasterizerCount = correctedRasterizerCount;
}
options.renderShowPageStatistics = parser->isSet("render-show-page-stat");
}
return options;

View File

@ -125,6 +125,7 @@ struct PDFToolOptions
// For option 'RenderFlags'
pdf::PDFRenderer::Features renderFeatures = pdf::PDFRenderer::getDefaultFeatures();
bool renderUseHardwareRendering = true;
bool renderShowPageStatistics = false;
int renderMSAAsamples = 4;
int renderRasterizerCount = pdf::PDFRasterizerPool::getDefaultRasterizerCount();

View File

@ -60,6 +60,10 @@ void PDFToolRender::finish(const PDFToolOptions& options)
formatter.endl();
writeStatistics(formatter);
if (options.renderShowPageStatistics)
{
writePageStatistics(formatter);
}
writeErrors(formatter);
formatter.endDocument();
@ -123,7 +127,10 @@ void PDFToolBenchmark::finish(const PDFToolOptions& options)
formatter.endl();
writeStatistics(formatter);
if (options.renderShowPageStatistics)
{
writePageStatistics(formatter);
}
writeErrors(formatter);
formatter.endDocument();
@ -351,7 +358,7 @@ void PDFToolRenderBase::writePageStatistics(PDFOutputFormatter& formatter)
formatter.writeTableColumn("compile-time", locale.toString(info.pageCompileTime), Qt::AlignRight);
formatter.writeTableColumn("render-time", locale.toString(info.pageRenderTime), Qt::AlignRight);
formatter.writeTableColumn("wait-time", locale.toString(info.pageWaitTime), Qt::AlignRight);
formatter.writeTableColumn("write-time", locale.toString(info.pageWaitTime), Qt::AlignRight);
formatter.writeTableColumn("write-time", locale.toString(info.pageWriteTime), Qt::AlignRight);
formatter.writeTableColumn("total-time", locale.toString(info.pageTotalTime), Qt::AlignRight);
formatter.endTableRow();
}