summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible.cpp6
-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
-rw-r--r--src/gui/kernel/qevent.h9
-rw-r--r--src/gui/kernel/qgenericpluginfactory.cpp8
-rw-r--r--src/gui/kernel/qinputdevicemanager.cpp1
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h2
-rw-r--r--src/gui/kernel/qopenglwindow.cpp244
-rw-r--r--src/gui/kernel/qpalette.h8
-rw-r--r--src/gui/kernel/qplatformdialoghelper.cpp6
-rw-r--r--src/gui/kernel/qplatformdialoghelper.h1
-rw-r--r--src/gui/kernel/qplatforminputcontextplugin_p.h2
-rw-r--r--src/gui/kernel/qplatformintegrationplugin.h2
-rw-r--r--src/gui/kernel/qplatformmenu.cpp5
-rw-r--r--src/gui/kernel/qplatformmenu.h1
-rw-r--r--src/gui/kernel/qplatformopenglcontext.cpp4
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow.cpp10
-rw-r--r--src/gui/kernel/qshapedpixmapdndwindow_p.h2
-rw-r--r--src/gui/kernel/qsimpledrag.cpp15
-rw-r--r--src/gui/kernel/qtouchdevice.cpp23
-rw-r--r--src/gui/kernel/qtouchdevice.h9
-rw-r--r--src/gui/math3d/qgenericmatrix.h2
-rw-r--r--src/gui/math3d/qquaternion.cpp14
-rw-r--r--src/gui/math3d/qquaternion.h22
-rw-r--r--src/gui/math3d/qvector2d.h2
-rw-r--r--src/gui/math3d/qvector4d.h2
-rw-r--r--src/gui/opengl/qopengl.cpp13
-rw-r--r--src/gui/opengl/qopenglengineshadermanager.cpp2
-rw-r--r--src/gui/opengl/qopenglextensions_p.h3
-rw-r--r--src/gui/opengl/qopenglfunctions.cpp66
-rw-r--r--src/gui/painting/qbrush.cpp2
-rw-r--r--src/gui/painting/qbrush.h5
-rw-r--r--src/gui/painting/qcolor.cpp8
-rw-r--r--src/gui/painting/qdrawhelper.cpp6
-rw-r--r--src/gui/painting/qdrawhelper_p.h4
-rw-r--r--src/gui/painting/qimagescale.cpp213
-rw-r--r--src/gui/painting/qimagescale_sse4.cpp42
-rw-r--r--src/gui/painting/qpaintdevice.cpp2
-rw-r--r--src/gui/painting/qpaintdevice.h2
-rw-r--r--src/gui/painting/qpaintengineex.cpp8
-rw-r--r--src/gui/painting/qpainterpath.cpp19
-rw-r--r--src/gui/painting/qpainterpath.h22
-rw-r--r--src/gui/painting/qpdf.cpp2
-rw-r--r--src/gui/painting/qplatformbackingstore.cpp129
-rw-r--r--src/gui/painting/qplatformbackingstore.h17
-rw-r--r--src/gui/painting/qpolygon.h8
-rw-r--r--src/gui/painting/qregion.h4
-rw-r--r--src/gui/painting/qstroker_p.h2
-rw-r--r--src/gui/painting/qtransform.cpp2
-rw-r--r--src/gui/text/qfont.h2
-rw-r--r--src/gui/text/qfontdatabase.cpp74
-rw-r--r--src/gui/text/qfontdatabase.h2
-rw-r--r--src/gui/text/qfontengine.cpp2
-rw-r--r--src/gui/text/qfontengine_ft.cpp2
-rw-r--r--src/gui/text/qfontengine_qpf2.cpp2
-rw-r--r--src/gui/text/qfontmetrics.h5
-rw-r--r--src/gui/text/qtextdocumentlayout.cpp2
-rw-r--r--src/gui/text/qtexttable.cpp6
-rw-r--r--src/gui/text/qzip.cpp2
72 files changed, 846 insertions, 583 deletions
diff --git a/src/gui/accessible/qaccessible.cpp b/src/gui/accessible/qaccessible.cpp
index f2a30e5a18..c1b586f879 100644
--- a/src/gui/accessible/qaccessible.cpp
+++ b/src/gui/accessible/qaccessible.cpp
@@ -1423,6 +1423,12 @@ QAccessibleValueChangeEvent::~QAccessibleValueChangeEvent()
The difference to the object's previous state is in \a state.
*/
/*!
+ \fn QAccessibleStateChangeEvent::QAccessibleStateChangeEvent(QAccessibleInterface *iface, QAccessible::State state)
+ Constructs a new QAccessibleStateChangeEvent.
+ \a iface is the interface associated with the event
+ \a state is the state of the accessible object.
+*/
+/*!
\fn QAccessible::State QAccessibleStateChangeEvent::changedStates() const
\brief Returns the states that have been changed.
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)
diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h
index 61316b0af5..dd7b35e2bb 100644
--- a/src/gui/kernel/qevent.h
+++ b/src/gui/kernel/qevent.h
@@ -794,8 +794,10 @@ public:
explicit TouchPoint(int id = -1);
TouchPoint(const TouchPoint &other);
#ifdef Q_COMPILER_RVALUE_REFS
- TouchPoint(TouchPoint &&other) : d(other.d) { other.d = 0; }
- TouchPoint &operator=(TouchPoint &&other)
+ TouchPoint(TouchPoint &&other) Q_DECL_NOEXCEPT
+ : d(0)
+ { qSwap(d, other.d); }
+ TouchPoint &operator=(TouchPoint &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); return *this; }
#endif
~TouchPoint();
@@ -803,7 +805,8 @@ public:
TouchPoint &operator=(const TouchPoint &other)
{ if ( d != other.d ) { TouchPoint copy(other); swap(copy); } return *this; }
- void swap(TouchPoint &other) { qSwap(d, other.d); }
+ void swap(TouchPoint &other) Q_DECL_NOEXCEPT
+ { qSwap(d, other.d); }
int id() const;
diff --git a/src/gui/kernel/qgenericpluginfactory.cpp b/src/gui/kernel/qgenericpluginfactory.cpp
index 7e4727df8c..d7b9bfba06 100644
--- a/src/gui/kernel/qgenericpluginfactory.cpp
+++ b/src/gui/kernel/qgenericpluginfactory.cpp
@@ -69,13 +69,13 @@ Q_GLOBAL_STATIC_WITH_ARGS(QFactoryLoader, loader,
*/
QObject *QGenericPluginFactory::create(const QString& key, const QString &specification)
{
+#if (!defined(Q_OS_WIN32) || defined(QT_SHARED)) && !defined(QT_NO_LIBRARY)
const QString driver = key.toLower();
-
-#if !defined(Q_OS_WIN32) || defined(QT_SHARED)
-#ifndef QT_NO_LIBRARY
if (QObject *object = qLoadPlugin1<QObject, QGenericPlugin>(loader(), driver, specification))
return object;
-#endif
+#else // (!Q_OS_WIN32 || QT_SHARED) && !QT_NO_LIBRARY
+ Q_UNUSED(key)
+ Q_UNUSED(specification)
#endif
return 0;
}
diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
index d0dd8a4e7c..dbdb03adbb 100644
--- a/src/gui/kernel/qinputdevicemanager.cpp
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -58,6 +58,7 @@ QT_BEGIN_NAMESPACE
QInputDeviceManager::QInputDeviceManager(QObject *parent)
: QObject(*new QInputDeviceManagerPrivate, parent)
{
+ qRegisterMetaType<DeviceType>();
}
int QInputDeviceManager::deviceCount(DeviceType type) const
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index 15c84d1a82..d64793c23c 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -77,4 +77,6 @@ signals:
QT_END_NAMESPACE
+Q_DECLARE_METATYPE(QInputDeviceManager::DeviceType)
+
#endif // QINPUTDEVICEMANAGER_P_H
diff --git a/src/gui/kernel/qopenglwindow.cpp b/src/gui/kernel/qopenglwindow.cpp
index a7ba57e85e..b2025faaf1 100644
--- a/src/gui/kernel/qopenglwindow.cpp
+++ b/src/gui/kernel/qopenglwindow.cpp
@@ -175,140 +175,156 @@ public:
this->shareContext = qt_gl_global_share_context();
}
- ~QOpenGLWindowPrivate()
- {
- Q_Q(QOpenGLWindow);
- if (q->isValid()) {
- q->makeCurrent(); // this works even when the platformwindow is destroyed
- paintDevice.reset(0);
- fbo.reset(0);
- blitter.destroy();
- q->doneCurrent();
- }
- }
+ ~QOpenGLWindowPrivate();
static QOpenGLWindowPrivate *get(QOpenGLWindow *w) { return w->d_func(); }
- void bindFBO()
- {
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
- fbo->bind();
- else
- QOpenGLFramebufferObject::bindDefault();
+ void bindFBO();
+ void initialize();
+
+ void beginPaint(const QRegion &region) Q_DECL_OVERRIDE;
+ void endPaint() Q_DECL_OVERRIDE;
+ void flush(const QRegion &region) Q_DECL_OVERRIDE;
+
+ QOpenGLWindow::UpdateBehavior updateBehavior;
+ bool hasFboBlit;
+ QScopedPointer<QOpenGLContext> context;
+ QOpenGLContext *shareContext;
+ QScopedPointer<QOpenGLFramebufferObject> fbo;
+ QScopedPointer<QOpenGLWindowPaintDevice> paintDevice;
+ QOpenGLTextureBlitter blitter;
+ QColor backgroundColor;
+ QScopedPointer<QOffscreenSurface> offscreenSurface;
+};
+
+QOpenGLWindowPrivate::~QOpenGLWindowPrivate()
+{
+ Q_Q(QOpenGLWindow);
+ if (q->isValid()) {
+ q->makeCurrent(); // this works even when the platformwindow is destroyed
+ paintDevice.reset(0);
+ fbo.reset(0);
+ blitter.destroy();
+ q->doneCurrent();
}
+}
- void beginPaint(const QRegion &region) Q_DECL_OVERRIDE
- {
- Q_UNUSED(region);
- Q_Q(QOpenGLWindow);
-
- if (!context) {
- context.reset(new QOpenGLContext);
- context->setShareContext(shareContext);
- context->setFormat(q->requestedFormat());
- if (!context->create())
- qWarning("QOpenGLWindow::beginPaint: Failed to create context");
- if (!context->makeCurrent(q))
- qWarning("QOpenGLWindow::beginPaint: Failed to make context current");
-
- paintDevice.reset(new QOpenGLWindowPaintDevice(q));
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlit)
- hasFboBlit = QOpenGLFramebufferObject::hasOpenGLFramebufferBlit();
-
- q->initializeGL();
- } else {
- context->makeCurrent(q);
- }
+void QOpenGLWindowPrivate::initialize()
+{
+ Q_Q(QOpenGLWindow);
- const int deviceWidth = q->width() * q->devicePixelRatio();
- const int deviceHeight = q->height() * q->devicePixelRatio();
- const QSize deviceSize(deviceWidth, deviceHeight);
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
- if (!fbo || fbo->size() != deviceSize) {
- QOpenGLFramebufferObjectFormat fboFormat;
- fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
- if (q->requestedFormat().samples() > 0) {
- if (updateBehavior != QOpenGLWindow::PartialUpdateBlend)
- fboFormat.setSamples(q->requestedFormat().samples());
- else
- qWarning("QOpenGLWindow: PartialUpdateBlend does not support multisampling");
- }
- fbo.reset(new QOpenGLFramebufferObject(deviceSize, fboFormat));
- markWindowAsDirty();
+ if (context)
+ return;
+
+ context.reset(new QOpenGLContext);
+ context->setShareContext(shareContext);
+ context->setFormat(q->requestedFormat());
+ if (!context->create())
+ qWarning("QOpenGLWindow::beginPaint: Failed to create context");
+ if (!context->makeCurrent(q))
+ qWarning("QOpenGLWindow::beginPaint: Failed to make context current");
+
+ paintDevice.reset(new QOpenGLWindowPaintDevice(q));
+ if (updateBehavior == QOpenGLWindow::PartialUpdateBlit)
+ hasFboBlit = QOpenGLFramebufferObject::hasOpenGLFramebufferBlit();
+
+ q->initializeGL();
+}
+
+void QOpenGLWindowPrivate::beginPaint(const QRegion &region)
+{
+ Q_UNUSED(region);
+ Q_Q(QOpenGLWindow);
+
+ initialize();
+ context->makeCurrent(q);
+
+ const int deviceWidth = q->width() * q->devicePixelRatio();
+ const int deviceHeight = q->height() * q->devicePixelRatio();
+ const QSize deviceSize(deviceWidth, deviceHeight);
+ if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
+ if (!fbo || fbo->size() != deviceSize) {
+ QOpenGLFramebufferObjectFormat fboFormat;
+ fboFormat.setAttachment(QOpenGLFramebufferObject::CombinedDepthStencil);
+ if (q->requestedFormat().samples() > 0) {
+ if (updateBehavior != QOpenGLWindow::PartialUpdateBlend)
+ fboFormat.setSamples(q->requestedFormat().samples());
+ else
+ qWarning("QOpenGLWindow: PartialUpdateBlend does not support multisampling");
}
- } else {
+ fbo.reset(new QOpenGLFramebufferObject(deviceSize, fboFormat));
markWindowAsDirty();
}
+ } else {
+ markWindowAsDirty();
+ }
- paintDevice->setSize(QSize(deviceWidth, deviceHeight));
- paintDevice->setDevicePixelRatio(q->devicePixelRatio());
- context->functions()->glViewport(0, 0, deviceWidth, deviceHeight);
+ paintDevice->setSize(QSize(deviceWidth, deviceHeight));
+ paintDevice->setDevicePixelRatio(q->devicePixelRatio());
+ context->functions()->glViewport(0, 0, deviceWidth, deviceHeight);
- context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
+ context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
- q->paintUnderGL();
+ q->paintUnderGL();
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
- fbo->bind();
- }
+ if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
+ fbo->bind();
+}
- void endPaint() Q_DECL_OVERRIDE
- {
- Q_Q(QOpenGLWindow);
-
- if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
- fbo->release();
-
- context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
-
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlit && hasFboBlit) {
- const int deviceWidth = q->width() * q->devicePixelRatio();
- const int deviceHeight = q->height() * q->devicePixelRatio();
- QOpenGLExtensions extensions(context.data());
- extensions.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->handle());
- extensions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, context->defaultFramebufferObject());
- extensions.glBlitFramebuffer(0, 0, deviceWidth, deviceHeight,
- 0, 0, deviceWidth, deviceHeight,
- GL_COLOR_BUFFER_BIT, GL_NEAREST);
- } else if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlend) {
- context->functions()->glEnable(GL_BLEND);
- context->functions()->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
- }
- if (!blitter.isCreated())
- blitter.create();
+void QOpenGLWindowPrivate::endPaint()
+{
+ Q_Q(QOpenGLWindow);
+
+ if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
+ fbo->release();
- QRect windowRect(QPoint(0, 0), fbo->size());
- QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect);
- blitter.bind();
- blitter.blit(fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft);
- blitter.release();
+ context->functions()->glBindFramebuffer(GL_FRAMEBUFFER, context->defaultFramebufferObject());
- if (updateBehavior == QOpenGLWindow::PartialUpdateBlend)
- context->functions()->glDisable(GL_BLEND);
+ if (updateBehavior == QOpenGLWindow::PartialUpdateBlit && hasFboBlit) {
+ const int deviceWidth = q->width() * q->devicePixelRatio();
+ const int deviceHeight = q->height() * q->devicePixelRatio();
+ QOpenGLExtensions extensions(context.data());
+ extensions.glBindFramebuffer(GL_READ_FRAMEBUFFER, fbo->handle());
+ extensions.glBindFramebuffer(GL_DRAW_FRAMEBUFFER, context->defaultFramebufferObject());
+ extensions.glBlitFramebuffer(0, 0, deviceWidth, deviceHeight,
+ 0, 0, deviceWidth, deviceHeight,
+ GL_COLOR_BUFFER_BIT, GL_NEAREST);
+ } else if (updateBehavior > QOpenGLWindow::NoPartialUpdate) {
+ if (updateBehavior == QOpenGLWindow::PartialUpdateBlend) {
+ context->functions()->glEnable(GL_BLEND);
+ context->functions()->glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
}
+ if (!blitter.isCreated())
+ blitter.create();
- q->paintOverGL();
- }
+ QRect windowRect(QPoint(0, 0), fbo->size());
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(windowRect, windowRect);
+ blitter.bind();
+ blitter.blit(fbo->texture(), target, QOpenGLTextureBlitter::OriginBottomLeft);
+ blitter.release();
- void flush(const QRegion &region) Q_DECL_OVERRIDE
- {
- Q_UNUSED(region);
- Q_Q(QOpenGLWindow);
- context->swapBuffers(q);
- emit q->frameSwapped();
+ if (updateBehavior == QOpenGLWindow::PartialUpdateBlend)
+ context->functions()->glDisable(GL_BLEND);
}
- QOpenGLWindow::UpdateBehavior updateBehavior;
- bool hasFboBlit;
- QScopedPointer<QOpenGLContext> context;
- QOpenGLContext *shareContext;
- QScopedPointer<QOpenGLFramebufferObject> fbo;
- QScopedPointer<QOpenGLWindowPaintDevice> paintDevice;
- QOpenGLTextureBlitter blitter;
- QColor backgroundColor;
- QScopedPointer<QOffscreenSurface> offscreenSurface;
-};
+ q->paintOverGL();
+}
+
+void QOpenGLWindowPrivate::bindFBO()
+{
+ if (updateBehavior > QOpenGLWindow::NoPartialUpdate)
+ fbo->bind();
+ else
+ QOpenGLFramebufferObject::bindDefault();
+}
+
+void QOpenGLWindowPrivate::flush(const QRegion &region)
+{
+ Q_UNUSED(region);
+ Q_Q(QOpenGLWindow);
+ context->swapBuffers(q);
+ emit q->frameSwapped();
+}
void QOpenGLWindowPaintDevice::ensureActiveTarget()
{
@@ -631,6 +647,8 @@ void QOpenGLWindow::paintEvent(QPaintEvent *event)
void QOpenGLWindow::resizeEvent(QResizeEvent *event)
{
Q_UNUSED(event);
+ Q_D(QOpenGLWindow);
+ d->initialize();
resizeGL(width(), height());
}
diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h
index e8b35aa82a..66b3f039f4 100644
--- a/src/gui/kernel/qpalette.h
+++ b/src/gui/kernel/qpalette.h
@@ -62,15 +62,17 @@ public:
QPalette &operator=(const QPalette &palette);
#ifdef Q_COMPILER_RVALUE_REFS
QPalette(QPalette &&other) Q_DECL_NOTHROW
- : d(other.d), data(other.data) { other.d = Q_NULLPTR; }
- inline QPalette &operator=(QPalette &&other)
+ : d(other.d), data(other.data)
+ { other.d = Q_NULLPTR; }
+ inline QPalette &operator=(QPalette &&other) Q_DECL_NOEXCEPT
{
for_faster_swapping_dont_use = other.for_faster_swapping_dont_use;
qSwap(d, other.d); return *this;
}
#endif
- void swap(QPalette &other) {
+ void swap(QPalette &other) Q_DECL_NOEXCEPT
+ {
qSwap(d, other.d);
qSwap(for_faster_swapping_dont_use, other.for_faster_swapping_dont_use);
}
diff --git a/src/gui/kernel/qplatformdialoghelper.cpp b/src/gui/kernel/qplatformdialoghelper.cpp
index 2d0458f705..3d35c4dcba 100644
--- a/src/gui/kernel/qplatformdialoghelper.cpp
+++ b/src/gui/kernel/qplatformdialoghelper.cpp
@@ -136,6 +136,12 @@ QVariant QPlatformDialogHelper::defaultStyleHint(QPlatformDialogHelper::StyleHi
return QVariant();
}
+void QPlatformDialogHelper::execModalForWindow(QWindow *parent)
+{
+ Q_UNUSED(parent);
+ exec();
+}
+
// Font dialog
class QFontDialogOptionsPrivate : public QSharedData
diff --git a/src/gui/kernel/qplatformdialoghelper.h b/src/gui/kernel/qplatformdialoghelper.h
index 8b2b9881b7..6d3a367e60 100644
--- a/src/gui/kernel/qplatformdialoghelper.h
+++ b/src/gui/kernel/qplatformdialoghelper.h
@@ -145,6 +145,7 @@ public:
virtual QVariant styleHint(StyleHint hint) const;
virtual void exec() = 0;
+ virtual void execModalForWindow(QWindow *parent);
virtual bool show(Qt::WindowFlags windowFlags,
Qt::WindowModality windowModality,
QWindow *parent) = 0;
diff --git a/src/gui/kernel/qplatforminputcontextplugin_p.h b/src/gui/kernel/qplatforminputcontextplugin_p.h
index 732eba3e06..d05672558d 100644
--- a/src/gui/kernel/qplatforminputcontextplugin_p.h
+++ b/src/gui/kernel/qplatforminputcontextplugin_p.h
@@ -53,7 +53,7 @@ QT_BEGIN_NAMESPACE
class QPlatformInputContext;
-#define QPlatformInputContextFactoryInterface_iid "org.qt-project.Qt.QPlatformInputContextFactoryInterface"
+#define QPlatformInputContextFactoryInterface_iid "org.qt-project.Qt.QPlatformInputContextFactoryInterface.5.1"
class Q_GUI_EXPORT QPlatformInputContextPlugin : public QObject
{
diff --git a/src/gui/kernel/qplatformintegrationplugin.h b/src/gui/kernel/qplatformintegrationplugin.h
index b5e0b1874c..89808cde5e 100644
--- a/src/gui/kernel/qplatformintegrationplugin.h
+++ b/src/gui/kernel/qplatformintegrationplugin.h
@@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE
class QPlatformIntegration;
-#define QPlatformIntegrationFactoryInterface_iid "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.2"
+#define QPlatformIntegrationFactoryInterface_iid "org.qt-project.Qt.QPA.QPlatformIntegrationFactoryInterface.5.3"
class Q_GUI_EXPORT QPlatformIntegrationPlugin : public QObject
{
diff --git a/src/gui/kernel/qplatformmenu.cpp b/src/gui/kernel/qplatformmenu.cpp
index cb311b8d13..da65381931 100644
--- a/src/gui/kernel/qplatformmenu.cpp
+++ b/src/gui/kernel/qplatformmenu.cpp
@@ -44,4 +44,9 @@ QPlatformMenuItem *QPlatformMenu::createMenuItem() const
return QGuiApplicationPrivate::platformTheme()->createPlatformMenuItem();
}
+QPlatformMenu *QPlatformMenu::createSubMenu() const
+{
+ return QGuiApplicationPrivate::platformTheme()->createPlatformMenu();
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h
index baa1e460d7..1022d0ed4a 100644
--- a/src/gui/kernel/qplatformmenu.h
+++ b/src/gui/kernel/qplatformmenu.h
@@ -123,6 +123,7 @@ public:
virtual QPlatformMenuItem *menuItemForTag(quintptr tag) const = 0;
virtual QPlatformMenuItem *createMenuItem() const;
+ virtual QPlatformMenu *createSubMenu() const;
Q_SIGNALS:
void aboutToShow();
void aboutToHide();
diff --git a/src/gui/kernel/qplatformopenglcontext.cpp b/src/gui/kernel/qplatformopenglcontext.cpp
index b9cf81b30e..f98f8a496c 100644
--- a/src/gui/kernel/qplatformopenglcontext.cpp
+++ b/src/gui/kernel/qplatformopenglcontext.cpp
@@ -131,6 +131,10 @@ bool QPlatformOpenGLContext::parseOpenGLVersion(const QByteArray &versionString,
if (versionParts.size() >= 2) {
major = versionParts.at(0).toInt(&majorOk);
minor = versionParts.at(1).toInt(&minorOk);
+ // Nexus 6 has "OpenGL ES 3.0V@95.0 (GIT@I86da836d38)"
+ if (!minorOk)
+ if (int idx = versionParts.at(1).indexOf('V'))
+ minor = versionParts.at(1).left(idx).toInt(&minorOk);
} else {
qWarning("Unrecognized OpenGL ES version");
}
diff --git a/src/gui/kernel/qshapedpixmapdndwindow.cpp b/src/gui/kernel/qshapedpixmapdndwindow.cpp
index 253a09e407..8f80789fb0 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow.cpp
+++ b/src/gui/kernel/qshapedpixmapdndwindow.cpp
@@ -47,7 +47,7 @@ QShapedPixmapWindow::QShapedPixmapWindow()
setFormat(format);
setSurfaceType(RasterSurface);
setFlags(Qt::ToolTip | Qt::FramelessWindowHint |
- Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput);
+ Qt::X11BypassWindowManagerHint | Qt::WindowTransparentForInput | Qt::WindowDoesNotAcceptFocus);
create();
m_backingStore = new QBackingStore(this);
}
@@ -86,16 +86,14 @@ void QShapedPixmapWindow::setHotspot(const QPoint &hotspot)
m_hotSpot = hotspot;
}
-void QShapedPixmapWindow::updateGeometry()
+void QShapedPixmapWindow::updateGeometry(const QPoint &pos)
{
-#ifndef QT_NO_CURSOR
- QRect rect(QCursor::pos() - m_hotSpot, m_pixmap.size());
if (m_pixmap.isNull())
m_backingStore->resize(QSize(1,1));
else if (m_backingStore->size() != m_pixmap.size())
m_backingStore->resize(m_pixmap.size());
- setGeometry(rect);
-#endif
+
+ setGeometry(QRect(pos - m_hotSpot, m_backingStore->size()));
}
void QShapedPixmapWindow::exposeEvent(QExposeEvent *)
diff --git a/src/gui/kernel/qshapedpixmapdndwindow_p.h b/src/gui/kernel/qshapedpixmapdndwindow_p.h
index ec56573195..fc311cff92 100644
--- a/src/gui/kernel/qshapedpixmapdndwindow_p.h
+++ b/src/gui/kernel/qshapedpixmapdndwindow_p.h
@@ -63,7 +63,7 @@ public:
void setPixmap(const QPixmap &pixmap);
void setHotspot(const QPoint &hotspot);
- void updateGeometry();
+ void updateGeometry(const QPoint &pos);
protected:
void exposeEvent(QExposeEvent *) Q_DECL_OVERRIDE;
diff --git a/src/gui/kernel/qsimpledrag.cpp b/src/gui/kernel/qsimpledrag.cpp
index 090e88c118..b850f53014 100644
--- a/src/gui/kernel/qsimpledrag.cpp
+++ b/src/gui/kernel/qsimpledrag.cpp
@@ -201,7 +201,16 @@ void QBasicDrag::startDrag()
m_drag_icon_window->setPixmap(m_drag->pixmap());
m_drag_icon_window->setHotspot(m_drag->hotSpot());
- m_drag_icon_window->updateGeometry();
+
+#ifndef QT_NO_CURSOR
+ QPoint pos = QCursor::pos();
+ if (pos.x() == int(qInf())) {
+ // ### fixme: no mouse pos registered. Get pos from touch...
+ pos = QPoint();
+ }
+ m_drag_icon_window->updateGeometry(pos);
+#endif
+
m_drag_icon_window->setVisible(true);
enableEventFilter();
@@ -218,10 +227,10 @@ void QBasicDrag::cancel()
m_drag_icon_window->setVisible(false);
}
-void QBasicDrag::move(const QMouseEvent *)
+void QBasicDrag::move(const QMouseEvent *e)
{
if (m_drag)
- m_drag_icon_window->updateGeometry();
+ m_drag_icon_window->updateGeometry(e->globalPos());
}
void QBasicDrag::drop(const QMouseEvent *)
diff --git a/src/gui/kernel/qtouchdevice.cpp b/src/gui/kernel/qtouchdevice.cpp
index 8737825de0..1a6e9deba8 100644
--- a/src/gui/kernel/qtouchdevice.cpp
+++ b/src/gui/kernel/qtouchdevice.cpp
@@ -37,6 +37,8 @@
#include <QMutex>
#include <QCoreApplication>
+#include <private/qdebug_p.h>
+
QT_BEGIN_NAMESPACE
/*!
@@ -239,4 +241,25 @@ void QTouchDevicePrivate::registerDevice(QTouchDevice *dev)
deviceList()->append(dev);
}
+#ifndef QT_NO_DEBUG_STREAM
+QDebug operator<<(QDebug debug, const QTouchDevice *device)
+{
+ QDebugStateSaver saver(debug);
+ debug.nospace();
+ debug.noquote();
+ debug << "QTouchDevice(";
+ if (device) {
+ debug << '"' << device->name() << "\", type=";
+ QtDebugUtils::formatQEnum(debug, device->type());
+ debug << ", capabilities=";
+ QtDebugUtils::formatQFlags(debug, device->capabilities());
+ debug << ", maximumTouchPoints=" << device->maximumTouchPoints();
+ } else {
+ debug << '0';
+ }
+ debug << ')';
+ return debug;
+}
+#endif // !QT_NO_DEBUG_STREAM
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qtouchdevice.h b/src/gui/kernel/qtouchdevice.h
index f2157ce2d6..1c1fcc63aa 100644
--- a/src/gui/kernel/qtouchdevice.h
+++ b/src/gui/kernel/qtouchdevice.h
@@ -38,16 +38,18 @@
QT_BEGIN_NAMESPACE
-
+class QDebug;
class QTouchDevicePrivate;
class Q_GUI_EXPORT QTouchDevice
{
+ Q_GADGET
public:
enum DeviceType {
TouchScreen,
TouchPad
};
+ Q_ENUM(DeviceType)
enum CapabilityFlag {
Position = 0x0001,
@@ -58,6 +60,7 @@ public:
NormalizedPosition = 0x0020,
MouseEmulation = 0x0040
};
+ Q_FLAG(CapabilityFlag)
Q_DECLARE_FLAGS(Capabilities, CapabilityFlag)
QTouchDevice();
@@ -81,6 +84,10 @@ private:
Q_DECLARE_OPERATORS_FOR_FLAGS(QTouchDevice::Capabilities)
+#ifndef QT_NO_DEBUG_STREAM
+Q_GUI_EXPORT QDebug operator<<(QDebug, const QTouchDevice *);
+#endif
+
QT_END_NAMESPACE
#endif // QTOUCHDEVICE_H
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h
index c08faaaa8b..19809056fd 100644
--- a/src/gui/math3d/qgenericmatrix.h
+++ b/src/gui/math3d/qgenericmatrix.h
@@ -57,7 +57,7 @@ public:
void fill(T value);
- QGenericMatrix<M, N, T> transposed() const;
+ QGenericMatrix<M, N, T> transposed() const Q_REQUIRED_RESULT;
QGenericMatrix<N, M, T>& operator+=(const QGenericMatrix<N, M, T>& other);
QGenericMatrix<N, M, T>& operator-=(const QGenericMatrix<N, M, T>& other);
diff --git a/src/gui/math3d/qquaternion.cpp b/src/gui/math3d/qquaternion.cpp
index 4b35ee4e79..0e73f79ac0 100644
--- a/src/gui/math3d/qquaternion.cpp
+++ b/src/gui/math3d/qquaternion.cpp
@@ -301,13 +301,21 @@ void QQuaternion::normalize()
*/
/*!
- \fn QQuaternion QQuaternion::conjugate() const
+ \fn QQuaternion QQuaternion::conjugated() const
+ \since 5.5
Returns the conjugate of this quaternion, which is
(-x, -y, -z, scalar).
*/
/*!
+ \fn QQuaternion QQuaternion::conjugate() const
+ \obsolete
+
+ Use conjugated() instead.
+*/
+
+/*!
Rotates \a vector with this quaternion to produce a new vector
in 3D space. The following code:
@@ -318,12 +326,12 @@ void QQuaternion::normalize()
is equivalent to the following:
\code
- QVector3D result = (q * QQuaternion(0, vector) * q.conjugate()).vector();
+ QVector3D result = (q * QQuaternion(0, vector) * q.conjugated()).vector();
\endcode
*/
QVector3D QQuaternion::rotatedVector(const QVector3D& vector) const
{
- return (*this * QQuaternion(0, vector) * conjugate()).vector();
+ return (*this * QQuaternion(0, vector) * conjugated()).vector();
}
/*!
diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h
index 52c717072d..5b0006ac56 100644
--- a/src/gui/math3d/qquaternion.h
+++ b/src/gui/math3d/qquaternion.h
@@ -83,12 +83,15 @@ public:
float length() const;
float lengthSquared() const;
- QQuaternion normalized() const;
+ QQuaternion normalized() const Q_REQUIRED_RESULT;
void normalize();
inline QQuaternion inverted() const;
- QQuaternion conjugate() const;
+ QQuaternion conjugated() const Q_REQUIRED_RESULT;
+#if QT_DEPRECATED_SINCE(5, 5)
+ QT_DEPRECATED QQuaternion conjugate() const Q_REQUIRED_RESULT;
+#endif
QVector3D rotatedVector(const QVector3D& vector) const;
@@ -161,12 +164,12 @@ inline QQuaternion::QQuaternion(float aScalar, float xpos, float ypos, float zpo
inline bool QQuaternion::isNull() const
{
- return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && qIsNull(wp);
+ return xp == 0.0f && yp == 0.0f && zp == 0.0f && wp == 0.0f;
}
inline bool QQuaternion::isIdentity() const
{
- return qIsNull(xp) && qIsNull(yp) && qIsNull(zp) && wp == 1.0f;
+ return xp == 0.0f && yp == 0.0f && zp == 0.0f && wp == 1.0f;
}
inline float QQuaternion::x() const { return xp; }
@@ -196,11 +199,18 @@ inline QQuaternion QQuaternion::inverted() const
return QQuaternion(0.0f, 0.0f, 0.0f, 0.0f);
}
-inline QQuaternion QQuaternion::conjugate() const
+inline QQuaternion QQuaternion::conjugated() const
{
return QQuaternion(wp, -xp, -yp, -zp);
}
+#if QT_DEPRECATED_SINCE(5, 5)
+inline QQuaternion QQuaternion::conjugate() const
+{
+ return conjugated();
+}
+#endif
+
inline QQuaternion &QQuaternion::operator+=(const QQuaternion &quaternion)
{
xp += quaternion.xp;
@@ -230,9 +240,9 @@ inline QQuaternion &QQuaternion::operator*=(float factor)
inline const QQuaternion operator*(const QQuaternion &q1, const QQuaternion& q2)
{
- float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
float yy = (q1.wp - q1.yp) * (q2.wp + q2.zp);
float zz = (q1.wp + q1.yp) * (q2.wp - q2.zp);
+ float ww = (q1.zp + q1.xp) * (q2.xp + q2.yp);
float xx = ww + yy + zz;
float qq = 0.5 * (xx + (q1.zp - q1.xp) * (q2.xp - q2.yp));
diff --git a/src/gui/math3d/qvector2d.h b/src/gui/math3d/qvector2d.h
index 20264fa84f..137142f381 100644
--- a/src/gui/math3d/qvector2d.h
+++ b/src/gui/math3d/qvector2d.h
@@ -75,7 +75,7 @@ public:
float length() const;
float lengthSquared() const; //In Qt 6 convert to inline and constexpr
- QVector2D normalized() const;
+ QVector2D normalized() const Q_REQUIRED_RESULT;
void normalize();
float distanceToPoint(const QVector2D &point) const;
diff --git a/src/gui/math3d/qvector4d.h b/src/gui/math3d/qvector4d.h
index aa69104f55..72db8ac754 100644
--- a/src/gui/math3d/qvector4d.h
+++ b/src/gui/math3d/qvector4d.h
@@ -81,7 +81,7 @@ public:
float length() const;
float lengthSquared() const; //In Qt 6 convert to inline and constexpr
- QVector4D normalized() const;
+ QVector4D normalized() const Q_REQUIRED_RESULT;
void normalize();
QVector4D &operator+=(const QVector4D &vector);
diff --git a/src/gui/opengl/qopengl.cpp b/src/gui/opengl/qopengl.cpp
index c8d33df4ba..1c008ccb42 100644
--- a/src/gui/opengl/qopengl.cpp
+++ b/src/gui/opengl/qopengl.cpp
@@ -47,6 +47,8 @@
#include <QtCore/QFile>
#include <QtCore/QDir>
+#include <set>
+
QT_BEGIN_NAMESPACE
#if defined(QT_OPENGL_3)
@@ -128,7 +130,7 @@ QDebug operator<<(QDebug d, const QOpenGLConfig::Gpu &g)
}
enum Operator { NotEqual, LessThan, LessEqualThan, Equals, GreaterThan, GreaterEqualThan };
-static const char *operators[] = {"!=", "<", "<=", "=", ">", ">="};
+static const char operators[][3] = {"!=", "<", "<=", "=", ">", ">="};
static inline QString valueKey() { return QStringLiteral("value"); }
static inline QString opKey() { return QStringLiteral("op"); }
@@ -474,4 +476,13 @@ QOpenGLConfig::Gpu QOpenGLConfig::Gpu::fromContext()
return gpu;
}
+Q_GUI_EXPORT std::set<QByteArray> *qgpu_features(const QString &filename)
+{
+ const QSet<QString> features = QOpenGLConfig::gpuFeatures(QOpenGLConfig::Gpu::fromContext(), filename);
+ std::set<QByteArray> *result = new std::set<QByteArray>;
+ foreach (const QString &feature, features)
+ result->insert(feature.toUtf8());
+ return result;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/opengl/qopenglengineshadermanager.cpp b/src/gui/opengl/qopenglengineshadermanager.cpp
index 853ad8b711..7e53c01cba 100644
--- a/src/gui/opengl/qopenglengineshadermanager.cpp
+++ b/src/gui/opengl/qopenglengineshadermanager.cpp
@@ -511,7 +511,7 @@ GLuint QOpenGLEngineShaderManager::getUniformLocation(Uniform id)
if (uniformLocations.isEmpty())
uniformLocations.fill(GLuint(-1), NumUniforms);
- static const char *uniformNames[] = {
+ static const char *const uniformNames[] = {
"imageTexture",
"patternColor",
"globalOpacity",
diff --git a/src/gui/opengl/qopenglextensions_p.h b/src/gui/opengl/qopenglextensions_p.h
index ff5d79566c..7def687f49 100644
--- a/src/gui/opengl/qopenglextensions_p.h
+++ b/src/gui/opengl/qopenglextensions_p.h
@@ -76,6 +76,9 @@ public:
void (QOPENGLF_APIENTRYP TexStorage2D)(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height);
private:
+ bool init();
+ QFunctionPointer resolve(const char *name);
+
QLibrary m_gl;
};
diff --git a/src/gui/opengl/qopenglfunctions.cpp b/src/gui/opengl/qopenglfunctions.cpp
index c60532b90b..b9d674fd3b 100644
--- a/src/gui/opengl/qopenglfunctions.cpp
+++ b/src/gui/opengl/qopenglfunctions.cpp
@@ -39,6 +39,10 @@
#include <QtGui/private/qguiapplication_p.h>
#include <qpa/qplatformintegration.h>
+#ifdef Q_OS_IOS
+#include <dlfcn.h>
+#endif
+
#ifndef GL_FRAMEBUFFER_SRGB_CAPABLE_EXT
#define GL_FRAMEBUFFER_SRGB_CAPABLE_EXT 0x8DBA
#endif
@@ -3202,35 +3206,53 @@ static void QOPENGLF_APIENTRY qopenglfResolveVertexAttribPointer(GLuint indx, GL
Q_GLOBAL_STATIC(QOpenGLES3Helper, qgles3Helper)
-QOpenGLES3Helper::QOpenGLES3Helper()
+bool QOpenGLES3Helper::init()
{
-#ifdef Q_OS_WIN
-#ifdef QT_DEBUG
+#ifndef Q_OS_IOS
+# ifdef Q_OS_WIN
+# ifndef QT_DEBUG
m_gl.setFileName(QStringLiteral("libGLESv2"));
-#else
+# else
m_gl.setFileName(QStringLiteral("libGLESv2d"));
-#endif
-#else
+# endif
+# else
m_gl.setFileName(QStringLiteral("GLESv2"));
+# endif // Q_OS_WIN
+ return m_gl.load();
+#else
+ return true;
+#endif // Q_OS_IOS
+}
+
+QFunctionPointer QOpenGLES3Helper::resolve(const char *name)
+{
+#ifdef Q_OS_IOS
+ return QFunctionPointer(dlsym(RTLD_DEFAULT, name));
+#else
+ return m_gl.resolve(name);
#endif
- if (m_gl.load()) {
- MapBufferRange = (GLvoid* (QOPENGLF_APIENTRYP)(GLenum, qopengl_GLintptr, qopengl_GLsizeiptr, GLbitfield)) m_gl.resolve("glMapBufferRange");
- UnmapBuffer = (GLboolean (QOPENGLF_APIENTRYP)(GLenum)) m_gl.resolve("glUnmapBuffer");
- BlitFramebuffer = (void (QOPENGLF_APIENTRYP)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)) m_gl.resolve("glBlitFramebuffer");
- RenderbufferStorageMultisample = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) m_gl.resolve("glRenderbufferStorageMultisample");
+}
+
+QOpenGLES3Helper::QOpenGLES3Helper()
+{
+ if (init()) {
+ MapBufferRange = (GLvoid* (QOPENGLF_APIENTRYP)(GLenum, qopengl_GLintptr, qopengl_GLsizeiptr, GLbitfield)) resolve("glMapBufferRange");
+ UnmapBuffer = (GLboolean (QOPENGLF_APIENTRYP)(GLenum)) resolve("glUnmapBuffer");
+ BlitFramebuffer = (void (QOPENGLF_APIENTRYP)(GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLint, GLbitfield, GLenum)) resolve("glBlitFramebuffer");
+ RenderbufferStorageMultisample = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) resolve("glRenderbufferStorageMultisample");
- GenVertexArrays = (void (QOPENGLF_APIENTRYP)(GLsizei, GLuint *)) m_gl.resolve("glGenVertexArrays");
- DeleteVertexArrays = (void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint *)) m_gl.resolve("glDeleteVertexArrays");
- BindVertexArray = (void (QOPENGLF_APIENTRYP)(GLuint)) m_gl.resolve("glBindVertexArray");
- IsVertexArray = (GLboolean (QOPENGLF_APIENTRYP)(GLuint)) m_gl.resolve("glIsVertexArray");
+ GenVertexArrays = (void (QOPENGLF_APIENTRYP)(GLsizei, GLuint *)) resolve("glGenVertexArrays");
+ DeleteVertexArrays = (void (QOPENGLF_APIENTRYP)(GLsizei, const GLuint *)) resolve("glDeleteVertexArrays");
+ BindVertexArray = (void (QOPENGLF_APIENTRYP)(GLuint)) resolve("glBindVertexArray");
+ IsVertexArray = (GLboolean (QOPENGLF_APIENTRYP)(GLuint)) resolve("glIsVertexArray");
- TexImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) m_gl.resolve("glTexImage3D");
- TexSubImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) m_gl.resolve("glTexSubImage3D");
- CompressedTexImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) m_gl.resolve("glCompressedTexImage3D");
- CompressedTexSubImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) m_gl.resolve("glCompressedTexSubImage3D");
+ TexImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLsizei, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *)) resolve("glTexImage3D");
+ TexSubImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *)) resolve("glTexSubImage3D");
+ CompressedTexImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLsizei, GLint, GLsizei, const GLvoid *)) resolve("glCompressedTexImage3D");
+ CompressedTexSubImage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLint, GLint, GLint, GLint, GLsizei, GLsizei, GLsizei, GLenum, GLsizei, const GLvoid *)) resolve("glCompressedTexSubImage3D");
- TexStorage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei)) m_gl.resolve("glTexStorage3D");
- TexStorage2D = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) m_gl.resolve("glTexStorage2D");
+ TexStorage3D = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei)) resolve("glTexStorage3D");
+ TexStorage2D = (void (QOPENGLF_APIENTRYP)(GLenum, GLsizei, GLenum, GLsizei, GLsizei)) resolve("glTexStorage2D");
if (!MapBufferRange || !GenVertexArrays || !TexImage3D || !TexStorage3D)
qFatal("OpenGL ES 3.0 entry points not found");
@@ -3568,7 +3590,7 @@ void QOpenGLExtensions::flushShared()
d->flushIsSufficientToSyncContexts = false; // default to false, not guaranteed by the spec
const char *vendor = (const char *) glGetString(GL_VENDOR);
if (vendor) {
- static const char *flushEnough[] = { "Apple", "ATI", "Intel", "NVIDIA" };
+ static const char *const flushEnough[] = { "Apple", "ATI", "Intel", "NVIDIA" };
for (size_t i = 0; i < sizeof(flushEnough) / sizeof(const char *); ++i) {
if (strstr(vendor, flushEnough[i])) {
d->flushIsSufficientToSyncContexts = true;
diff --git a/src/gui/painting/qbrush.cpp b/src/gui/painting/qbrush.cpp
index 5bf8387400..670717c5f1 100644
--- a/src/gui/painting/qbrush.cpp
+++ b/src/gui/painting/qbrush.cpp
@@ -999,7 +999,7 @@ bool QBrush::operator==(const QBrush &b) const
*/
QDebug operator<<(QDebug dbg, const QBrush &b)
{
- static const char *BRUSH_STYLES[] = {
+ static const char *const BRUSH_STYLES[] = {
"NoBrush",
"SolidPattern",
"Dense1Pattern",
diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h
index a3b88a50ef..ceb95f5676 100644
--- a/src/gui/painting/qbrush.h
+++ b/src/gui/painting/qbrush.h
@@ -73,10 +73,11 @@ public:
~QBrush();
QBrush &operator=(const QBrush &brush);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QBrush &operator=(QBrush &&other)
+ inline QBrush &operator=(QBrush &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); return *this; }
#endif
- inline void swap(QBrush &other) { qSwap(d, other.d); }
+ inline void swap(QBrush &other) Q_DECL_NOEXCEPT
+ { qSwap(d, other.d); }
operator QVariant() const;
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index b33d7a74fc..f1ceb464c8 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -729,8 +729,8 @@ void QColor::setHsv(int h, int s, int v, int a)
saturation, lightness, and alpha-channel (transparency) components of the
color's HSL value.
- These components can be retrieved individually using the hueHslF(),
- saturationHslF(), lightnessF() and alphaF() functions.
+ These components can be retrieved individually using the hslHueF(),
+ hslSaturationF(), lightnessF() and alphaF() functions.
\sa setHsl()
*/
@@ -759,8 +759,8 @@ void QColor::getHslF(qreal *h, qreal *s, qreal *l, qreal *a) const
saturation, lightness, and alpha-channel (transparency) components of the
color's HSL value.
- These components can be retrieved individually using the hueHsl(),
- saturationHsl(), lightness() and alpha() functions.
+ These components can be retrieved individually using the hslHue(),
+ hslSaturation(), lightness() and alpha() functions.
\sa setHsl()
*/
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index e46e997f1d..7b03cc00ff 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -944,7 +944,7 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = {
{ 0, 0, 0, 0, 0, 0, 0, 0, false, QPixelLayout::BPP8, convertGrayscale8ToRGB32, convertGrayscale8FromARGB32PM, convertGrayscale8FromRGB32, convertGrayscale8ToRGB64 } // Format_Grayscale8
};
-FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = {
+const FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = {
0, // BPPNone
fetchPixels<QPixelLayout::BPP1MSB>, // BPP1MSB
fetchPixels<QPixelLayout::BPP1LSB>, // BPP1LSB
@@ -954,7 +954,7 @@ FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = {
fetchPixels<QPixelLayout::BPP32> // BPP32
};
-StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = {
+const StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = {
0, // BPPNone
storePixels<QPixelLayout::BPP1MSB>, // BPP1MSB
storePixels<QPixelLayout::BPP1LSB>, // BPP1LSB
@@ -966,7 +966,7 @@ StorePixelsFunc qStorePixels[QPixelLayout::BPPCount] = {
typedef uint (QT_FASTCALL *FetchPixelFunc)(const uchar *src, int index);
-FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = {
+static const FetchPixelFunc qFetchPixel[QPixelLayout::BPPCount] = {
0, // BPPNone
fetchPixel<QPixelLayout::BPP1MSB>, // BPP1MSB
fetchPixel<QPixelLayout::BPP1LSB>, // BPP1LSB
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index f8865a6f7e..179900ddd2 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -1142,8 +1142,8 @@ typedef const uint *(QT_FASTCALL *FetchPixelsFunc)(uint *buffer, const uchar *sr
typedef void (QT_FASTCALL *StorePixelsFunc)(uchar *dest, const uint *src, int index, int count);
extern QPixelLayout qPixelLayouts[QImage::NImageFormats];
-extern FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount];
-extern StorePixelsFunc qStorePixels[QPixelLayout::BPPCount];
+extern const FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount];
+extern const StorePixelsFunc qStorePixels[QPixelLayout::BPPCount];
diff --git a/src/gui/painting/qimagescale.cpp b/src/gui/painting/qimagescale.cpp
index 5f1b25e189..867c64c5e0 100644
--- a/src/gui/painting/qimagescale.cpp
+++ b/src/gui/painting/qimagescale.cpp
@@ -38,22 +38,6 @@
QT_BEGIN_NAMESPACE
-typedef void (*qt_qimageScaleFunc)(QImageScale::QImageScaleInfo *isi, unsigned int *dest,
- int dxx, int dyy, int dx, int dy, int dw,
- int dh, int dow, int sow);
-
-static void qt_qimageScaleAARGB(QImageScale::QImageScaleInfo *isi, unsigned int *dest,
- int dxx, int dyy, int dx, int dy, int dw,
- int dh, int dow, int sow);
-
-static void qt_qimageScaleAARGBA(QImageScale::QImageScaleInfo *isi, unsigned int *dest,
- int dxx, int dyy, int dx, int dy, int dw,
- int dh, int dow, int sow);
-
-qt_qimageScaleFunc qt_qimageScaleArgb = qt_qimageScaleAARGBA;
-qt_qimageScaleFunc qt_qimageScaleRgb = qt_qimageScaleAARGB;
-
-
/*
* Copyright (C) 2004, 2005 Daniel M. Duley
*
@@ -93,6 +77,8 @@ qt_qimageScaleFunc qt_qimageScaleRgb = qt_qimageScaleAARGB;
*
* Changes include formatting, namespaces and other C++'ings, removal of old
* #ifdef'ed code, and removal of unneeded border calculation code.
+ * Later the code has been refactored and an SSE4.1 optimizated path have been
+ * added instead of the removed MMX assembler.
*
* Imlib2 is (C) Carsten Haitzler and various contributors. The MMX code
* is by Willem Monsuwe <willem@stack.nl>. All other modifications are
@@ -115,21 +101,14 @@ using namespace QImageScale;
// Code ported from Imlib...
//
-// FIXME: replace with qRed, etc... These work on pointers to pixels, not
-// pixel values
-#define A_VAL(p) (qAlpha(*p))
-#define R_VAL(p) (qRed(*p))
-#define G_VAL(p) (qGreen(*p))
-#define B_VAL(p) (qBlue(*p))
-
const unsigned int** QImageScale::qimageCalcYPoints(const unsigned int *src,
- int sw, int sh, int dh)
+ int sw, int sh, int dh)
{
const unsigned int **p;
int j = 0, rv = 0;
qint64 val, inc;
- if(dh < 0){
+ if (dh < 0) {
dh = -dh;
rv = 1;
}
@@ -157,7 +136,7 @@ int* QImageScale::qimageCalcXPoints(int sw, int dw)
int *p, j = 0, rv = 0;
qint64 val, inc;
- if(dw < 0){
+ if (dw < 0) {
dw = -dw;
rv = 1;
}
@@ -178,25 +157,23 @@ int* QImageScale::qimageCalcXPoints(int sw, int dw)
p[dw - i - 1] = tmp;
}
}
- return(p);
+ return p;
}
int* QImageScale::qimageCalcApoints(int s, int d, int up)
{
int *p, j = 0, rv = 0;
- if(d < 0){
+ if (d < 0) {
rv = 1;
d = -d;
}
p = new int[d];
- /* scaling up */
- if(up){
- qint64 val, inc;
-
- val = 0x8000 * s / d - 0x8000;
- inc = (((qint64)s) << 16) / d;
+ if (up) {
+ /* scaling up */
+ qint64 val = 0x8000 * s / d - 0x8000;
+ qint64 inc = (((qint64)s) << 16) / d;
for (int i = 0; i < d; i++) {
int pos = val >> 16;
if (pos < 0)
@@ -207,9 +184,8 @@ int* QImageScale::qimageCalcApoints(int s, int d, int up)
p[j++] = (val >> 8) - ((val >> 8) & 0xffffff00);
val += inc;
}
- }
- /* scaling down */
- else {
+ } else {
+ /* scaling down */
qint64 val = 0;
qint64 inc = (((qint64)s) << 16) / d;
int Cp = (((d << 14) + s - 1) / s);
@@ -220,7 +196,7 @@ int* QImageScale::qimageCalcApoints(int s, int d, int up)
val += inc;
}
}
- if(rv){
+ if (rv) {
int tmp;
for (int i = d / 2; --i >= 0; ) {
tmp = p[i];
@@ -233,7 +209,7 @@ int* QImageScale::qimageCalcApoints(int s, int d, int up)
QImageScaleInfo* QImageScale::qimageFreeScaleInfo(QImageScaleInfo *isi)
{
- if(isi){
+ if (isi) {
delete[] isi->xpoints;
delete[] isi->ypoints;
delete[] isi->xapoints;
@@ -254,28 +230,28 @@ QImageScaleInfo* QImageScale::qimageCalcScaleInfo(const QImage &img,
sch = dh * qlonglong(img.height()) / sh;
isi = new QImageScaleInfo;
- if(!isi)
+ if (!isi)
return 0;
memset(isi, 0, sizeof(QImageScaleInfo));
isi->xup_yup = (qAbs(dw) >= sw) + ((qAbs(dh) >= sh) << 1);
isi->xpoints = qimageCalcXPoints(img.width(), scw);
- if(!isi->xpoints)
- return(qimageFreeScaleInfo(isi));
+ if (!isi->xpoints)
+ return qimageFreeScaleInfo(isi);
isi->ypoints = qimageCalcYPoints((const unsigned int *)img.scanLine(0),
img.bytesPerLine() / 4, img.height(), sch);
if (!isi->ypoints)
- return(qimageFreeScaleInfo(isi));
- if(aa) {
+ return qimageFreeScaleInfo(isi);
+ if (aa) {
isi->xapoints = qimageCalcApoints(img.width(), scw, isi->xup_yup & 1);
- if(!isi->xapoints)
- return(qimageFreeScaleInfo(isi));
+ if (!isi->xapoints)
+ return qimageFreeScaleInfo(isi);
isi->yapoints = qimageCalcApoints(img.height(), sch, isi->xup_yup & 2);
- if(!isi->yapoints)
- return(qimageFreeScaleInfo(isi));
+ if (!isi->yapoints)
+ return qimageFreeScaleInfo(isi);
}
- return(isi);
+ return isi;
}
@@ -349,7 +325,7 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest,
int dh, int dow, int sow)
{
/* scaling up both ways */
- if (isi->xup_yup == 3){
+ if (isi->xup_yup == 3) {
qt_qimageScaleAARGBA_up_xy(isi, dest, dxx, dyy, dx, dy, dw, dh, dow, sow);
}
/* if we're scaling down vertically */
@@ -381,46 +357,25 @@ static void qt_qimageScaleAARGBA(QImageScaleInfo *isi, unsigned int *dest,
}
}
-inline static void qt_qimageScaleAARGBA_helper_x(const unsigned int *pix, int xap, int Cx, int &r, int &g, int &b, int &a)
+inline static void qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, int &r, int &g, int &b, int &a)
{
- r = R_VAL(pix) * xap;
- g = G_VAL(pix) * xap;
- b = B_VAL(pix) * xap;
- a = A_VAL(pix) * xap;
+ r = qRed(*pix) * xyap;
+ g = qGreen(*pix) * xyap;
+ b = qBlue(*pix) * xyap;
+ a = qAlpha(*pix) * xyap;
int j;
- for (j = (1 << 14) - xap; j > Cx; j -= Cx ){
- pix++;
- r += R_VAL(pix) * Cx;
- g += G_VAL(pix) * Cx;
- b += B_VAL(pix) * Cx;
- a += A_VAL(pix) * Cx;
- }
- pix++;
- r += R_VAL(pix) * j;
- g += G_VAL(pix) * j;
- b += B_VAL(pix) * j;
- a += A_VAL(pix) * j;
-}
-
-inline static void qt_qimageScaleAARGBA_helper_y(const unsigned int *pix, int yap, int Cy, int sow, int &r, int &g, int &b, int &a)
-{
- r = R_VAL(pix) * yap;
- g = G_VAL(pix) * yap;
- b = B_VAL(pix) * yap;
- a = A_VAL(pix) * yap;
- int j;
- for (j = (1 << 14) - yap; j > Cy; j -= Cy ){
- pix += sow;
- r += R_VAL(pix) * Cy;
- g += G_VAL(pix) * Cy;
- b += B_VAL(pix) * Cy;
- a += A_VAL(pix) * Cy;
- }
- pix += sow;
- r += R_VAL(pix) * j;
- g += G_VAL(pix) * j;
- b += B_VAL(pix) * j;
- a += A_VAL(pix) * j;
+ for (j = (1 << 14) - xyap; j > Cxy; j -= Cxy) {
+ pix += step;
+ r += qRed(*pix) * Cxy;
+ g += qGreen(*pix) * Cxy;
+ b += qBlue(*pix) * Cxy;
+ a += qAlpha(*pix) * Cxy;
+ }
+ pix += step;
+ r += qRed(*pix) * j;
+ g += qGreen(*pix) * j;
+ b += qBlue(*pix) * j;
+ a += qAlpha(*pix) * j;
}
static void qt_qimageScaleAARGBA_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest,
@@ -443,12 +398,12 @@ static void qt_qimageScaleAARGBA_up_x_down_y(QImageScaleInfo *isi, unsigned int
for (int x = dxx; x < end; x++) {
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
int r, g, b, a;
- qt_qimageScaleAARGBA_helper_y(sptr, yap, Cy, sow, r, g, b, a);
+ qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, r, g, b, a);
int xap = xapoints[x];
if (xap > 0) {
int rr, gg, bb, aa;
- qt_qimageScaleAARGBA_helper_y(sptr + 1, yap, Cy, sow, rr, gg, bb, aa);
+ qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, rr, gg, bb, aa);
r = r * (256 - xap);
g = g * (256 - xap);
@@ -484,12 +439,12 @@ static void qt_qimageScaleAARGBA_down_x_up_y(QImageScaleInfo *isi, unsigned int
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
int r, g, b, a;
- qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, r, g, b, a);
+ qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, r, g, b, a);
int yap = yapoints[dyy + y];
if (yap > 0) {
int rr, gg, bb, aa;
- qt_qimageScaleAARGBA_helper_x(sptr + sow, xap, Cx, rr, gg, bb, aa);
+ qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, rr, gg, bb, aa);
r = r * (256 - yap);
g = g * (256 - yap);
@@ -528,7 +483,7 @@ static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int *des
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
int rx, gx, bx, ax;
- qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, rx, gx, bx, ax);
+ qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
int r = ((rx>>4) * yap);
int g = ((gx>>4) * yap);
@@ -538,14 +493,14 @@ static void qt_qimageScaleAARGBA_down_xy(QImageScaleInfo *isi, unsigned int *des
int j;
for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
sptr += sow;
- qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, rx, gx, bx, ax);
+ qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
r += ((rx>>4) * Cy);
g += ((gx>>4) * Cy);
b += ((bx>>4) * Cy);
a += ((ax>>4) * Cy);
}
sptr += sow;
- qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, rx, gx, bx, ax);
+ qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, rx, gx, bx, ax);
r += ((rx>>4) * j);
g += ((gx>>4) * j);
@@ -609,40 +564,22 @@ static void qt_qimageScaleAARGB(QImageScaleInfo *isi, unsigned int *dest,
}
-inline static void qt_qimageScaleAARGB_helper_x(const unsigned int *pix, int xap, int Cx, int &r, int &g, int &b)
+inline static void qt_qimageScaleAARGB_helper(const unsigned int *pix, int xyap, int Cxy, int step, int &r, int &g, int &b)
{
- r = R_VAL(pix) * xap;
- g = G_VAL(pix) * xap;
- b = B_VAL(pix) * xap;
+ r = qRed(*pix) * xyap;
+ g = qGreen(*pix) * xyap;
+ b = qBlue(*pix) * xyap;
int j;
- for (j = (1 << 14) - xap; j > Cx; j -= Cx ){
- pix++;
- r += R_VAL(pix) * Cx;
- g += G_VAL(pix) * Cx;
- b += B_VAL(pix) * Cx;
- }
- pix++;
- r += R_VAL(pix) * j;
- g += G_VAL(pix) * j;
- b += B_VAL(pix) * j;
-}
-
-inline static void qt_qimageScaleAARGB_helper_y(const unsigned int *pix, int yap, int Cy, int sow, int &r, int &g, int &b)
-{
- r = R_VAL(pix) * yap;
- g = G_VAL(pix) * yap;
- b = B_VAL(pix) * yap;
- int j;
- for (j = (1 << 14) - yap; j > Cy; j -= Cy ){
- pix += sow;
- r += R_VAL(pix) * Cy;
- g += G_VAL(pix) * Cy;
- b += B_VAL(pix) * Cy;
- }
- pix += sow;
- r += R_VAL(pix) * j;
- g += G_VAL(pix) * j;
- b += B_VAL(pix) * j;
+ for (j = (1 << 14) - xyap; j > Cxy; j -= Cxy) {
+ pix += step;
+ r += qRed(*pix) * Cxy;
+ g += qGreen(*pix) * Cxy;
+ b += qBlue(*pix) * Cxy;
+ }
+ pix += step;
+ r += qRed(*pix) * j;
+ g += qGreen(*pix) * j;
+ b += qBlue(*pix) * j;
}
static void qt_qimageScaleAARGB_up_x_down_y(QImageScaleInfo *isi, unsigned int *dest,
@@ -665,12 +602,12 @@ static void qt_qimageScaleAARGB_up_x_down_y(QImageScaleInfo *isi, unsigned int *
for (int x = dxx; x < end; x++) {
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
int r, g, b;
- qt_qimageScaleAARGB_helper_y(sptr, yap, Cy, sow, r, g, b);
+ qt_qimageScaleAARGB_helper(sptr, yap, Cy, sow, r, g, b);
int xap = xapoints[x];
if (xap > 0) {
int rr, bb, gg;
- qt_qimageScaleAARGB_helper_y(sptr + 1, yap, Cy, sow, rr, gg, bb);
+ qt_qimageScaleAARGB_helper(sptr + 1, yap, Cy, sow, rr, gg, bb);
r = r * (256 - xap);
g = g * (256 - xap);
@@ -704,12 +641,12 @@ static void qt_qimageScaleAARGB_down_x_up_y(QImageScaleInfo *isi, unsigned int *
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
int r, g, b;
- qt_qimageScaleAARGB_helper_x(sptr, xap, Cx, r, g, b);
+ qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, r, g, b);
int yap = yapoints[dyy + y];
if (yap > 0) {
int rr, bb, gg;
- qt_qimageScaleAARGB_helper_x(sptr + sow, xap, Cx, rr, gg, bb);
+ qt_qimageScaleAARGB_helper(sptr + sow, xap, Cx, 1, rr, gg, bb);
r = r * (256 - yap);
g = g * (256 - yap);
@@ -745,7 +682,7 @@ static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
int rx, gx, bx;
- qt_qimageScaleAARGB_helper_x(sptr, xap, Cx, rx, gx, bx);
+ qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
int r = (rx >> 4) * yap;
int g = (gx >> 4) * yap;
@@ -754,14 +691,14 @@ static void qt_qimageScaleAARGB_down_xy(QImageScaleInfo *isi, unsigned int *dest
int j;
for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
sptr += sow;
- qt_qimageScaleAARGB_helper_x(sptr, xap, Cx, rx, gx, bx);
+ qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
r += (rx >> 4) * Cy;
g += (gx >> 4) * Cy;
b += (bx >> 4) * Cy;
}
sptr += sow;
- qt_qimageScaleAARGB_helper_x(sptr, xap, Cx, rx, gx, bx);
+ qt_qimageScaleAARGB_helper(sptr, xap, Cx, 1, rx, gx, bx);
r += (rx >> 4) * j;
g += (gx >> 4) * j;
@@ -794,11 +731,11 @@ QImage qSmoothScaleImage(const QImage &src, int dw, int dh)
}
if (src.hasAlphaChannel())
- qt_qimageScaleArgb(scaleinfo, (unsigned int *)buffer.scanLine(0),
- 0, 0, 0, 0, dw, dh, dw, src.bytesPerLine() / 4);
+ qt_qimageScaleAARGBA(scaleinfo, (unsigned int *)buffer.scanLine(0),
+ 0, 0, 0, 0, dw, dh, dw, src.bytesPerLine() / 4);
else
- qt_qimageScaleRgb(scaleinfo, (unsigned int *)buffer.scanLine(0),
- 0, 0, 0, 0, dw, dh, dw, src.bytesPerLine() / 4);
+ qt_qimageScaleAARGB(scaleinfo, (unsigned int *)buffer.scanLine(0),
+ 0, 0, 0, 0, dw, dh, dw, src.bytesPerLine() / 4);
qimageFreeScaleInfo(scaleinfo);
return buffer;
diff --git a/src/gui/painting/qimagescale_sse4.cpp b/src/gui/painting/qimagescale_sse4.cpp
index 565ea4daa1..303e0fd980 100644
--- a/src/gui/painting/qimagescale_sse4.cpp
+++ b/src/gui/painting/qimagescale_sse4.cpp
@@ -41,33 +41,17 @@ QT_BEGIN_NAMESPACE
using namespace QImageScale;
-inline static __m128i qt_qimageScaleAARGBA_helper_x(const unsigned int *pix, int xap, int Cx, const __m128i vxap, const __m128i vCx)
+inline static __m128i qt_qimageScaleAARGBA_helper(const unsigned int *pix, int xyap, int Cxy, int step, const __m128i vxyap, const __m128i vCxy)
{
__m128i vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));
- __m128i vx = _mm_mullo_epi32(vpix, vxap);
+ __m128i vx = _mm_mullo_epi32(vpix, vxyap);
int i;
- for (i = (1 << 14) - xap; i > Cx; i -= Cx) {
- pix++;
+ for (i = (1 << 14) - xyap; i > Cxy; i -= Cxy) {
+ pix += step;
vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));
- vx = _mm_add_epi32(vx, _mm_mullo_epi32(vpix, vCx));
+ vx = _mm_add_epi32(vx, _mm_mullo_epi32(vpix, vCxy));
}
- pix++;
- vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));
- vx = _mm_add_epi32(vx, _mm_mullo_epi32(vpix, _mm_set1_epi32(i)));
- return vx;
-}
-
-inline static __m128i qt_qimageScaleAARGBA_helper_y(const unsigned int *pix, int yap, int Cy, int sow, const __m128i vyap, const __m128i vCy)
-{
- __m128i vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));
- __m128i vx = _mm_mullo_epi32(vpix, vyap);
- int i;
- for (i = (1 << 14) - yap; i > Cy; i -= Cy) {
- pix += sow;
- vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));
- vx = _mm_add_epi32(vx, _mm_mullo_epi32(vpix, vCy));
- }
- pix += sow;
+ pix += step;
vpix = _mm_cvtepu8_epi32(_mm_cvtsi32_si128(*pix));
vx = _mm_add_epi32(vx, _mm_mullo_epi32(vpix, _mm_set1_epi32(i)));
return vx;
@@ -97,13 +81,13 @@ void qt_qimageScaleAARGBA_up_x_down_y_sse4(QImageScaleInfo *isi, unsigned int *d
unsigned int *dptr = dest + dx + ((y + dy) * dow);
for (int x = dxx; x < end; x++) {
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
- __m128i vx = qt_qimageScaleAARGBA_helper_y(sptr, yap, Cy, sow, vyap, vCy);
+ __m128i vx = qt_qimageScaleAARGBA_helper(sptr, yap, Cy, sow, vyap, vCy);
int xap = xapoints[x];
if (xap > 0) {
const __m128i vxap = _mm_set1_epi32(xap);
const __m128i vinvxap = _mm_sub_epi32(v256, vxap);
- __m128i vr = qt_qimageScaleAARGBA_helper_y(sptr + 1, yap, Cy, sow, vyap, vCy);
+ __m128i vr = qt_qimageScaleAARGBA_helper(sptr + 1, yap, Cy, sow, vyap, vCy);
vx = _mm_mullo_epi32(vx, vinvxap);
vr = _mm_mullo_epi32(vr, vxap);
@@ -145,13 +129,13 @@ void qt_qimageScaleAARGBA_down_x_up_y_sse4(QImageScaleInfo *isi, unsigned int *d
const __m128i vxap = _mm_set1_epi32(xap);
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
- __m128i vx = qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, vxap, vCx);
+ __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
int yap = yapoints[dyy + y];
if (yap > 0) {
const __m128i vyap = _mm_set1_epi32(yap);
const __m128i vinvyap = _mm_sub_epi32(v256, vyap);
- __m128i vr = qt_qimageScaleAARGBA_helper_x(sptr + sow, xap, Cx, vxap, vCx);
+ __m128i vr = qt_qimageScaleAARGBA_helper(sptr + sow, xap, Cx, 1, vxap, vCx);
vx = _mm_mullo_epi32(vx, vinvyap);
vr = _mm_mullo_epi32(vr, vyap);
@@ -194,17 +178,17 @@ void qt_qimageScaleAARGBA_down_xy_sse4(QImageScaleInfo *isi, unsigned int *dest,
const __m128i vxap = _mm_set1_epi32(xap);
const unsigned int *sptr = ypoints[dyy + y] + xpoints[x];
- __m128i vx = qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, vxap, vCx);
+ __m128i vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
__m128i vr = _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vyap);
int j;
for (j = (1 << 14) - yap; j > Cy; j -= Cy) {
sptr += sow;
- vx = qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, vxap, vCx);
+ vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), vCy));
}
sptr += sow;
- vx = qt_qimageScaleAARGBA_helper_x(sptr, xap, Cx, vxap, vCx);
+ vx = qt_qimageScaleAARGBA_helper(sptr, xap, Cx, 1, vxap, vCx);
vr = _mm_add_epi32(vr, _mm_mullo_epi32(_mm_srli_epi32(vx, 4), _mm_set1_epi32(j)));
vr = _mm_srli_epi32(vr, 24);
diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp
index 36e0bbe223..bbf8e8f170 100644
--- a/src/gui/painting/qpaintdevice.cpp
+++ b/src/gui/painting/qpaintdevice.cpp
@@ -35,7 +35,7 @@
QT_BEGIN_NAMESPACE
-QPaintDevice::QPaintDevice()
+QPaintDevice::QPaintDevice() Q_DECL_NOEXCEPT
{
reserved = 0;
painters = 0;
diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h
index 7c756c66de..4eb972786b 100644
--- a/src/gui/painting/qpaintdevice.h
+++ b/src/gui/painting/qpaintdevice.h
@@ -80,7 +80,7 @@ public:
int depth() const { return metric(PdmDepth); }
protected:
- QPaintDevice();
+ QPaintDevice() Q_DECL_NOEXCEPT;
virtual int metric(PaintDeviceMetric metric) const;
virtual void initPainter(QPainter *painter) const;
virtual QPaintDevice *redirected(QPoint *offset) const;
diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp
index 0f80cd18a0..f00bc8d9df 100644
--- a/src/gui/painting/qpaintengineex.cpp
+++ b/src/gui/painting/qpaintengineex.cpp
@@ -238,7 +238,7 @@ bool QPaintEngineExPrivate::hasClipOperations() const
*
*/
-static QPainterPath::ElementType qpaintengineex_ellipse_types[] = {
+static const QPainterPath::ElementType qpaintengineex_ellipse_types[] = {
QPainterPath::MoveToElement,
QPainterPath::CurveToElement,
QPainterPath::CurveToDataElement,
@@ -257,7 +257,7 @@ static QPainterPath::ElementType qpaintengineex_ellipse_types[] = {
QPainterPath::CurveToDataElement
};
-static QPainterPath::ElementType qpaintengineex_line_types_16[] = {
+static const QPainterPath::ElementType qpaintengineex_line_types_16[] = {
QPainterPath::MoveToElement, QPainterPath::LineToElement,
QPainterPath::MoveToElement, QPainterPath::LineToElement,
QPainterPath::MoveToElement, QPainterPath::LineToElement,
@@ -276,7 +276,7 @@ static QPainterPath::ElementType qpaintengineex_line_types_16[] = {
QPainterPath::MoveToElement, QPainterPath::LineToElement
};
-static QPainterPath::ElementType qpaintengineex_rect4_types_32[] = {
+static const QPainterPath::ElementType qpaintengineex_rect4_types_32[] = {
QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 1
QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 2
QPainterPath::MoveToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, QPainterPath::LineToElement, // 3
@@ -312,7 +312,7 @@ static QPainterPath::ElementType qpaintengineex_rect4_types_32[] = {
};
-static QPainterPath::ElementType qpaintengineex_roundedrect_types[] = {
+static const QPainterPath::ElementType qpaintengineex_roundedrect_types[] = {
QPainterPath::MoveToElement,
QPainterPath::LineToElement,
QPainterPath::CurveToElement,
diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp
index e3c6eabbc3..e2f267d7ee 100644
--- a/src/gui/painting/qpainterpath.cpp
+++ b/src/gui/painting/qpainterpath.cpp
@@ -521,7 +521,7 @@ void QPainterPath::setElementPositionAt(int i, qreal x, qreal y)
/*!
Constructs an empty QPainterPath object.
*/
-QPainterPath::QPainterPath()
+QPainterPath::QPainterPath() Q_DECL_NOEXCEPT
: d_ptr(0)
{
}
@@ -3057,20 +3057,19 @@ qreal QPainterPath::slopeAtPercent(qreal t) const
//tangent line
qreal slope = 0;
-#define SIGN(x) ((x < 0)?-1:1)
if (m1)
slope = m2/m1;
else {
- //windows doesn't define INFINITY :(
-#ifdef INFINITY
- slope = INFINITY*SIGN(m2);
-#else
- if (sizeof(qreal) == sizeof(double)) {
- return 1.79769313486231570e+308;
+ if (std::numeric_limits<qreal>::has_infinity) {
+ slope = (m2 < 0) ? -std::numeric_limits<qreal>::infinity()
+ : std::numeric_limits<qreal>::infinity();
} else {
- return ((qreal)3.40282346638528860e+38);
+ if (sizeof(qreal) == sizeof(double)) {
+ return 1.79769313486231570e+308;
+ } else {
+ return ((qreal)3.40282346638528860e+38);
+ }
}
-#endif
}
return slope;
diff --git a/src/gui/painting/qpainterpath.h b/src/gui/painting/qpainterpath.h
index eb32782a96..4a7bd98234 100644
--- a/src/gui/painting/qpainterpath.h
+++ b/src/gui/painting/qpainterpath.h
@@ -81,16 +81,16 @@ public:
inline bool operator!=(const Element &e) const { return !operator==(e); }
};
- QPainterPath();
+ QPainterPath() Q_DECL_NOEXCEPT;
explicit QPainterPath(const QPointF &startPoint);
QPainterPath(const QPainterPath &other);
QPainterPath &operator=(const QPainterPath &other);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QPainterPath &operator=(QPainterPath &&other)
+ inline QPainterPath &operator=(QPainterPath &&other) Q_DECL_NOEXCEPT
{ qSwap(d_ptr, other.d_ptr); return *this; }
#endif
~QPainterPath();
- inline void swap(QPainterPath &other) { d_ptr.swap(other.d_ptr); }
+ inline void swap(QPainterPath &other) Q_DECL_NOEXCEPT { d_ptr.swap(other.d_ptr); }
void closeSubpath();
@@ -147,8 +147,8 @@ public:
void translate(qreal dx, qreal dy);
inline void translate(const QPointF &offset);
- QPainterPath translated(qreal dx, qreal dy) const;
- inline QPainterPath translated(const QPointF &offset) const;
+ QPainterPath translated(qreal dx, qreal dy) const Q_REQUIRED_RESULT;
+ inline QPainterPath translated(const QPointF &offset) const Q_REQUIRED_RESULT;
QRectF boundingRect() const;
QRectF controlPointRect() const;
@@ -158,7 +158,7 @@ public:
bool isEmpty() const;
- QPainterPath toReversed() const;
+ QPainterPath toReversed() const Q_REQUIRED_RESULT;
QList<QPolygonF> toSubpathPolygons(const QMatrix &matrix = QMatrix()) const;
QList<QPolygonF> toFillPolygons(const QMatrix &matrix = QMatrix()) const;
QPolygonF toFillPolygon(const QMatrix &matrix = QMatrix()) const;
@@ -178,12 +178,12 @@ public:
bool intersects(const QPainterPath &p) const;
bool contains(const QPainterPath &p) const;
- QPainterPath united(const QPainterPath &r) const;
- QPainterPath intersected(const QPainterPath &r) const;
- QPainterPath subtracted(const QPainterPath &r) const;
- QPainterPath subtractedInverted(const QPainterPath &r) const;
+ QPainterPath united(const QPainterPath &r) const Q_REQUIRED_RESULT;
+ QPainterPath intersected(const QPainterPath &r) const Q_REQUIRED_RESULT;
+ QPainterPath subtracted(const QPainterPath &r) const Q_REQUIRED_RESULT;
+ QPainterPath subtractedInverted(const QPainterPath &r) const Q_REQUIRED_RESULT;
- QPainterPath simplified() const;
+ QPainterPath simplified() const Q_REQUIRED_RESULT;
bool operator==(const QPainterPath &other) const;
bool operator!=(const QPainterPath &other) const;
diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp
index 3f2ebb92a0..6ea0800538 100644
--- a/src/gui/painting/qpdf.cpp
+++ b/src/gui/painting/qpdf.cpp
@@ -384,7 +384,7 @@ QByteArray QPdf::generateDashes(const QPen &pen)
-static const char* pattern_for_brush[] = {
+static const char* const pattern_for_brush[] = {
0, // NoBrush
0, // SolidPattern
"0 J\n"
diff --git a/src/gui/painting/qplatformbackingstore.cpp b/src/gui/painting/qplatformbackingstore.cpp
index 24ea3f4cdd..62492980de 100644
--- a/src/gui/painting/qplatformbackingstore.cpp
+++ b/src/gui/painting/qplatformbackingstore.cpp
@@ -83,9 +83,10 @@ public:
struct QBackingstoreTextureInfo
{
- QWidget *widget; // may be null
+ void *source; // may be null
GLuint textureId;
QRect rect;
+ QRect clipRect;
QPlatformTextureList::Flags flags;
};
@@ -124,10 +125,10 @@ GLuint QPlatformTextureList::textureId(int index) const
return d->textures.at(index).textureId;
}
-QWidget *QPlatformTextureList::widget(int index)
+void *QPlatformTextureList::source(int index)
{
Q_D(const QPlatformTextureList);
- return d->textures.at(index).widget;
+ return d->textures.at(index).source;
}
QPlatformTextureList::Flags QPlatformTextureList::flags(int index) const
@@ -142,6 +143,12 @@ QRect QPlatformTextureList::geometry(int index) const
return d->textures.at(index).rect;
}
+QRect QPlatformTextureList::clipRect(int index) const
+{
+ Q_D(const QPlatformTextureList);
+ return d->textures.at(index).clipRect;
+}
+
void QPlatformTextureList::lock(bool on)
{
Q_D(QPlatformTextureList);
@@ -157,13 +164,15 @@ bool QPlatformTextureList::isLocked() const
return d->locked;
}
-void QPlatformTextureList::appendTexture(QWidget *widget, GLuint textureId, const QRect &geometry, Flags flags)
+void QPlatformTextureList::appendTexture(void *source, GLuint textureId, const QRect &geometry,
+ const QRect &clipRect, Flags flags)
{
Q_D(QPlatformTextureList);
QBackingstoreTextureInfo bi;
- bi.widget = widget;
+ bi.source = source;
bi.textureId = textureId;
bi.rect = geometry;
+ bi.clipRect = clipRect;
bi.flags = flags;
d->textures.append(bi);
}
@@ -198,7 +207,7 @@ void QPlatformTextureList::clear()
#ifndef QT_NO_OPENGL
-static QRect deviceRect(const QRect &rect, QWindow *window)
+static inline QRect deviceRect(const QRect &rect, QWindow *window)
{
QRect deviceRect(rect.topLeft() * window->devicePixelRatio(),
rect.size() * window->devicePixelRatio());
@@ -219,6 +228,32 @@ static QRegion deviceRegion(const QRegion &region, QWindow *window)
return deviceRegion;
}
+static inline QRect toBottomLeftRect(const QRect &topLeftRect, int windowHeight)
+{
+ return QRect(topLeftRect.x(), windowHeight - topLeftRect.bottomRight().y() - 1,
+ topLeftRect.width(), topLeftRect.height());
+}
+
+static void blit(const QPlatformTextureList *textures, int idx, QWindow *window, const QRect &deviceWindowRect,
+ QOpenGLTextureBlitter *blitter)
+{
+ const QRect rectInWindow = textures->geometry(idx);
+ QRect clipRect = textures->clipRect(idx);
+ if (clipRect.isEmpty())
+ clipRect = QRect(QPoint(0, 0), rectInWindow.size());
+ const QRect clippedRectInWindow = rectInWindow & clipRect.translated(rectInWindow.topLeft());
+ const QRect srcRect = toBottomLeftRect(clipRect, rectInWindow.height());
+
+ const QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(deviceRect(clippedRectInWindow, window),
+ deviceWindowRect);
+
+ const QMatrix3x3 source = QOpenGLTextureBlitter::sourceTransform(deviceRect(srcRect, window),
+ deviceRect(rectInWindow, window).size(),
+ QOpenGLTextureBlitter::OriginBottomLeft);
+
+ blitter->blit(textures->textureId(idx), target, source);
+}
+
/*!
Flushes the given \a region from the specified \a window onto the
screen, and composes it with the specified \a textures.
@@ -254,15 +289,12 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
d_ptr->blitter->bind();
- QRect windowRect(QPoint(), window->size() * window->devicePixelRatio());
+ const QRect deviceWindowRect = deviceRect(QRect(QPoint(), window->size()), window);
// Textures for renderToTexture widgets.
for (int i = 0; i < textures->count(); ++i) {
- if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
- QRect targetRect = deviceRect(textures->geometry(i), window);
- QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, windowRect);
- d_ptr->blitter->blit(textures->textureId(i), target, QOpenGLTextureBlitter::OriginBottomLeft);
- }
+ if (!textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop))
+ blit(textures, i, window, deviceWindowRect, d_ptr->blitter);
}
funcs->glEnable(GL_BLEND);
@@ -272,6 +304,7 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
// semi-transparency even when it is not wanted.
funcs->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_FALSE);
+ // Backingstore texture with the normal widgets.
GLuint textureId = 0;
QOpenGLTextureBlitter::Origin origin = QOpenGLTextureBlitter::OriginTopLeft;
if (QPlatformGraphicsBuffer *graphicsBuffer = this->graphicsBuffer()) {
@@ -307,12 +340,15 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
origin = QOpenGLTextureBlitter::OriginBottomLeft;
textureId = d_ptr->textureId;
} else {
- // Backingstore texture with the normal widgets.
- textureId = toTexture(deviceRegion(region, window), &d_ptr->textureSize, &d_ptr->needsSwizzle);
+ TextureFlags flags = 0;
+ textureId = toTexture(deviceRegion(region, window), &d_ptr->textureSize, &flags);
+ d_ptr->needsSwizzle = (flags & TextureSwizzle) != 0;
+ if (flags & TextureFlip)
+ origin = QOpenGLTextureBlitter::OriginBottomLeft;
}
if (textureId) {
- QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(QRect(QPoint(), d_ptr->textureSize), windowRect);
+ QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(QRect(QPoint(), d_ptr->textureSize), deviceWindowRect);
if (d_ptr->needsSwizzle)
d_ptr->blitter->setSwizzleRB(true);
d_ptr->blitter->blit(textureId, target, origin);
@@ -322,11 +358,8 @@ void QPlatformBackingStore::composeAndFlush(QWindow *window, const QRegion &regi
// Textures for renderToTexture widgets that have WA_AlwaysStackOnTop set.
for (int i = 0; i < textures->count(); ++i) {
- if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop)) {
- QRect targetRect = deviceRect(textures->geometry(i), window);
- QMatrix4x4 target = QOpenGLTextureBlitter::targetTransform(targetRect, windowRect);
- d_ptr->blitter->blit(textures->textureId(i), target, QOpenGLTextureBlitter::OriginBottomLeft);
- }
+ if (textures->flags(i).testFlag(QPlatformTextureList::StacksOnTop))
+ blit(textures, i, window, deviceWindowRect, d_ptr->blitter);
}
funcs->glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -354,43 +387,55 @@ QImage QPlatformBackingStore::toImage() const
backingstore as an OpenGL texture. \a dirtyRegion is the part of the
backingstore which may have changed since the last call to this function. The
caller of this function must ensure that there is a current context.
+
The size of the texture is returned in \a textureSize.
The ownership of the texture is not transferred. The caller must not store
the return value between calls, but instead call this function before each use.
- The default implementation returns a cached texture if \a dirtyRegion is
- empty and the window has not been resized, otherwise it retrieves the
- content using toImage() and performs a texture upload.
+ The default implementation returns a cached texture if \a dirtyRegion is empty and
+ \a textureSize matches the backingstore size, otherwise it retrieves the content using
+ toImage() and performs a texture upload. This works only if the value of \a textureSize
+ is preserved between the calls to this function.
+
+ If the red and blue components have to swapped, \a flags will be set to include \c
+ TextureSwizzle. This allows creating textures from images in formats like
+ QImage::Format_RGB32 without any further image conversion. Instead, the swizzling will
+ be done in the shaders when performing composition. Other formats, that do not need
+ such swizzling due to being already byte ordered RGBA, for example
+ QImage::Format_RGBA8888, must result in having \a needsSwizzle set to false.
- If the red and blue components have to swapped, \a needsSwizzle will be set to \c true.
- This allows creating textures from images in formats like QImage::Format_RGB32 without
- any further image conversion. Instead, the swizzling will be done in the shaders when
- performing composition. Other formats, that do not need such swizzling due to being
- already byte ordered RGBA, for example QImage::Format_RGBA8888, must result in having \a
- needsSwizzle set to false.
+ If the image has to be flipped (e.g. because the texture is attached to an FBO), \a
+ flags will be set to include \c TextureFlip.
*/
-GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textureSize, bool *needsSwizzle) const
+GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const
{
+ Q_ASSERT(textureSize);
+ Q_ASSERT(flags);
+
QImage image = toImage();
QSize imageSize = image.size();
- if (imageSize.isEmpty())
+
+ *flags = 0;
+ if (image.format() == QImage::Format_RGB32)
+ *flags |= TextureSwizzle;
+
+ if (imageSize.isEmpty()) {
+ *textureSize = imageSize;
return 0;
+ }
- bool resized = d_ptr->textureSize != imageSize;
+ // Must rely on the input only, not d_ptr.
+ // With the default composeAndFlush() textureSize is &d_ptr->textureSize.
+ bool resized = *textureSize != imageSize;
if (dirtyRegion.isEmpty() && !resized)
return d_ptr->textureId;
+ *textureSize = imageSize;
+
// Fast path for RGB32 and RGBA8888, convert everything else to RGBA8888.
- if (image.format() == QImage::Format_RGB32) {
- if (needsSwizzle)
- *needsSwizzle = true;
- } else {
- if (needsSwizzle)
- *needsSwizzle = false;
- if (image.format() != QImage::Format_RGBA8888)
- image = image.convertToFormat(QImage::Format_RGBA8888);
- }
+ if (image.format() != QImage::Format_RGB32 && image.format() != QImage::Format_RGBA8888)
+ image = image.convertToFormat(QImage::Format_RGBA8888);
QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions();
@@ -412,8 +457,6 @@ GLuint QPlatformBackingStore::toTexture(const QRegion &dirtyRegion, QSize *textu
funcs->glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, imageSize.width(), imageSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE,
const_cast<uchar*>(image.constBits()));
- if (textureSize)
- *textureSize = imageSize;
} else {
funcs->glBindTexture(GL_TEXTURE_2D, d_ptr->textureId);
QRect imageRect = image.rect();
diff --git a/src/gui/painting/qplatformbackingstore.h b/src/gui/painting/qplatformbackingstore.h
index df98ebf51b..eac97e9cf6 100644
--- a/src/gui/painting/qplatformbackingstore.h
+++ b/src/gui/painting/qplatformbackingstore.h
@@ -82,12 +82,14 @@ public:
bool isEmpty() const { return count() == 0; }
GLuint textureId(int index) const;
QRect geometry(int index) const;
- QWidget *widget(int index);
+ QRect clipRect(int index) const;
+ void *source(int index);
Flags flags(int index) const;
void lock(bool on);
bool isLocked() const;
- void appendTexture(QWidget *widget, GLuint textureId, const QRect &geometry, Flags flags = 0);
+ void appendTexture(void *source, GLuint textureId, const QRect &geometry,
+ const QRect &clipRect = QRect(), Flags flags = 0);
void clear();
Q_SIGNALS:
@@ -114,7 +116,12 @@ public:
QPlatformTextureList *textures, QOpenGLContext *context,
bool translucentBackground);
virtual QImage toImage() const;
- virtual GLuint toTexture(const QRegion &dirtyRegion, QSize *textureSize, bool *needsSwizzle) const;
+ enum TextureFlag {
+ TextureSwizzle = 0x01,
+ TextureFlip = 0x02
+ };
+ Q_DECLARE_FLAGS(TextureFlags, TextureFlag)
+ virtual GLuint toTexture(const QRegion &dirtyRegion, QSize *textureSize, TextureFlags *flags) const;
#endif
virtual QPlatformGraphicsBuffer *graphicsBuffer() const;
@@ -130,6 +137,10 @@ private:
QPlatformBackingStorePrivate *d_ptr;
};
+#ifndef QT_NO_OPENGL
+Q_DECLARE_OPERATORS_FOR_FLAGS(QPlatformBackingStore::TextureFlags)
+#endif
+
QT_END_NAMESPACE
#endif // QPLATFORMBACKINGSTORE_H
diff --git a/src/gui/painting/qpolygon.h b/src/gui/painting/qpolygon.h
index ee7d4d31ad..1549ebe2b5 100644
--- a/src/gui/painting/qpolygon.h
+++ b/src/gui/painting/qpolygon.h
@@ -138,7 +138,7 @@ public:
void translate(const QPointF &offset);
inline QPolygonF translated(qreal dx, qreal dy) const;
- QPolygonF translated(const QPointF &offset) const;
+ QPolygonF translated(const QPointF &offset) const Q_REQUIRED_RESULT;
QPolygon toPolygon() const;
@@ -148,9 +148,9 @@ public:
bool containsPoint(const QPointF &pt, Qt::FillRule fillRule) const;
- QPolygonF united(const QPolygonF &r) const;
- QPolygonF intersected(const QPolygonF &r) const;
- QPolygonF subtracted(const QPolygonF &r) const;
+ QPolygonF united(const QPolygonF &r) const Q_REQUIRED_RESULT;
+ QPolygonF intersected(const QPolygonF &r) const Q_REQUIRED_RESULT;
+ QPolygonF subtracted(const QPolygonF &r) const Q_REQUIRED_RESULT;
};
inline QPolygonF::QPolygonF(int asize) : QVector<QPointF>(asize) {}
diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h
index bab07b5a5d..ab2404e887 100644
--- a/src/gui/painting/qregion.h
+++ b/src/gui/painting/qregion.h
@@ -66,10 +66,10 @@ public:
~QRegion();
QRegion &operator=(const QRegion &);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QRegion &operator=(QRegion &&other)
+ inline QRegion &operator=(QRegion &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); return *this; }
#endif
- inline void swap(QRegion &other) { qSwap(d, other.d); }
+ inline void swap(QRegion &other) Q_DECL_NOEXCEPT { qSwap(d, other.d); }
bool isEmpty() const;
bool isNull() const;
diff --git a/src/gui/painting/qstroker_p.h b/src/gui/painting/qstroker_p.h
index eda65b8e2f..f967c091df 100644
--- a/src/gui/painting/qstroker_p.h
+++ b/src/gui/painting/qstroker_p.h
@@ -201,7 +201,7 @@ public:
QStroker();
~QStroker();
- void setStrokeWidth(qfixed width) { m_strokeWidth = width; }
+ void setStrokeWidth(qfixed width) { m_strokeWidth = width; m_curveThreshold = width >= 1 ? 1.0/width : 0.5;}
qfixed strokeWidth() const { return m_strokeWidth; }
void setCapStyle(Qt::PenCapStyle capStyle) { m_capStyle = joinModeForCap(capStyle); }
diff --git a/src/gui/painting/qtransform.cpp b/src/gui/painting/qtransform.cpp
index 4b3f0b30dc..fca2b72249 100644
--- a/src/gui/painting/qtransform.cpp
+++ b/src/gui/painting/qtransform.cpp
@@ -1102,7 +1102,7 @@ QDataStream & operator>>(QDataStream &s, QTransform &t)
#ifndef QT_NO_DEBUG_STREAM
QDebug operator<<(QDebug dbg, const QTransform &m)
{
- static const char *typeStr[] =
+ static const char *const typeStr[] =
{
"TxNone",
"TxTranslate",
diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h
index cc78ea7f45..72e4197fc5 100644
--- a/src/gui/text/qfont.h
+++ b/src/gui/text/qfont.h
@@ -237,7 +237,7 @@ public:
operator QVariant() const;
bool isCopyOf(const QFont &) const;
#ifdef Q_COMPILER_RVALUE_REFS
- inline QFont &operator=(QFont &&other)
+ inline QFont &operator=(QFont &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; }
#endif
diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp
index 126f0bf3ec..dae4d560a8 100644
--- a/src/gui/text/qfontdatabase.cpp
+++ b/src/gui/text/qfontdatabase.cpp
@@ -121,6 +121,8 @@ static int getFontWeight(const QString &weightString)
return QFont::DemiBold;
return QFont::Bold;
}
+ if (s.contains(QLatin1String("thin")))
+ return QFont::Thin;
if (s.contains(QLatin1String("light")))
return QFont::Light;
if (s.contains(QLatin1String("black")))
@@ -346,7 +348,6 @@ struct QtFontFamily
populated(false),
fixedPitch(false),
name(n), count(0), foundries(0)
- , askedForFallback(false)
{
memset(writingSystems, 0, sizeof(writingSystems));
}
@@ -364,8 +365,6 @@ struct QtFontFamily
int count;
QtFontFoundry **foundries;
- QStringList fallbackFamilies;
- bool askedForFallback;
unsigned char writingSystems[QFontDatabase::WritingSystemsCount];
bool matchesFamilyName(const QString &familyName) const;
@@ -630,6 +629,7 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe
} else {
fontDef->pixelSize = desc.size->pixelSize;
}
+ fontDef->pointSize = request.pointSize;
fontDef->styleHint = request.styleHint;
fontDef->styleStrategy = request.styleStrategy;
@@ -758,6 +758,7 @@ QString qt_resolveFontFamilyAlias(const QString &alias)
static QStringList fallbackFamilies(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script)
{
+ // make sure that the db has all fallback families
QStringList retList = QGuiApplicationPrivate::platformIntegration()->fontDatabase()->fallbacksForFamily(family,style,styleHint,script);
QFontDatabasePrivate *db = privateDb();
@@ -883,20 +884,13 @@ QFontEngine *loadEngine(int script, const QFontDef &request,
QFontEngine *engine = loadSingleEngine(script, request, family, foundry, style, size);
Q_ASSERT(!engine || engine->type() != QFontEngine::Multi);
if (engine && !(request.styleStrategy & QFont::NoFontMerging) && !engine->symbol) {
- // make sure that the db has all fallback families
- if (family && !family->askedForFallback) {
- QFont::Style fontStyle = QFont::Style(style->key.style);
- QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
- if (styleHint == QFont::AnyStyle && request.fixedPitch)
- styleHint = QFont::TypeWriter;
- family->fallbackFamilies = fallbackFamilies(family->name, fontStyle, styleHint, QChar::Script(script));
+ QStringList fallbacks = request.fallBackFamilies;
- family->askedForFallback = true;
- }
+ QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
+ if (styleHint == QFont::AnyStyle && request.fixedPitch)
+ styleHint = QFont::TypeWriter;
- QStringList fallbacks = request.fallBackFamilies;
- if (family)
- fallbacks += family->fallbackFamilies;
+ fallbacks += fallbackFamilies(family->name, QFont::Style(style->key.style), styleHint, QChar::Script(script));
QPlatformFontDatabase *pfdb = QGuiApplicationPrivate::platformIntegration()->fontDatabase();
QFontEngineMulti *pfMultiEngine = pfdb->fontEngineMulti(engine, QChar::Script(script));
@@ -2505,9 +2499,7 @@ bool QFontDatabase::supportsThreadedFontRendering()
/*!
\internal
*/
-QFontEngine *
-QFontDatabase::findFont(int script, const QFontPrivate *fp,
- const QFontDef &request, bool multi)
+QFontEngine *QFontDatabase::findFont(const QFontDef &request, int script)
{
QMutexLocker locker(fontDatabaseMutex());
@@ -2515,6 +2507,11 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
initializeDb();
QFontEngine *engine;
+
+ // Until we specifically asked not to, try looking for Multi font engine
+ // first, the last '1' indicates that we want Multi font engine instead
+ // of single ones
+ bool multi = !(request.styleStrategy & QFont::NoFontMerging);
QFontCache::Key key(request, script, multi ? 1 : 0);
engine = QFontCache::instance()->findEngine(key);
if (engine) {
@@ -2529,6 +2526,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
if (qt_enable_test_font && request.family == QLatin1String("__Qt__Box__Engine__")) {
engine =new QTestFontEngine(request.pixelSize);
engine->fontDef = request;
+ return engine;
}
QtFontDesc desc;
@@ -2536,24 +2534,14 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
int index = match(script, request, family_name, foundry_name, &desc, blackListed);
if (index >= 0) {
engine = loadEngine(script, request, desc.family, desc.foundry, desc.style, desc.size);
- if (!engine)
+ if (engine)
+ initFontDef(desc, request, &engine->fontDef, multi);
+ else
blackListed.append(index);
} else {
FM_DEBUG(" NO MATCH FOUND\n");
}
- if (engine && engine->type() != QFontEngine::TestFontEngine) {
- initFontDef(desc, request, &engine->fontDef, engine->type() == QFontEngine::Multi);
-
- if (fp) {
- QFontDef def = request;
- if (def.family.isEmpty()) {
- def.family = fp->request.family;
- def.family = def.family.left(def.family.indexOf(QLatin1Char(',')));
- }
- }
- }
-
if (!engine) {
if (!request.family.isEmpty()) {
QFont::StyleHint styleHint = QFont::StyleHint(request.styleHint);
@@ -2583,7 +2571,7 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
loadDef.family = desc.family->name;
engine = loadEngine(script, loadDef, desc.family, desc.foundry, desc.style, desc.size);
if (engine)
- initFontDef(desc, loadDef, &engine->fontDef, engine->type() == QFontEngine::Multi);
+ initFontDef(desc, loadDef, &engine->fontDef, multi);
else
blackListed.append(index);
}
@@ -2598,12 +2586,6 @@ QFontDatabase::findFont(int script, const QFontPrivate *fp,
FM_DEBUG("returning box engine");
}
- if (fp && fp->dpi > 0) {
- engine->fontDef.pointSize = qreal(double((engine->fontDef.pixelSize * 72) / fp->dpi));
- } else {
- engine->fontDef.pointSize = request.pointSize;
- }
-
return engine;
}
@@ -2671,12 +2653,16 @@ void QFontDatabase::load(const QFontPrivate *d, int script)
for (; !fe && it != end; ++it) {
req.family = *it;
- fe = QFontDatabase::findFont(script, d, req, multi);
- if (fe && (fe->type()==QFontEngine::Box) && !req.family.isEmpty()) {
- if (fe->ref.load() == 0)
- delete fe;
-
- fe = 0;
+ fe = QFontDatabase::findFont(req, script);
+ if (fe) {
+ if (fe->type() == QFontEngine::Box && !req.family.isEmpty()) {
+ if (fe->ref.load() == 0)
+ delete fe;
+ fe = 0;
+ } else {
+ if (d->dpi > 0)
+ fe->fontDef.pointSize = qreal(double((fe->fontDef.pixelSize * 72) / d->dpi));
+ }
}
// No need to check requested fallback families again
diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h
index 6d738d96be..02bc8e8a08 100644
--- a/src/gui/text/qfontdatabase.h
+++ b/src/gui/text/qfontdatabase.h
@@ -153,7 +153,7 @@ private:
static void createDatabase();
static void parseFontName(const QString &name, QString &foundry, QString &family);
static QString resolveFontFamilyAlias(const QString &family);
- static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request, bool multi = false);
+ static QFontEngine *findFont(const QFontDef &request, int script);
static void load(const QFontPrivate *d, int script);
friend struct QFontDef;
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index b028d868b9..87e6c30afe 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -1641,7 +1641,7 @@ QFontEngine *QFontEngineMulti::loadEngine(int at)
request.styleStrategy |= QFont::NoFontMerging;
request.family = fallbackFamilyAt(at - 1);
- if (QFontEngine *engine = QFontDatabase::findFont(m_script, /*fontprivate = */0, request, /*multi = */false)) {
+ if (QFontEngine *engine = QFontDatabase::findFont(request, m_script)) {
engine->fontDef = request;
return engine;
}
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 931c71dc63..37be0afccf 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -115,7 +115,7 @@ public:
QtFreetypeData::~QtFreetypeData()
{
- for (QHash<QFontEngine::FaceId, QFreetypeFace *>::ConstIterator iter = faces.begin(); iter != faces.end(); ++iter)
+ for (QHash<QFontEngine::FaceId, QFreetypeFace *>::ConstIterator iter = faces.cbegin(); iter != faces.cend(); ++iter)
iter.value()->cleanup();
faces.clear();
FT_Done_FreeType(library);
diff --git a/src/gui/text/qfontengine_qpf2.cpp b/src/gui/text/qfontengine_qpf2.cpp
index 7e16983b6c..a678b4c8ea 100644
--- a/src/gui/text/qfontengine_qpf2.cpp
+++ b/src/gui/text/qfontengine_qpf2.cpp
@@ -49,7 +49,7 @@ QT_BEGIN_NAMESPACE
//#define DEBUG_HEADER
//#define DEBUG_FONTENGINE
-static QFontEngineQPF2::TagType tagTypes[QFontEngineQPF2::NumTags] = {
+static const QFontEngineQPF2::TagType tagTypes[QFontEngineQPF2::NumTags] = {
QFontEngineQPF2::StringType, // FontName
QFontEngineQPF2::StringType, // FileName
QFontEngineQPF2::UInt32Type, // FileIndex
diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h
index 12aa2dadb4..65ec219a99 100644
--- a/src/gui/text/qfontmetrics.h
+++ b/src/gui/text/qfontmetrics.h
@@ -58,11 +58,12 @@ public:
QFontMetrics &operator=(const QFontMetrics &);
#ifdef Q_COMPILER_RVALUE_REFS
- inline QFontMetrics &operator=(QFontMetrics &&other)
+ inline QFontMetrics &operator=(QFontMetrics &&other) Q_DECL_NOEXCEPT
{ qSwap(d, other.d); return *this; }
#endif
- void swap(QFontMetrics &other) { qSwap(d, other.d); }
+ void swap(QFontMetrics &other) Q_DECL_NOEXCEPT
+ { qSwap(d, other.d); }
int ascent() const;
int descent() const;
diff --git a/src/gui/text/qtextdocumentlayout.cpp b/src/gui/text/qtextdocumentlayout.cpp
index db8a792be7..5864ca0b1a 100644
--- a/src/gui/text/qtextdocumentlayout.cpp
+++ b/src/gui/text/qtextdocumentlayout.cpp
@@ -504,8 +504,6 @@ public:
void layoutBlock(const QTextBlock &bl, int blockPosition, const QTextBlockFormat &blockFormat,
QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, const QTextBlockFormat *previousBlockFormat);
void layoutFlow(QTextFrame::Iterator it, QTextLayoutStruct *layoutStruct, int layoutFrom, int layoutTo, QFixed width = 0);
- void pageBreakInsideTable(QTextTable *table, QTextLayoutStruct *layoutStruct);
-
void floatMargins(const QFixed &y, const QTextLayoutStruct *layoutStruct, QFixed *left, QFixed *right) const;
QFixed findY(QFixed yFrom, const QTextLayoutStruct *layoutStruct, QFixed requiredWidth) const;
diff --git a/src/gui/text/qtexttable.cpp b/src/gui/text/qtexttable.cpp
index e5acccb55b..a75a1aae54 100644
--- a/src/gui/text/qtexttable.cpp
+++ b/src/gui/text/qtexttable.cpp
@@ -1264,12 +1264,6 @@ int QTextTable::columns() const
return d->nCols;
}
-#if 0
-void QTextTable::mergeCells(const QTextCursor &selection)
-{
-}
-#endif
-
/*!
\fn QTextCursor QTextTable::rowStart(const QTextCursor &cursor) const
diff --git a/src/gui/text/qzip.cpp b/src/gui/text/qzip.cpp
index 9f561dcb02..edd3447357 100644
--- a/src/gui/text/qzip.cpp
+++ b/src/gui/text/qzip.cpp
@@ -670,7 +670,7 @@ void QZipReaderPrivate::scanFiles()
void QZipWriterPrivate::addEntry(EntryType type, const QString &fileName, const QByteArray &contents/*, QFile::Permissions permissions, QZip::Method m*/)
{
#ifndef NDEBUG
- static const char *entryTypes[] = {
+ static const char *const entryTypes[] = {
"directory",
"file ",
"symlink " };