diff options
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qbezier.cpp | 55 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine_raster.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qpathclipper.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qpdf.cpp | 16 | ||||
-rw-r--r-- | src/gui/painting/qpdf_p.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpdfwriter.cpp | 4 |
6 files changed, 26 insertions, 70 deletions
diff --git a/src/gui/painting/qbezier.cpp b/src/gui/painting/qbezier.cpp index 6cef7cc501..2762560da7 100644 --- a/src/gui/painting/qbezier.cpp +++ b/src/gui/painting/qbezier.cpp @@ -150,33 +150,6 @@ static inline int quadraticRoots(qreal a, qreal b, qreal c, } } -static inline bool findInflections(qreal a, qreal b, qreal c, - qreal *t1 , qreal *t2, qreal *tCups) -{ - qreal r1 = 0, r2 = 0; - - short rootsCount = quadraticRoots(a, b, c, &r1, &r2); - - if (rootsCount >= 1) { - if (r1 < r2) { - *t1 = r1; - *t2 = r2; - } else { - *t1 = r2; - *t2 = r1; - } - if (!qFuzzyIsNull(a)) - *tCups = qreal(0.5) * (-b / a); - else - *tCups = 2; - - return true; - } - - return false; -} - - void QBezier::addToPolygon(QPolygonF *polygon, qreal bezier_flattening_threshold) const { QBezier beziers[10]; @@ -531,34 +504,6 @@ static QDebug operator<<(QDebug dbg, const QBezier &bz) } #endif -static inline void splitBezierAt(const QBezier &bez, qreal t, - QBezier *left, QBezier *right) -{ - left->x1 = bez.x1; - left->y1 = bez.y1; - - left->x2 = bez.x1 + t * ( bez.x2 - bez.x1 ); - left->y2 = bez.y1 + t * ( bez.y2 - bez.y1 ); - - left->x3 = bez.x2 + t * ( bez.x3 - bez.x2 ); // temporary holding spot - left->y3 = bez.y2 + t * ( bez.y3 - bez.y2 ); // temporary holding spot - - right->x3 = bez.x3 + t * ( bez.x4 - bez.x3 ); - right->y3 = bez.y3 + t * ( bez.y4 - bez.y3 ); - - right->x2 = left->x3 + t * ( right->x3 - left->x3); - right->y2 = left->y3 + t * ( right->y3 - left->y3); - - left->x3 = left->x2 + t * ( left->x3 - left->x2 ); - left->y3 = left->y2 + t * ( left->y3 - left->y2 ); - - left->x4 = right->x1 = left->x3 + t * (right->x2 - left->x3); - left->y4 = right->y1 = left->y3 + t * (right->y2 - left->y3); - - right->x4 = bez.x4; - right->y4 = bez.y4; -} - qreal QBezier::length(qreal error) const { qreal length = qreal(0.0); diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 66a4a43cba..d1e9b81faa 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -3327,10 +3327,16 @@ bool QRasterPaintEngine::requiresPretransformedGlyphPositions(QFontEngine *fontE bool QRasterPaintEngine::shouldDrawCachedGlyphs(QFontEngine *fontEngine, const QTransform &m) const { + // The raster engine does not support projected cached glyph drawing + if (m.type() >= QTransform::TxProject) + return false; + // The font engine might not support filling the glyph cache // with the given transform applied, in which case we need to - // fall back to the QPainterPath code-path. - if (!fontEngine->supportsTransformation(m)) + // fall back to the QPainterPath code-path. This does not apply + // for engines with internal caching, as we don't use the engine + // to fill up our cache in that case. + if (!fontEngine->hasInternalCaching() && !fontEngine->supportsTransformation(m)) return false; return QPaintEngineEx::shouldDrawCachedGlyphs(fontEngine, m); diff --git a/src/gui/painting/qpathclipper.cpp b/src/gui/painting/qpathclipper.cpp index 2702b56e73..243c99e671 100644 --- a/src/gui/painting/qpathclipper.cpp +++ b/src/gui/painting/qpathclipper.cpp @@ -1036,16 +1036,6 @@ qreal QWingedEdge::delta(int vertex, int a, int b) const return result; } -static inline QPointF midPoint(const QWingedEdge &list, int ei) -{ - const QPathEdge *ep = list.edge(ei); - Q_ASSERT(ep); - - const QPointF a = *list.vertex(ep->first); - const QPointF b = *list.vertex(ep->second); - return a + 0.5 * (b - a); -} - QWingedEdge::TraversalStatus QWingedEdge::findInsertStatus(int vi, int ei) const { const QPathVertex *vp = vertex(vi); diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 345ebefea7..9105e8b396 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -1469,7 +1469,12 @@ int QPdfEngine::metric(QPaintDevice::PaintDeviceMetric metricType) const return val; } +static inline QSizeF pageSizeToPostScriptPoints(const QSizeF &pageSizeMM) +{ #define Q_MM(n) int((n * 720 + 127) / 254) + return QSizeF(Q_MM(pageSizeMM.width()), Q_MM(pageSizeMM.height())); +#undef Q_MM +} QPdfEnginePrivate::QPdfEnginePrivate() : clipEnabled(false), allClipped(false), hasPen(true), hasBrush(false), simplePen(false), @@ -1477,7 +1482,7 @@ QPdfEnginePrivate::QPdfEnginePrivate() fullPage(false), embedFonts(true), landscape(false), grayscale(false), - paperSize(Q_MM(210), Q_MM(297)), // A4 + paperSize(pageSizeToPostScriptPoints(QSizeF(210, 297))), // A4 leftMargin(10), topMargin(10), rightMargin(10), bottomMargin(10) // ~3.5 mm { resolution = 1200; @@ -1491,6 +1496,11 @@ QPdfEnginePrivate::QPdfEnginePrivate() stream = new QDataStream; } +void QPdfEnginePrivate::setPaperSize(const QSizeF &pageSizeMM) +{ + paperSize = pageSizeToPostScriptPoints(pageSizeMM); +} + bool QPdfEngine::begin(QPaintDevice *pdev) { Q_D(QPdfEngine); @@ -2518,6 +2528,10 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) qreal size = ti.fontEngine->fontDef.pixelSize; +#if defined(Q_OS_WIN) + size = (ti.fontEngine->ascent() + ti.fontEngine->descent()).toReal(); +#endif + QVarLengthArray<glyph_t> glyphs; QVarLengthArray<QFixedPoint> positions; QTransform m = QTransform::fromTranslate(p.x(), p.y()); diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 560621775b..54530d0f78 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -226,6 +226,7 @@ public: QRect paperRect() const; QRect pageRect() const; + void setPaperSize(const QSizeF &pageSizeMM); int width() const { QRect r = paperRect(); diff --git a/src/gui/painting/qpdfwriter.cpp b/src/gui/painting/qpdfwriter.cpp index 136654cb5d..a783aad66a 100644 --- a/src/gui/painting/qpdfwriter.cpp +++ b/src/gui/painting/qpdfwriter.cpp @@ -166,7 +166,7 @@ void QPdfWriter::setPageSize(PageSize size) Q_D(const QPdfWriter); QPagedPaintDevice::setPageSize(size); - d->engine->d_func()->paperSize = pageSizeMM() * 25.4/72.; + d->engine->d_func()->setPaperSize(pageSizeMM()); } /*! @@ -177,7 +177,7 @@ void QPdfWriter::setPageSizeMM(const QSizeF &size) Q_D(const QPdfWriter); QPagedPaintDevice::setPageSizeMM(size); - d->engine->d_func()->paperSize = pageSizeMM() * 25.4/72.; + d->engine->d_func()->setPaperSize(pageSizeMM()); } /*! |