diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2019-07-11 23:38:47 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2019-07-18 12:06:46 +0200 |
commit | a7de860cfd3f86fb8df8795e0322f67fd04c4ef0 (patch) | |
tree | 13409df9e862f67bd4579352d34ad3a0820bb74e /src/gui/image/qmovie.cpp | |
parent | 8abef0277797724b153cb08c11bf498efc6d460d (diff) |
QMovie: move-enable QFrameInfo
All users of the QPixmap ctor can pass rvalues, so take by rvalue-ref
and move into place. Adapt callers to actually pass rvalues.
Change-Id: Iacff2ed893ceaa1665b270ce466ffdc21ba800f1
Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src/gui/image/qmovie.cpp')
-rw-r--r-- | src/gui/image/qmovie.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/gui/image/qmovie.cpp b/src/gui/image/qmovie.cpp index 4b588527ae..3e975115ab 100644 --- a/src/gui/image/qmovie.cpp +++ b/src/gui/image/qmovie.cpp @@ -207,8 +207,8 @@ public: : pixmap(QPixmap()), delay(QMOVIE_INVALID_DELAY), endMark(false) { } - inline QFrameInfo(const QPixmap &pixmap, int delay) - : pixmap(pixmap), delay(delay), endMark(false) + inline QFrameInfo(QPixmap &&pixmap, int delay) + : pixmap(std::move(pixmap)), delay(delay), endMark(false) { } inline bool isValid() @@ -222,6 +222,7 @@ public: static inline QFrameInfo endMarker() { return QFrameInfo(true); } }; +Q_DECLARE_TYPEINFO(QFrameInfo, Q_MOVABLE_TYPE); class QMoviePrivate : public QObjectPrivate { @@ -380,9 +381,7 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber) } if (frameNumber > greatestFrameNumber) greatestFrameNumber = frameNumber; - QPixmap aPixmap = QPixmap::fromImage(std::move(anImage)); - int aDelay = reader->nextImageDelay(); - return QFrameInfo(aPixmap, aDelay); + return QFrameInfo(QPixmap::fromImage(std::move(anImage)), reader->nextImageDelay()); } else if (frameNumber != 0) { // We've read all frames now. Return an end marker haveReadAll = true; @@ -406,9 +405,7 @@ QFrameInfo QMoviePrivate::infoForFrame(int frameNumber) return QFrameInfo(); // Invalid } greatestFrameNumber = i; - QPixmap aPixmap = QPixmap::fromImage(std::move(anImage)); - int aDelay = reader->nextImageDelay(); - QFrameInfo info(aPixmap, aDelay); + QFrameInfo info(QPixmap::fromImage(std::move(anImage)), reader->nextImageDelay()); // Cache it! frameMap.insert(i, info); if (i == frameNumber) { |