* When painting to a PDF engine, the miter limit must be adjusted from Qt's * concept to PDF's concept. This should be done in the PDF engine, but this * isn't the case. This may even result in PDF files which are considered * invalid by Reader & Co. * * The PDF miter limit could be precalculated for the Mapper use cases, but * this optimization would be lost when Qt gets fixed. * * Upst
| 70 | * Upstream issue: QTBUG-52641 |
| 71 | */ |
| 72 | inline void fixPenForPdf(QPen& pen, const QPainter& painter) |
| 73 | { |
| 74 | #ifdef QT_PRINTSUPPORT_LIB |
| 75 | auto engine = painter.paintEngine()->type(); |
| 76 | if (Q_UNLIKELY(engine == QPaintEngine::Pdf |
| 77 | || engine == AdvancedPdfPrinter::paintEngineType())) |
| 78 | { |
| 79 | const auto miter_limit = pen.miterLimit(); |
| 80 | pen.setMiterLimit(qSqrt(1.0 + miter_limit * miter_limit * 4)); |
| 81 | } |
| 82 | #else |
| 83 | Q_UNUSED(pen) |
| 84 | Q_UNUSED(painter) |
| 85 | #endif |
| 86 | } |
| 87 | |
| 88 | } // namespace |
| 89 |
no test coverage detected