MCPcopy Create free account
hub / github.com/OpenOrienteering/mapper / fixPenForPdf

Function fixPenForPdf

src/core/renderables/renderable_implementation.cpp:72–86  ·  view source on GitHub ↗

* 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

Source from the content-addressed store, hash-verified

70 * Upstream issue: QTBUG-52641
71 */
72inline 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

Callers 1

renderMethod · 0.85

Calls 2

miterLimitMethod · 0.80
typeMethod · 0.45

Tested by

no test coverage detected