diff options
author | Allan Sandfeld Jensen <allan.jensen@digia.com> | 2013-12-17 14:20:46 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-01-02 18:40:11 +0100 |
commit | d5d6e0cf9917c36a93668189014f584e533fc1b9 (patch) | |
tree | f4b3ae477ac137010c50655148ad1f80da48b9c5 /src/gui/image/qpixmap.h | |
parent | c2e2e0151e51b5870f41c993d4c7f3a3c16e5405 (diff) |
RValue ref version of QPixmap::fromImage()
When converting from a temporary image we can use inplace conversion
since we don't have to worry about changes made to the original.
This should give a speedup in several places where QPixmaps are made
from
the return values of methods returning QImages.
Change-Id: I1835bcf3fc061c4dbbb3d0507ec84178dc49b29b
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/gui/image/qpixmap.h')
-rw-r--r-- | src/gui/image/qpixmap.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h index f1fce03c80..0efd606283 100644 --- a/src/gui/image/qpixmap.h +++ b/src/gui/image/qpixmap.h @@ -131,6 +131,12 @@ public: QImage toImage() const; static QPixmap fromImage(const QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); static QPixmap fromImageReader(QImageReader *imageReader, Qt::ImageConversionFlags flags = Qt::AutoColor); +#ifdef Q_COMPILER_RVALUE_REFS + static QPixmap fromImage(QImage &&image, Qt::ImageConversionFlags flags = Qt::AutoColor) + { + return fromImageInPlace(image, flags); + } +#endif bool load(const QString& fileName, const char *format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); bool loadFromData(const uchar *buf, uint len, const char* format = 0, Qt::ImageConversionFlags flags = Qt::AutoColor); @@ -167,6 +173,7 @@ public: protected: int metric(PaintDeviceMetric) const; + static QPixmap fromImageInPlace(QImage &image, Qt::ImageConversionFlags flags = Qt::AutoColor); private: QExplicitlySharedDataPointer<QPlatformPixmap> data; |