Commit e2f78d04 authored by Volker Krause's avatar Volker Krause
Browse files

Ensure we are always dealing with positive aspect rations

Fixes barcode detection in some GWR PDF tickets.
parent 1ae9d49c
......@@ -53,7 +53,7 @@ void PdfExtractorOutputDevice::drawImage(GfxState* state, Object* ref, Stream* s
pdfImg.d->m_height = height;
// deal with aspect-ratio changing scaling
const auto sourceAspectRatio = (double)width / (double)height;
const auto targetAspectRatio = state->getCTM()[0] / -state->getCTM()[3];
const auto targetAspectRatio = std::abs(state->getCTM()[0] / -state->getCTM()[3]);
if (!qFuzzyCompare(sourceAspectRatio, targetAspectRatio) && qFuzzyIsNull(state->getCTM()[1]) && qFuzzyIsNull(state->getCTM()[2])) {
if (targetAspectRatio > sourceAspectRatio) {
pdfImg.d->m_width = width * targetAspectRatio / sourceAspectRatio;
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment