diff options
author | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-02-03 16:18:20 +0100 |
---|---|---|
committer | Jarek Kobus <jaroslaw.kobus@qt.io> | 2020-02-28 08:57:57 +0100 |
commit | 1ba46c9b632731d7d7e791de2b203d0d933245b9 (patch) | |
tree | a7933031bde57f582181c2e9c185989ebdbb9470 /src/gui/image | |
parent | d2068b24e4b2e96832af154d02e19b5333880c21 (diff) |
Get rid of QMatrix
Task-number: QTBUG-81628
Change-Id: Iad66bfdf49b9ee65558a451108c086fc40dc3884
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
Diffstat (limited to 'src/gui/image')
-rw-r--r-- | src/gui/image/qbitmap.cpp | 14 | ||||
-rw-r--r-- | src/gui/image/qbitmap.h | 4 | ||||
-rw-r--r-- | src/gui/image/qimage.cpp | 60 | ||||
-rw-r--r-- | src/gui/image/qimage.h | 7 | ||||
-rw-r--r-- | src/gui/image/qpicture.cpp | 10 | ||||
-rw-r--r-- | src/gui/image/qpixmap.cpp | 41 | ||||
-rw-r--r-- | src/gui/image/qpixmap.h | 6 |
7 files changed, 7 insertions, 135 deletions
diff --git a/src/gui/image/qbitmap.cpp b/src/gui/image/qbitmap.cpp index a44f7151b1..88af4073c8 100644 --- a/src/gui/image/qbitmap.cpp +++ b/src/gui/image/qbitmap.cpp @@ -310,18 +310,4 @@ QBitmap QBitmap::transformed(const QTransform &matrix) const return bm; } -#if QT_DEPRECATED_SINCE(5, 13) -/*! - \overload - \obsolete - - This convenience function converts the \a matrix to a QTransform - and calls the overloaded function. -*/ -QBitmap QBitmap::transformed(const QMatrix &matrix) const -{ - return transformed(QTransform(matrix)); -} -#endif - QT_END_NAMESPACE diff --git a/src/gui/image/qbitmap.h b/src/gui/image/qbitmap.h index 3cc360f670..2bdfa73bdf 100644 --- a/src/gui/image/qbitmap.h +++ b/src/gui/image/qbitmap.h @@ -76,10 +76,6 @@ public: static QBitmap fromData(const QSize &size, const uchar *bits, QImage::Format monoFormat = QImage::Format_MonoLSB); -#if QT_DEPRECATED_SINCE(5, 13) - QT_DEPRECATED_X("Use QBitmap::transformed(QTransform) instead") - QBitmap transformed(const QMatrix &) const; -#endif QBitmap transformed(const QTransform &matrix) const; typedef QExplicitlySharedDataPointer<QPlatformPixmap> DataPtr; diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index 684051786d..1406683b97 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -43,7 +43,6 @@ #include "qdatastream.h" #include "qcolortransform.h" #include "qmap.h" -#include "qmatrix.h" #include "qtransform.h" #include "qimagereader.h" #include "qimagewriter.h" @@ -2856,65 +2855,6 @@ QImage QImage::scaledToHeight(int h, Qt::TransformationMode mode) const return transformed(wm, mode); } - -#if QT_DEPRECATED_SINCE(5, 15) - -/*! - \obsolete - - Use trueMatrix(const QTransform &matrix, int w, int h) instead. - - \fn QMatrix QImage::trueMatrix(const QMatrix &matrix, int width, int height) - - Returns the actual matrix used for transforming an image with the - given \a width, \a height and \a matrix. - - When transforming an image using the transformed() function, the - transformation matrix is internally adjusted to compensate for - unwanted translation, i.e. transformed() returns the smallest - image containing all transformed points of the original image. - This function returns the modified matrix, which maps points - correctly from the original image into the new image. - - \sa transformed(), {QImage#Image Transformations}{Image - Transformations} -*/ -QMatrix QImage::trueMatrix(const QMatrix &matrix, int w, int h) -{ - return trueMatrix(QTransform(matrix), w, h).toAffine(); -} - -/*! - \obsolete - - Use transformed(const QTransform &matrix, Qt::TransformationMode mode) instead. - - Returns a copy of the image that is transformed using the given - transformation \a matrix and transformation \a mode. - - The returned image will normally have the same {Image Formats}{format} as - the original image. However, a complex transformation may result in an - image where not all pixels are covered by the transformed pixels of the - original image. In such cases, those background pixels will be assigned a - transparent color value, and the transformed image will be given a format - with an alpha channel, even if the orginal image did not have that. - - The transformation \a matrix is internally adjusted to compensate - for unwanted translation; i.e. the image produced is the smallest - image that contains all the transformed points of the original - image. Use the trueMatrix() function to retrieve the actual matrix - used for transforming an image. - - \sa trueMatrix(), {QImage#Image Transformations}{Image - Transformations} -*/ -QImage QImage::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const -{ - return transformed(QTransform(matrix), mode); -} - -#endif // QT_DEPRECATED_SINCE(5, 15) - /*! Builds and returns a 1-bpp mask from the alpha buffer in this image. Returns a null image if the image's format is diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 5a1524b419..df8d2729ef 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -60,7 +60,6 @@ QT_BEGIN_NAMESPACE class QColorSpace; class QColorTransform; class QIODevice; -class QMatrix; class QStringList; class QTransform; class QVariant; @@ -247,12 +246,6 @@ public: Qt::TransformationMode mode = Qt::FastTransformation) const; QImage scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; QImage scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_X("Use transformed(const QTransform &matrix, Qt::TransformationMode mode)") - QImage transformed(const QMatrix &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; - QT_DEPRECATED_X("trueMatrix(const QTransform &, int w, int h)") - static QMatrix trueMatrix(const QMatrix &, int w, int h); -#endif // QT_DEPRECATED_SINCE(5, 15) QImage transformed(const QTransform &matrix, Qt::TransformationMode mode = Qt::FastTransformation) const; static QTransform trueMatrix(const QTransform &, int w, int h); QImage mirrored(bool horizontally = false, bool vertically = true) const & diff --git a/src/gui/image/qpicture.cpp b/src/gui/image/qpicture.cpp index d469ac8aae..73c97f4436 100644 --- a/src/gui/image/qpicture.cpp +++ b/src/gui/image/qpicture.cpp @@ -465,7 +465,7 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) QPen pen; QBrush brush; QRegion rgn; - QMatrix wmatrix; + qreal wmatrix[6]; QTransform matrix; QTransform worldMatrix = painter->transform(); @@ -820,8 +820,12 @@ bool QPicture::exec(QPainter *painter, QDataStream &s, int nrecords) if (d->formatMajor >= 8) { s >> matrix >> i_8; } else { - s >> wmatrix >> i_8; - matrix = QTransform(wmatrix); + s >> wmatrix[0] >> wmatrix[1] + >> wmatrix[2] >> wmatrix[3] + >> wmatrix[4] >> wmatrix[5] >> i_8; + matrix = QTransform(wmatrix[0], wmatrix[1], + wmatrix[2], wmatrix[3], + wmatrix[4], wmatrix[5]); } // i_8 is always false due to updateXForm() in qpaintengine_pic.cpp painter->setTransform(matrix * worldMatrix, i_8); diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 269f236ecd..c162b706cb 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -458,24 +458,6 @@ QTransform QPixmap::trueMatrix(const QTransform &m, int w, int h) return QImage::trueMatrix(m, w, h); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \obsolete - - Use trueMatrix(const QTransform &m, int w, int h) instead. - - This convenience function loads the matrix \a m into a - QTransform and calls the overloaded function with the - QTransform and the width \a w and the height \a h. - */ -QMatrix QPixmap::trueMatrix(const QMatrix &m, int w, int h) -{ - return trueMatrix(QTransform(m), w, h).toAffine(); -} -#endif // QT_DEPRECATED_SINCE(5, 15) - - /*! \fn bool QPixmap::isQBitmap() const @@ -1238,29 +1220,6 @@ QPixmap QPixmap::transformed(const QTransform &transform, return data->transformed(transform, mode); } -#if QT_DEPRECATED_SINCE(5, 15) -/*! - \overload - \obsolete - - Use transformed(const QTransform &transform, Qt::TransformationMode mode)() instead. - - This convenience function loads the \a matrix into a - QTransform and calls the overloaded function. - */ -QPixmap QPixmap::transformed(const QMatrix &matrix, Qt::TransformationMode mode) const -{ - return transformed(QTransform(matrix), mode); -} -#endif // QT_DEPRECATED_SINCE(5, 15) - - - - - - - - /*! \class QPixmap \inmodule QtGui diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index e47a9fe59e..2708d267b9 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -129,12 +129,6 @@ public: Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap scaledToWidth(int w, Qt::TransformationMode mode = Qt::FastTransformation) const; QPixmap scaledToHeight(int h, Qt::TransformationMode mode = Qt::FastTransformation) const; -#if QT_DEPRECATED_SINCE(5, 15) - QT_DEPRECATED_X("Use transformed(const QTransform &, Qt::TransformationMode mode)") - QPixmap transformed(const QMatrix &, Qt::TransformationMode mode = Qt::FastTransformation) const; - QT_DEPRECATED_X("Use trueMatrix(const QTransform &m, int w, int h)") - static QMatrix trueMatrix(const QMatrix &m, int w, int h); -#endif // QT_DEPRECATED_SINCE(5, 15) QPixmap transformed(const QTransform &, Qt::TransformationMode mode = Qt::FastTransformation) const; static QTransform trueMatrix(const QTransform &m, int w, int h); |