diff options
author | Simon Hausmann <simon.hausmann@qt.io> | 2020-01-28 18:27:28 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@qt.io> | 2020-01-28 18:27:28 +0100 |
commit | a4ea0d9eacd574a6a96f70b138dcb111e9d11d21 (patch) | |
tree | 3c6439e1c9007e20bb0e8665cdba36c675b4a78f /src/gui/painting | |
parent | ef442327b8a4122fe46462e95a0537ec5ac53cb6 (diff) | |
parent | 6c3eb39832876a65291546476b92fd94950b1208 (diff) | |
download | qtbase-a4ea0d9eacd574a6a96f70b138dcb111e9d11d21.tar.gz |
Merge remote-tracking branch 'origin/5.15' into dev
Change-Id: Ia5727ce68001bcaab467f5fae3a4933d1217015f
Diffstat (limited to 'src/gui/painting')
-rw-r--r-- | src/gui/painting/qbrush.cpp | 10 | ||||
-rw-r--r-- | src/gui/painting/qbrush.h | 9 | ||||
-rw-r--r-- | src/gui/painting/qmatrix.cpp | 3 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine.cpp | 2 | ||||
-rw-r--r-- | src/gui/painting/qpaintengine.h | 4 | ||||
-rw-r--r-- | src/gui/painting/qpainter.cpp | 8 | ||||
-rw-r--r-- | src/gui/painting/qpainter.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpainter_p.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.cpp | 16 | ||||
-rw-r--r-- | src/gui/painting/qpainterpath.h | 6 | ||||
-rw-r--r-- | src/gui/painting/qpdf_p.h | 1 | ||||
-rw-r--r-- | src/gui/painting/qpolygon.cpp | 18 | ||||
-rw-r--r-- | src/gui/painting/qregion.cpp | 3 | ||||
-rw-r--r-- | src/gui/painting/qtransform.cpp | 6 | ||||
-rw-r--r-- | src/gui/painting/qtransform.h | 4 |
15 files changed, 70 insertions, 22 deletions
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp index e84916e063..28cc20bfc5 100644 --- a/src/gui/painting/qbrush.cpp +++ b/src/gui/painting/qbrush.cpp @@ -893,8 +893,12 @@ bool QBrush::isOpaque() const } +#if QT_DEPRECATED_SINCE(5, 15) /*! \since 4.2 + \obsolete + + Use setTransform() instead. Sets \a matrix as an explicit transformation matrix on the current brush. The brush transformation matrix is merged with @@ -906,6 +910,7 @@ void QBrush::setMatrix(const QMatrix &matrix) { setTransform(QTransform(matrix)); } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! \since 4.3 @@ -923,14 +928,19 @@ void QBrush::setTransform(const QTransform &matrix) } +#if QT_DEPRECATED_SINCE(5, 15) /*! \fn void QBrush::matrix() const \since 4.2 + \obsolete + + Use transform() instead. Returns the current transformation matrix for the brush. \sa setMatrix() */ +#endif // QT_DEPRECATED_SINCE(5, 15) /*! \fn bool QBrush::operator!=(const QBrush &brush) const diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 1d7199782f..3a01248c57 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -89,8 +89,10 @@ public: inline Qt::BrushStyle style() const; void setStyle(Qt::BrushStyle); - inline const QMatrix &matrix() const; - void setMatrix(const QMatrix &mat); +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transform()") inline const QMatrix &matrix() const; + QT_DEPRECATED_X("Use setTransform()") void setMatrix(const QMatrix &mat); +#endif // QT_DEPRECATED_SINCE(5, 15) inline QTransform transform() const; void setTransform(const QTransform &); @@ -157,7 +159,10 @@ struct QBrushData inline Qt::BrushStyle QBrush::style() const { return d->style; } inline const QColor &QBrush::color() const { return d->color; } +#if QT_DEPRECATED_SINCE(5, 15) +QT_DEPRECATED_X("Use transform()") inline const QMatrix &QBrush::matrix() const { return d->transform.toAffine(); } +#endif // QT_DEPRECATED_SINCE(5, 15) inline QTransform QBrush::transform() const { return d->transform; } inline bool QBrush::isDetached() const { return d->ref.loadRelaxed() == 1; } diff --git a/src/gui/painting/qmatrix.cpp b/src/gui/painting/qmatrix.cpp index 890b0079de..7ebd2dbd09 100644 --- a/src/gui/painting/qmatrix.cpp +++ b/src/gui/painting/qmatrix.cpp @@ -45,6 +45,7 @@ #include "qregion.h" #include "qpainterpath.h" #include "qpainterpath_p.h" +#include "qtransform.h" #include "qvariant.h" #include <qmath.h> @@ -680,7 +681,7 @@ QRegion QMatrix::map(const QRegion &r) const } QPainterPath p = map(qt_regionToPath(r)); - return p.toFillPolygon().toPolygon(); + return p.toFillPolygon(QTransform()).toPolygon(); } /*! diff --git a/src/gui/painting/qpaintengine.cpp b/src/gui/painting/qpaintengine.cpp index 1785fcd12d..315bf0daf2 100644 --- a/src/gui/painting/qpaintengine.cpp +++ b/src/gui/painting/qpaintengine.cpp @@ -508,7 +508,7 @@ void QPaintEngine::drawEllipse(const QRectF &rect) if (hasFeature(PainterPaths)) { drawPath(path); } else { - QPolygonF polygon = path.toFillPolygon(); + QPolygonF polygon = path.toFillPolygon(QTransform()); drawPolygon(polygon.data(), polygon.size(), ConvexMode); } } diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 9fb67e253e..e90020dbbf 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -273,7 +273,9 @@ public: QBrush backgroundBrush() const; Qt::BGMode backgroundMode() const; QFont font() const; - QMatrix matrix() const; +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use transform()") QMatrix matrix() const; +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform transform() const; Qt::ClipOperation clipOperation() const; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index b0553a1ff9..390147463d 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -2555,19 +2555,19 @@ QRegion QPainter::clipRegion() const case QPainterClipInfo::PathClip: { QTransform matrix = (info.matrix * d->invMatrix); if (lastWasNothing) { - region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), + region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(), info.path.fillRule()); lastWasNothing = false; continue; } if (info.operation == Qt::IntersectClip) { - region &= QRegion((info.path * matrix).toFillPolygon().toPolygon(), + region &= QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(), info.path.fillRule()); } else if (info.operation == Qt::NoClip) { lastWasNothing = true; region = QRegion(); } else { - region = QRegion((info.path * matrix).toFillPolygon().toPolygon(), + region = QRegion((info.path * matrix).toFillPolygon(QTransform()).toPolygon(), info.path.fillRule()); } break; @@ -8089,6 +8089,8 @@ QFont QPaintEngineState::font() const \since 4.2 \obsolete + Use transform() instead. + Returns the matrix in the current paint engine state. diff --git a/src/gui/painting/qpainter.h b/src/gui/painting/qpainter.h index 3394da63c7..77c6504d2e 100644 --- a/src/gui/painting/qpainter.h +++ b/src/gui/painting/qpainter.h @@ -72,7 +72,6 @@ class QPen; class QPolygon; class QTextItem; class QTextEngine; -class QMatrix; class QTransform; class QStaticText; class QGlyphRun; diff --git a/src/gui/painting/qpainter_p.h b/src/gui/painting/qpainter_p.h index 285bd90502..dafd6e33be 100644 --- a/src/gui/painting/qpainter_p.h +++ b/src/gui/painting/qpainter_p.h @@ -59,7 +59,6 @@ #include "QtGui/qfont.h" #include "QtGui/qpen.h" #include "QtGui/qregion.h" -#include "QtGui/qmatrix.h" #include "QtGui/qpainter.h" #include "QtGui/qpainterpath.h" #include "QtGui/qpaintengine.h" diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 17d8b863ab..ab60afd9cd 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -1660,13 +1660,18 @@ QList<QPolygonF> QPainterPath::toSubpathPolygons(const QTransform &matrix) const return flatCurves; } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use toSubpathPolygons(const QTransform &matrix) instead. */ QList<QPolygonF> QPainterPath::toSubpathPolygons(const QMatrix &matrix) const { return toSubpathPolygons(QTransform(matrix)); } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Converts the path into a list of polygons using the @@ -1787,13 +1792,18 @@ QList<QPolygonF> QPainterPath::toFillPolygons(const QTransform &matrix) const return polys; } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use toFillPolygons(const QTransform &matrix) instead. */ QList<QPolygonF> QPainterPath::toFillPolygons(const QMatrix &matrix) const { return toFillPolygons(QTransform(matrix)); } +#endif // QT_DEPRECATED_SINCE(5, 15) //same as qt_polygon_isect_line in qpolygon.cpp static void qt_painterpath_isect_line(const QPointF &p1, @@ -2904,14 +2914,18 @@ QPolygonF QPainterPath::toFillPolygon(const QTransform &matrix) const return polygon; } +#if QT_DEPRECATED_SINCE(5, 15) /*! \overload + \obsolete + + Use toFillPolygon(const QTransform &matrix) instead. */ QPolygonF QPainterPath::toFillPolygon(const QMatrix &matrix) const { return toFillPolygon(QTransform(matrix)); } - +#endif // QT_DEPRECATED_SINCE(5, 15) //derivative of the equation static inline qreal slopeAt(qreal t, qreal a, qreal b, qreal c, qreal d) diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h index ed5be667b7..26b92dc6fa 100644 --- a/src/gui/painting/qpainterpath.h +++ b/src/gui/painting/qpainterpath.h @@ -175,9 +175,15 @@ public: bool isEmpty() const; Q_REQUIRED_RESULT QPainterPath toReversed() const; + +#if QT_DEPRECATED_SINCE(5, 15) + QT_DEPRECATED_X("Use toSubpathPolygons(const QTransform &)") QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const; + QT_DEPRECATED_X("Use toFillPolygons(const QTransform &") QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const; + QT_DEPRECATED_X("Use toFillPolygon(const QTransform &)") QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const; +#endif // QT_DEPRECATED_SINCE(5, 15) QList<QPolygonF> toSubpathPolygons(const QTransform &matrix) const; QList<QPolygonF> toFillPolygons(const QTransform &matrix) const; QPolygonF toFillPolygon(const QTransform &matrix) const; diff --git a/src/gui/painting/qpdf_p.h b/src/gui/painting/qpdf_p.h index 57d70db442..4ff540e67b 100644 --- a/src/gui/painting/qpdf_p.h +++ b/src/gui/painting/qpdf_p.h @@ -55,7 +55,6 @@ #ifndef QT_NO_PDF -#include "QtGui/qmatrix.h" #include "QtCore/qstring.h" #include "QtCore/qvector.h" #include "private/qstroker_p.h" diff --git a/src/gui/painting/qpolygon.cpp b/src/gui/painting/qpolygon.cpp index 20337477b7..4fe819cae0 100644 --- a/src/gui/painting/qpolygon.cpp +++ b/src/gui/painting/qpolygon.cpp @@ -40,9 +40,9 @@ #include "qpolygon.h" #include "qrect.h" #include "qdatastream.h" -#include "qmatrix.h" #include "qdebug.h" #include "qpainterpath.h" +#include "qtransform.h" #include "qvariant.h" #include "qpainterpath_p.h" #include "qbezier_p.h" @@ -111,7 +111,7 @@ static void qt_polygon_isect_line(const QPointF &p1, const QPointF &p2, const QP from a specified index (resizing the polygon if necessary). QPolygon provides the boundingRect() and translate() functions for - geometry functions. Use the QMatrix::map() function for more + geometry functions. Use the QTransform::map() function for more general transformations of QPolygons. The QPolygon class is \l {Implicit Data Sharing}{implicitly @@ -495,7 +495,7 @@ QDebug operator<<(QDebug dbg, const QPolygon &a) In addition to the functions provided by QVector, QPolygonF provides the boundingRect() and translate() functions for geometry - operations. Use the QMatrix::map() function for more general + operations. Use the QTransform::map() function for more general transformations of QPolygonFs. QPolygonF also provides the isClosed() function to determine @@ -899,7 +899,7 @@ QPolygon QPolygon::united(const QPolygon &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.united(clip).toFillPolygon().toPolygon(); + return subject.united(clip).toFillPolygon(QTransform()).toPolygon(); } /*! @@ -918,7 +918,7 @@ QPolygon QPolygon::intersected(const QPolygon &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.intersected(clip).toFillPolygon().toPolygon(); + return subject.intersected(clip).toFillPolygon(QTransform()).toPolygon(); } /*! @@ -936,7 +936,7 @@ QPolygon QPolygon::subtracted(const QPolygon &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.subtracted(clip).toFillPolygon().toPolygon(); + return subject.subtracted(clip).toFillPolygon(QTransform()).toPolygon(); } /*! @@ -975,7 +975,7 @@ QPolygonF QPolygonF::united(const QPolygonF &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.united(clip).toFillPolygon(); + return subject.united(clip).toFillPolygon(QTransform()); } /*! @@ -994,7 +994,7 @@ QPolygonF QPolygonF::intersected(const QPolygonF &r) const QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.intersected(clip).toFillPolygon(); + return subject.intersected(clip).toFillPolygon(QTransform()); } /*! @@ -1011,7 +1011,7 @@ QPolygonF QPolygonF::subtracted(const QPolygonF &r) const { QPainterPath subject; subject.addPolygon(*this); QPainterPath clip; clip.addPolygon(r); - return subject.subtracted(clip).toFillPolygon(); + return subject.subtracted(clip).toFillPolygon(QTransform()); } /*! diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 44ee038194..bac042c784 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -46,6 +46,7 @@ #include "qvarlengtharray.h" #include "qimage.h" #include "qbitmap.h" +#include "qtransform.h" #include <private/qdebug_p.h> @@ -3916,7 +3917,7 @@ QRegion::QRegion(const QRect &r, RegionType t) } else if (t == Ellipse) { QPainterPath path; path.addEllipse(r.x(), r.y(), r.width(), r.height()); - QPolygon a = path.toSubpathPolygons().at(0).toPolygon(); + QPolygon a = path.toSubpathPolygons(QTransform()).at(0).toPolygon(); d->qt_rgn = PolygonRegion(a.constData(), a.size(), EvenOddRule); } } diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp index 279a817ff1..9d8bb0c3e2 100644 --- a/src/gui/painting/qtransform.cpp +++ b/src/gui/painting/qtransform.cpp @@ -311,8 +311,10 @@ QTransform::QTransform(qreal h11, qreal h12, qreal h21, { } +#if QT_DEPRECATED_SINCE(5, 15) /*! \fn QTransform::QTransform(const QMatrix &matrix) + \obsolete Constructs a matrix that is a copy of the given \a matrix. Note that the \c m13, \c m23, and \c m33 elements are set to 0, 0, @@ -328,6 +330,7 @@ QTransform::QTransform(const QMatrix &mtx) #endif { } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Returns the adjoint of this matrix. @@ -2082,7 +2085,9 @@ void QTransform::map(int x, int y, int *tx, int *ty) const *ty = qRound(fy); } +#if QT_DEPRECATED_SINCE(5, 15) /*! + \obsolete Returns the QTransform as an affine matrix. \warning If a perspective transformation has been specified, @@ -2092,6 +2097,7 @@ const QMatrix &QTransform::toAffine() const { return affine; } +#endif // QT_DEPRECATED_SINCE(5, 15) /*! Returns the transformation type of this matrix. diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h index b2a634dd2a..485caa5140 100644 --- a/src/gui/painting/qtransform.h +++ b/src/gui/painting/qtransform.h @@ -73,7 +73,9 @@ public: qreal h31, qreal h32, qreal h33 = 1.0); QTransform(qreal h11, qreal h12, qreal h21, qreal h22, qreal dx, qreal dy); +#if QT_DEPRECATED_SINCE(5, 15) explicit QTransform(const QMatrix &mtx); +#endif // QT_DEPRECATED_SINCE(5, 15) #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) // ### Qt 6: remove; the compiler-generated ones are fine! @@ -158,7 +160,9 @@ public: void map(int x, int y, int *tx, int *ty) const; void map(qreal x, qreal y, qreal *tx, qreal *ty) const; +#if QT_DEPRECATED_SINCE(5, 15) const QMatrix &toAffine() const; +#endif // QT_DEPRECATED_SINCE(5, 15) QTransform &operator*=(qreal div); QTransform &operator/=(qreal div); |