summaryrefslogtreecommitdiffstats
path: root/src/gui/image
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/image')
-rw-r--r--src/gui/image/qicon.cpp2
-rw-r--r--src/gui/image/qicon.h12
-rw-r--r--src/gui/image/qimage.cpp16
-rw-r--r--src/gui/image/qimage.h9
-rw-r--r--src/gui/image/qimageiohandler.cpp37
-rw-r--r--src/gui/image/qimageiohandler.h19
-rw-r--r--src/gui/image/qimagereader.cpp63
-rw-r--r--src/gui/image/qimagereader.h5
-rw-r--r--src/gui/image/qimagewriter.cpp39
-rw-r--r--src/gui/image/qimagewriter.h3
-rw-r--r--src/gui/image/qjpeghandler.cpp122
-rw-r--r--src/gui/image/qpicture.h5
-rw-r--r--src/gui/image/qpixmap.h5
-rw-r--r--src/gui/image/qpixmap_win.cpp5
-rw-r--r--src/gui/image/qpnghandler.cpp7
15 files changed, 259 insertions, 90 deletions
diff --git a/src/gui/image/qicon.cpp b/src/gui/image/qicon.cpp
index 6d7a40c2ef..40ba84bb14 100644
--- a/src/gui/image/qicon.cpp
+++ b/src/gui/image/qicon.cpp
@@ -606,7 +606,7 @@ QFactoryLoader *qt_iconEngineFactoryLoader()
/*!
Constructs a null icon.
*/
-QIcon::QIcon()
+QIcon::QIcon() Q_DECL_NOEXCEPT
: d(0)
{
}
diff --git a/src/gui/image/qicon.h b/src/gui/image/qicon.h
index d87468b4f0..63e77eef99 100644
--- a/src/gui/image/qicon.h
+++ b/src/gui/image/qicon.h
@@ -51,22 +51,24 @@ public:
enum Mode { Normal, Disabled, Active, Selected };
enum State { On, Off };
- QIcon();
+ QIcon() Q_DECL_NOEXCEPT;
QIcon(const QPixmap &pixmap);
QIcon(const QIcon &other);
#ifdef Q_COMPILER_RVALUE_REFS
- QIcon(QIcon &&other)
- :d(0) { qSwap(d, other.d); }
+ QIcon(QIcon &&other) Q_DECL_NOEXCEPT
+ : d(0)
+ { qSwap(d, other.d); }
#endif
explicit QIcon(const QString &fileName); // file or resource name
explicit QIcon(QIconEngine *engine);
~QIcon();
QIcon &operator=(const QIcon &other);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QIcon &operator=(QIcon &&other)
+ inline QIcon &operator=(QIcon &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); return *this; }
#endif
- inline void swap(QIcon &other) { qSwap(d, other.d); }
+ inline void swap(QIcon &other) Q_DECL_NOEXCEPT
+ { qSwap(d, other.d); }
operator QVariant() const;
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 47d187fc0e..3c192a237e 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -738,7 +738,7 @@ bool QImageData::checkForAlphaPixels() const
\sa isNull()
*/
-QImage::QImage()
+QImage::QImage() Q_DECL_NOEXCEPT
: QPaintDevice()
{
d = 0;
@@ -5147,4 +5147,18 @@ QImage::Format QImage::toImageFormat(QPixelFormat format) Q_DECL_NOTHROW
return Format_Invalid;
}
+Q_GUI_EXPORT void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orient)
+{
+ if (orient == QImageIOHandler::TransformationNone)
+ return;
+ if (orient == QImageIOHandler::TransformationRotate270) {
+ src = rotated270(src);
+ } else {
+ src = qMove(src).mirrored(orient & QImageIOHandler::TransformationMirror,
+ orient & QImageIOHandler::TransformationFlip);
+ if (orient & QImageIOHandler::TransformationRotate90)
+ src = rotated90(src);
+ }
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h
index 0ccbab819f..26707021ea 100644
--- a/src/gui/image/qimage.h
+++ b/src/gui/image/qimage.h
@@ -122,7 +122,7 @@ public:
#endif
};
- QImage();
+ QImage() Q_DECL_NOEXCEPT;
QImage(const QSize &size, Format format);
QImage(int width, int height, Format format);
QImage(uchar *data, int width, int height, Format format, QImageCleanupFunction cleanupFunction = 0, void *cleanupInfo = 0);
@@ -137,7 +137,7 @@ public:
QImage(const QImage &);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QImage(QImage &&other)
+ inline QImage(QImage &&other) Q_DECL_NOEXCEPT
: QPaintDevice(), d(0)
{ qSwap(d, other.d); }
#endif
@@ -145,10 +145,11 @@ public:
QImage &operator=(const QImage &);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QImage &operator=(QImage &&other)
+ inline QImage &operator=(QImage &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); return *this; }
#endif
- inline void swap(QImage &other) { qSwap(d, other.d); }
+ inline void swap(QImage &other) Q_DECL_NOEXCEPT
+ { qSwap(d, other.d); }
bool isNull() const;
diff --git a/src/gui/image/qimageiohandler.cpp b/src/gui/image/qimageiohandler.cpp
index cc9a6ae2a1..22b4bcf560 100644
--- a/src/gui/image/qimageiohandler.cpp
+++ b/src/gui/image/qimageiohandler.cpp
@@ -159,6 +159,43 @@
\value ProgressiveScanWrite. A handler which supports
this option is expected to write the image as a progressive scan image.
+
+ \value ImageTransformation. A handler which supports this option can read
+ the transformation metadata of an image. A handler that supports this option
+ should not apply the transformation itself.
+
+ \value TransformedByDefault. A handler that reports support for this feature
+ will have image transformation metadata applied by default on read.
+*/
+
+/*! \enum QImageIOHandler::Transformation
+ \since 5.5
+
+ This enum describes the different transformations or orientations
+ supported by some image formats, usually through EXIF.
+
+ \value TransformationNone No transformation should be applied.
+
+ \value TransformationMirror Mirror the image horizontally.
+
+ \value TransformationFlip Mirror the image vertically.
+
+ \value TransformationRotate180 Rotate the image 180 degrees.
+ This is the same as mirroring it both horizontally and vertically.
+
+ \value TransformationRotate90 Rotate the image 90 degrees.
+
+ \value TransformationMirrorAndRotate90 Mirror the image horizontally
+ and then rotate it 90 degrees.
+
+ \value TransformationFlipAndRotate90 Mirror the image vertically
+ and then rotate it 90 degrees.
+
+ \value TransformationRotate270 Rotate the image 270 degrees.
+ This is the same as mirroring it both horizontally, vertically and
+ then rotating it 90 degrees.
+
+ \sa QImageReader::transformation(), QImageReader::setAutoTransform(), QImageWriter::setTransformation()
*/
/*!
diff --git a/src/gui/image/qimageiohandler.h b/src/gui/image/qimageiohandler.h
index b48226f619..80cd87c4c3 100644
--- a/src/gui/image/qimageiohandler.h
+++ b/src/gui/image/qimageiohandler.h
@@ -86,8 +86,25 @@ public:
ImageFormat,
SupportedSubTypes,
OptimizedWrite,
- ProgressiveScanWrite
+ ProgressiveScanWrite,
+ ImageTransformation
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ , TransformedByDefault
+#endif
};
+
+ enum Transformation {
+ TransformationNone = 0,
+ TransformationMirror = 1,
+ TransformationFlip = 2,
+ TransformationRotate180 = TransformationMirror | TransformationFlip,
+ TransformationRotate90 = 4,
+ TransformationMirrorAndRotate90 = TransformationMirror | TransformationRotate90,
+ TransformationFlipAndRotate90 = TransformationFlip | TransformationRotate90,
+ TransformationRotate270 = TransformationRotate180 | TransformationRotate90
+ };
+ Q_DECLARE_FLAGS(Transformations, Transformation)
+
virtual QVariant option(ImageOption option) const;
virtual void setOption(ImageOption option, const QVariant &value);
virtual bool supportsOption(ImageOption option) const;
diff --git a/src/gui/image/qimagereader.cpp b/src/gui/image/qimagereader.cpp
index c2795cc38d..ba79bf40e5 100644
--- a/src/gui/image/qimagereader.cpp
+++ b/src/gui/image/qimagereader.cpp
@@ -533,6 +533,11 @@ public:
int quality;
QMap<QString, QString> text;
void getText();
+ enum {
+ UsePluginDefault,
+ ApplyTransform,
+ DoNotApplyTransform
+ } autoTransform;
// error
QImageReader::ImageReaderError imageReaderError;
@@ -552,6 +557,7 @@ QImageReaderPrivate::QImageReaderPrivate(QImageReader *qq)
handler = 0;
quality = -1;
imageReaderError = QImageReader::UnknownError;
+ autoTransform = UsePluginDefault;
q = qq;
}
@@ -1144,6 +1150,59 @@ QList<QByteArray> QImageReader::supportedSubTypes() const
}
/*!
+ \since 5.5
+
+ Returns the transformation metadata of the image, including image orientation. If the format
+ does not support transformation metadata \c QImageIOHandler::Transformation_None is returned.
+
+ \sa setAutoTransform(), autoTransform()
+*/
+QImageIOHandler::Transformations QImageReader::transformation() const
+{
+ int option = QImageIOHandler::TransformationNone;
+ if (d->initHandler() && d->handler->supportsOption(QImageIOHandler::ImageTransformation))
+ option = d->handler->option(QImageIOHandler::ImageTransformation).toInt();
+ return QImageIOHandler::Transformations(option);
+}
+
+/*!
+ \since 5.5
+
+ Sets if images returned by read() should have transformation metadata automatically applied.
+
+ \sa autoTransform(), transform(), read()
+*/
+void QImageReader::setAutoTransform(bool enabled)
+{
+ d->autoTransform = enabled ? QImageReaderPrivate::ApplyTransform
+ : QImageReaderPrivate::DoNotApplyTransform;
+}
+
+/*!
+ \since 5.5
+
+ Returns \c true if the image handler will apply transformation metadata on read().
+
+ \sa setAutoTransform(), transformation(), read()
+*/
+bool QImageReader::autoTransform() const
+{
+ switch (d->autoTransform) {
+ case QImageReaderPrivate::ApplyTransform:
+ return true;
+ case QImageReaderPrivate::DoNotApplyTransform:
+ return false;
+ case QImageReaderPrivate::UsePluginDefault:
+ if (d->initHandler())
+ return d->handler->supportsOption(QImageIOHandler::TransformedByDefault);
+ // no break
+ default:
+ break;
+ }
+ return false;
+}
+
+/*!
Returns \c true if an image can be read for the device (i.e., the
image format is supported, and the device seems to contain valid
data); otherwise returns \c false.
@@ -1185,6 +1244,8 @@ QImage QImageReader::read()
return read(&image) ? image : QImage();
}
+extern void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orient);
+
/*!
\overload
@@ -1294,6 +1355,8 @@ bool QImageReader::read(QImage *image)
if (!disable2xImageLoading && QFileInfo(fileName()).baseName().endsWith(QLatin1String("@2x"))) {
image->setDevicePixelRatio(2.0);
}
+ if (autoTransform())
+ qt_imageTransform(*image, transformation());
return true;
}
diff --git a/src/gui/image/qimagereader.h b/src/gui/image/qimagereader.h
index 34191ed657..27a29bed49 100644
--- a/src/gui/image/qimagereader.h
+++ b/src/gui/image/qimagereader.h
@@ -105,6 +105,11 @@ public:
bool supportsAnimation() const;
+ QImageIOHandler::Transformations transformation() const;
+
+ void setAutoTransform(bool enabled);
+ bool autoTransform() const;
+
QByteArray subType() const;
QList<QByteArray> supportedSubTypes() const;
diff --git a/src/gui/image/qimagewriter.cpp b/src/gui/image/qimagewriter.cpp
index b418101163..e9de1db4b2 100644
--- a/src/gui/image/qimagewriter.cpp
+++ b/src/gui/image/qimagewriter.cpp
@@ -91,6 +91,7 @@
#include <qbytearray.h>
#include <qfile.h>
#include <qfileinfo.h>
+#include <qimage.h>
#include <qimageiohandler.h>
#include <qjsonarray.h>
#include <qset.h>
@@ -254,6 +255,7 @@ public:
QByteArray subType;
bool optimizedWrite;
bool progressiveScanWrite;
+ QImageIOHandler::Transformations transformation;
// error
QImageWriter::ImageWriterError imageWriterError;
@@ -277,6 +279,7 @@ QImageWriterPrivate::QImageWriterPrivate(QImageWriter *qq)
progressiveScanWrite = false;
imageWriterError = QImageWriter::UnknownError;
errorString = QImageWriter::tr("Unknown error");
+ transformation = QImageIOHandler::TransformationNone;
q = qq;
}
@@ -616,6 +619,33 @@ bool QImageWriter::progressiveScanWrite() const
}
/*!
+ \since 5.5
+
+ Sets the image transformations metadata including orientation.
+
+ If transformation metadata is not supported by the image format,
+ the transform is applied before writing.
+
+ \sa transformation(), write()
+*/
+void QImageWriter::setTransformation(QImageIOHandler::Transformations transform)
+{
+ d->transformation = transform;
+}
+
+/*!
+ \since 5.5
+
+ Returns the transformation and orientation the image has been set to written with.
+
+ \sa setTransformation()
+*/
+QImageIOHandler::Transformations QImageWriter::transformation() const
+{
+ return d->transformation;
+}
+
+/*!
\obsolete
Use setText() instead.
@@ -694,6 +724,8 @@ bool QImageWriter::canWrite() const
return d->canWriteHelper();
}
+extern void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orient);
+
/*!
Writes the image \a image to the assigned device or file
name. Returns \c true on success; otherwise returns \c false. If the
@@ -708,6 +740,7 @@ bool QImageWriter::write(const QImage &image)
if (!canWrite())
return false;
+ QImage img = image;
if (d->handler->supportsOption(QImageIOHandler::Quality))
d->handler->setOption(QImageIOHandler::Quality, d->quality);
if (d->handler->supportsOption(QImageIOHandler::CompressionRatio))
@@ -722,8 +755,12 @@ bool QImageWriter::write(const QImage &image)
d->handler->setOption(QImageIOHandler::OptimizedWrite, d->optimizedWrite);
if (d->handler->supportsOption(QImageIOHandler::ProgressiveScanWrite))
d->handler->setOption(QImageIOHandler::ProgressiveScanWrite, d->progressiveScanWrite);
+ if (d->handler->supportsOption(QImageIOHandler::ImageTransformation))
+ d->handler->setOption(QImageIOHandler::ImageTransformation, int(d->transformation));
+ else
+ qt_imageTransform(img, d->transformation);
- if (!d->handler->write(image))
+ if (!d->handler->write(img))
return false;
if (QFile *file = qobject_cast<QFile *>(d->device))
file->flush();
diff --git a/src/gui/image/qimagewriter.h b/src/gui/image/qimagewriter.h
index 96d8f51b3a..7f92595c53 100644
--- a/src/gui/image/qimagewriter.h
+++ b/src/gui/image/qimagewriter.h
@@ -89,6 +89,9 @@ public:
void setProgressiveScanWrite(bool progressive);
bool progressiveScanWrite() const;
+ QImageIOHandler::Transformations transformation() const;
+ void setTransformation(QImageIOHandler::Transformations orientation);
+
// Obsolete as of 4.1
void setDescription(const QString &description);
QString description() const;
diff --git a/src/gui/image/qjpeghandler.cpp b/src/gui/image/qjpeghandler.cpp
index 839f90f17c..4ff3917fe6 100644
--- a/src/gui/image/qjpeghandler.cpp
+++ b/src/gui/image/qjpeghandler.cpp
@@ -714,7 +714,7 @@ public:
};
QJpegHandlerPrivate(QJpegHandler *qq)
- : quality(75), exifOrientation(1), iod_src(0),
+ : quality(75), transformation(QImageIOHandler::TransformationNone), iod_src(0),
rgb888ToRgb32ConverterPtr(qt_convert_rgb888_to_rgb32), state(Ready), optimize(false), progressive(false), q(qq)
{}
@@ -730,10 +730,9 @@ public:
bool readJpegHeader(QIODevice*);
bool read(QImage *image);
- void applyExifOrientation(QImage *image);
int quality;
- int exifOrientation;
+ QImageIOHandler::Transformations transformation;
QVariant size;
QImage::Format format;
QSize scaledSize;
@@ -761,9 +760,8 @@ static bool readExifHeader(QDataStream &stream)
char prefix[6];
if (stream.readRawData(prefix, sizeof(prefix)) != sizeof(prefix))
return false;
- if (prefix[0] != 'E' || prefix[1] != 'x' || prefix[2] != 'i' || prefix[3] != 'f' || prefix[4] != 0 || prefix[5] != 0)
- return false;
- return true;
+ static const char exifMagic[6] = {'E', 'x', 'i', 'f', 0, 0};
+ return memcmp(prefix, exifMagic, 6) == 0;
}
/*
@@ -787,6 +785,7 @@ static int getExifOrientation(QByteArray &exifData)
quint16 val;
quint32 offset;
+ const qint64 headerStart = stream.device()->pos();
// read byte order marker
stream >> val;
@@ -803,20 +802,20 @@ static int getExifOrientation(QByteArray &exifData)
return -1;
stream >> offset;
- // we have already used 8 bytes of TIFF header
- offset -= 8;
// read IFD
while (!stream.atEnd()) {
quint16 numEntries;
// skip offset bytes to get the next IFD
- if (stream.skipRawData(offset) != (qint32)offset)
+ const qint64 bytesToSkip = offset - (stream.device()->pos() - headerStart);
+
+ if (stream.skipRawData(bytesToSkip) != bytesToSkip)
return -1;
stream >> numEntries;
- for (;numEntries > 0; --numEntries) {
+ for (; numEntries > 0; --numEntries) {
quint16 tag;
quint16 type;
quint32 components;
@@ -825,7 +824,7 @@ static int getExifOrientation(QByteArray &exifData)
stream >> tag >> type >> components >> value >> dummy;
if (tag == 0x0112) { // Tag Exif.Image.Orientation
- if (components !=1)
+ if (components != 1)
return -1;
if (type != 3) // we are expecting it to be an unsigned short
return -1;
@@ -847,6 +846,31 @@ static int getExifOrientation(QByteArray &exifData)
// No Exif orientation was found
return 0;
}
+
+static QImageIOHandler::Transformations exif2Qt(int exifOrientation)
+{
+ switch (exifOrientation) {
+ case 1: // normal
+ return QImageIOHandler::TransformationNone;
+ case 2: // mirror horizontal
+ return QImageIOHandler::TransformationMirror;
+ case 3: // rotate 180
+ return QImageIOHandler::TransformationRotate180;
+ case 4: // mirror vertical
+ return QImageIOHandler::TransformationFlip;
+ case 5: // mirror horizontal and rotate 270 CW
+ return QImageIOHandler::TransformationFlipAndRotate90;
+ case 6: // rotate 90 CW
+ return QImageIOHandler::TransformationRotate90;
+ case 7: // mirror horizontal and rotate 90 CW
+ return QImageIOHandler::TransformationMirrorAndRotate90;
+ case 8: // rotate 270 CW
+ return QImageIOHandler::TransformationRotate270;
+ }
+ qWarning("Invalid EXIF orientation");
+ return QImageIOHandler::TransformationNone;
+}
+
/*!
\internal
*/
@@ -866,7 +890,7 @@ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
if (!setjmp(err.setjmp_buffer)) {
jpeg_save_markers(&info, JPEG_COM, 0xFFFF);
- jpeg_save_markers(&info, JPEG_APP0+1, 0xFFFF); // Exif uses APP1 marker
+ jpeg_save_markers(&info, JPEG_APP0 + 1, 0xFFFF); // Exif uses APP1 marker
(void) jpeg_read_header(&info, TRUE);
@@ -897,16 +921,18 @@ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
description += key + QLatin1String(": ") + value.simplified();
readTexts.append(key);
readTexts.append(value);
- } else if (marker->marker == JPEG_APP0+1) {
+ } else if (marker->marker == JPEG_APP0 + 1) {
exifData.append((const char*)marker->data, marker->data_length);
}
}
- if (exifData.size()) {
+ if (!exifData.isEmpty()) {
// Exif data present
- int orientation = getExifOrientation(exifData);
- if (orientation > 0)
- exifOrientation = orientation;
+ int exifOrientation = getExifOrientation(exifData);
+ if (exifOrientation == -1)
+ return false;
+ if (exifOrientation > 0)
+ transformation = exif2Qt(exifOrientation);
}
state = ReadHeader;
@@ -922,48 +948,6 @@ bool QJpegHandlerPrivate::readJpegHeader(QIODevice *device)
return true;
}
-void QJpegHandlerPrivate::applyExifOrientation(QImage *image)
-{
- // This is not an optimized implementation, but easiest to maintain
- QTransform transform;
-
- switch (exifOrientation) {
- case 1: // normal
- break;
- case 2: // mirror horizontal
- *image = image->mirrored(true, false);
- break;
- case 3: // rotate 180
- transform.rotate(180);
- *image = image->transformed(transform);
- break;
- case 4: // mirror vertical
- *image = image->mirrored(false, true);
- break;
- case 5: // mirror horizontal and rotate 270 CCW
- *image = image->mirrored(true, false);
- transform.rotate(270);
- *image = image->transformed(transform);
- break;
- case 6: // rotate 90 CW
- transform.rotate(90);
- *image = image->transformed(transform);
- break;
- case 7: // mirror horizontal and rotate 90 CW
- *image = image->mirrored(true, false);
- transform.rotate(90);
- *image = image->transformed(transform);
- break;
- case 8: // rotate 270 CW
- transform.rotate(-90);
- *image = image->transformed(transform);
- break;
- default:
- qWarning("This should never happen");
- }
- exifOrientation = 1;
-}
-
bool QJpegHandlerPrivate::read(QImage *image)
{
if(state == Ready)
@@ -975,7 +959,6 @@ bool QJpegHandlerPrivate::read(QImage *image)
if (success) {
for (int i = 0; i < readTexts.size()-1; i+=2)
image->setText(readTexts.at(i), readTexts.at(i+1));
- applyExifOrientation(image);
state = Ready;
return true;
@@ -1053,8 +1036,16 @@ bool QJpegHandler::read(QImage *image)
return d->read(image);
}
+extern void qt_imageTransform(QImage &src, QImageIOHandler::Transformations orient);
+
bool QJpegHandler::write(const QImage &image)
{
+ if (d->transformation != QImageIOHandler::TransformationNone) {
+ // We don't support writing EXIF headers so apply the transform to the data.
+ QImage img = image;
+ qt_imageTransform(img, d->transformation);
+ return write_jpeg_image(img, device(), d->quality, d->description, d->optimize, d->progressive);
+ }
return write_jpeg_image(image, device(), d->quality, d->description, d->optimize, d->progressive);
}
@@ -1068,7 +1059,8 @@ bool QJpegHandler::supportsOption(ImageOption option) const
|| option == Size
|| option == ImageFormat
|| option == OptimizedWrite
- || option == ProgressiveScanWrite;
+ || option == ProgressiveScanWrite
+ || option == ImageTransformation;
}
QVariant QJpegHandler::option(ImageOption option) const
@@ -1095,6 +1087,9 @@ QVariant QJpegHandler::option(ImageOption option) const
return d->optimize;
case ProgressiveScanWrite:
return d->progressive;
+ case ImageTransformation:
+ d->readJpegHeader(device());
+ return int(d->transformation);
default:
break;
}
@@ -1126,6 +1121,11 @@ void QJpegHandler::setOption(ImageOption option, const QVariant &value)
case ProgressiveScanWrite:
d->progressive = value.toBool();
break;
+ case ImageTransformation: {
+ int transformation = value.toInt();
+ if (transformation > 0 && transformation < 8)
+ d->transformation = QImageIOHandler::Transformations(transformation);
+ }
default:
break;
}
diff --git a/src/gui/image/qpicture.h b/src/gui/image/qpicture.h
index 9bb193321b..c3897a1935 100644
--- a/src/gui/image/qpicture.h
+++ b/src/gui/image/qpicture.h
@@ -72,10 +72,11 @@ public:
QPicture& operator=(const QPicture &p);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QPicture &operator=(QPicture &&other)
+ inline QPicture &operator=(QPicture &&other) Q_DECL_NOEXCEPT
{ qSwap(d_ptr, other.d_ptr); return *this; }
#endif
- inline void swap(QPicture &other) { d_ptr.swap(other.d_ptr); }
+ inline void swap(QPicture &other) Q_DECL_NOEXCEPT
+ { d_ptr.swap(other.d_ptr); }
void detach();
bool isDetached() const;
diff --git a/src/gui/image/qpixmap.h b/src/gui/image/qpixmap.h
index 810883ea6c..51b02acfcf 100644
--- a/src/gui/image/qpixmap.h
+++ b/src/gui/image/qpixmap.h
@@ -67,10 +67,11 @@ public:
QPixmap &operator=(const QPixmap &);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QPixmap &operator=(QPixmap &&other)
+ inline QPixmap &operator=(QPixmap &&other) Q_DECL_NOEXCEPT
{ qSwap(data, other.data); return *this; }
#endif
- inline void swap(QPixmap &other) { qSwap(data, other.data); }
+ inline void swap(QPixmap &other) Q_DECL_NOEXCEPT
+ { qSwap(data, other.data); }
operator QVariant() const;
diff --git a/src/gui/image/qpixmap_win.cpp b/src/gui/image/qpixmap_win.cpp
index 0de47f55af..12e19440dc 100644
--- a/src/gui/image/qpixmap_win.cpp
+++ b/src/gui/image/qpixmap_win.cpp
@@ -40,11 +40,6 @@
#include <QScopedArrayPointer>
#include <qt_windows.h>
-#ifdef Q_OS_WINCE
-#define UNDER_NT
-#include <wingdi.h>
-#endif
-
QT_BEGIN_NAMESPACE
#ifdef Q_OS_WINCE
diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp
index 3c88d2e9c1..7fbd24787e 100644
--- a/src/gui/image/qpnghandler.cpp
+++ b/src/gui/image/qpnghandler.cpp
@@ -676,16 +676,9 @@ QImage::Format QPngHandlerPrivate::readImageFormat()
&& num_palette <= 256)
{
// 1-bit and 8-bit color
- if (bit_depth != 1)
- png_set_packing(png_ptr);
- png_read_update_info(png_ptr, info_ptr);
- png_get_IHDR(png_ptr, info_ptr, &width, &height, &bit_depth, &color_type, 0, 0, 0);
format = bit_depth == 1 ? QImage::Format_Mono : QImage::Format_Indexed8;
} else {
// 32-bit
- if (bit_depth == 16)
- png_set_strip_16(png_ptr);
-
format = QImage::Format_ARGB32;
// Only add filler if no alpha, or we can get 5 channel data.
if (!(color_type & PNG_COLOR_MASK_ALPHA)