diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-19 23:06:18 (GMT) |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2009-08-19 23:06:18 (GMT) |
commit | 6858ce448718db1cc7c76535cac82672ad1d7664 (patch) | |
tree | aaf5f9dbf0131cca2f0fc6a50c8fb32a666d777f /src/gui | |
parent | feabd6584880c775a516d157c9cd24f0e707060d (diff) | |
download | Qt-6858ce448718db1cc7c76535cac82672ad1d7664.zip Qt-6858ce448718db1cc7c76535cac82672ad1d7664.tar.gz Qt-6858ce448718db1cc7c76535cac82672ad1d7664.tar.bz2 |
Remove QGraphicsTransform::project()
QMatrix4x4::toTransform() now does what project() used to do.
Reviewed-by: trustme
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/graphicsview/qgraphicsitem_p.h | 2 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicstransform.cpp | 31 | ||||
-rw-r--r-- | src/gui/graphicsview/qgraphicstransform.h | 2 |
3 files changed, 2 insertions, 33 deletions
diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 38cb757..eedc4a3 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -507,7 +507,7 @@ struct QGraphicsItemPrivate::TransformData x.rotate(rotation, 0, 0, 1); x.scale(scale); x.translate(-xOrigin, -yOrigin); - QTransform t = QGraphicsTransform::project(x); + QTransform t = x.toTransform(); // project the 3D matrix back to 2D. if (postmultiplyTransform) t *= *postmultiplyTransform; return t; diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp index b486438..585e0f9 100644 --- a/src/gui/graphicsview/qgraphicstransform.cpp +++ b/src/gui/graphicsview/qgraphicstransform.cpp @@ -149,38 +149,9 @@ QGraphicsTransform::QGraphicsTransform(QGraphicsTransformPrivate &p, QObject *pa It applies this transformation to \a matrix. - \sa QGraphicsItem::transform(), project() + \sa QGraphicsItem::transform(), QMatrix4x4::toTransform() */ -static const qreal inv_dist_to_plane = 1. / 1024.; - -/*! - Projects \a matrix into a 2D transformation that has the same - effect as applying \a matrix and then projecting the co-ordinates - to two dimensions. - - \sa applyTo() -*/ -QTransform QGraphicsTransform::project(const QMatrix4x4& matrix) -{ - // The following projection matrix is pre-multiplied with "matrix": - // | 1 0 0 0 | - // | 0 1 0 0 | - // | 0 0 1 0 | - // | 0 0 d 1 | - // where d = -1 / 1024. This projection is consistent with the - // Qt::XAxis and Qt::YAxis rotations of QTransform::rotate(). - // After projection, row 3 and column 3 are dropped to form - // the final QTransform. - return QTransform - (matrix(0, 0), matrix(1, 0), - matrix(3, 0) - matrix(2, 0) * inv_dist_to_plane, - matrix(0, 1), matrix(1, 1), - matrix(3, 1) - matrix(2, 1) * inv_dist_to_plane, - matrix(0, 3), matrix(1, 3), - matrix(3, 3) - matrix(2, 3) * inv_dist_to_plane); -} - /*! Notifies that this transform operation has changed its parameters in such a way that applyTo() will return a different result than before. diff --git a/src/gui/graphicsview/qgraphicstransform.h b/src/gui/graphicsview/qgraphicstransform.h index 8ffcbbb..d6d5b79 100644 --- a/src/gui/graphicsview/qgraphicstransform.h +++ b/src/gui/graphicsview/qgraphicstransform.h @@ -65,8 +65,6 @@ public: virtual void applyTo(QMatrix4x4 *matrix) const = 0; - static QTransform project(const QMatrix4x4& matrix); - protected Q_SLOTS: void update(); |