diff options
Diffstat (limited to 'src')
122 files changed, 2321 insertions, 344 deletions
diff --git a/src/concurrent/doc/qtconcurrent.qdocconf b/src/concurrent/doc/qtconcurrent.qdocconf index e45047cb51..d8ee963ef5 100644 --- a/src/concurrent/doc/qtconcurrent.qdocconf +++ b/src/concurrent/doc/qtconcurrent.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtConcurrent description = Qt Concurrent Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = qtconcurrent diff --git a/src/corelib/doc/qtcore.qdocconf b/src/corelib/doc/qtcore.qdocconf index c9c8f1da54..7c879cbbfd 100644 --- a/src/corelib/doc/qtcore.qdocconf +++ b/src/corelib/doc/qtcore.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtCore description = Qt Core Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = core diff --git a/src/corelib/global/qlogging.cpp b/src/corelib/global/qlogging.cpp index 5b4726f67d..63dd4c1387 100644 --- a/src/corelib/global/qlogging.cpp +++ b/src/corelib/global/qlogging.cpp @@ -762,7 +762,7 @@ static const char functionTokenC[] = "%{function}"; static const char pidTokenC[] = "%{pid}"; static const char appnameTokenC[] = "%{appname}"; static const char threadidTokenC[] = "%{threadid}"; -static const char timeTokenC[] = "%{time"; +static const char timeTokenC[] = "%{time}"; static const char ifCategoryTokenC[] = "%{if-category}"; static const char ifDebugTokenC[] = "%{if-debug}"; static const char ifWarningTokenC[] = "%{if-warning}"; diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 998a3334c9..3c4a2fac0b 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -179,9 +179,7 @@ QFSFileEngine::~QFSFileEngine() } while (ret == -1 && errno == EINTR); } } - QList<uchar*> keys = d->maps.keys(); - for (int i = 0; i < keys.count(); ++i) - unmap(keys.at(i)); + d->unmapAll(); } /*! @@ -463,6 +461,18 @@ qint64 QFSFileEngine::size() const return d->nativeSize(); } +/*! + \internal +*/ +void QFSFileEnginePrivate::unmapAll() +{ + if (!maps.isEmpty()) { + const QList<uchar*> keys = maps.keys(); // Make a copy since unmap() modifies the map. + for (int i = 0; i < keys.count(); ++i) + unmap(keys.at(i)); + } +} + #ifndef Q_OS_WIN /*! \internal diff --git a/src/corelib/io/qfsfileengine_p.h b/src/corelib/io/qfsfileengine_p.h index 21f38fea1d..b0610b1459 100644 --- a/src/corelib/io/qfsfileengine_p.h +++ b/src/corelib/io/qfsfileengine_p.h @@ -175,6 +175,7 @@ public: uchar *map(qint64 offset, qint64 size, QFile::MemoryMapFlags flags); bool unmap(uchar *ptr); + void unmapAll(); mutable QFileSystemMetaData metaData; diff --git a/src/corelib/io/qtemporaryfile.cpp b/src/corelib/io/qtemporaryfile.cpp index 3cade0ed25..bc6c2f1f06 100644 --- a/src/corelib/io/qtemporaryfile.cpp +++ b/src/corelib/io/qtemporaryfile.cpp @@ -235,6 +235,8 @@ static bool createFileFromTemplate(NativeFileHandle &file, //************* QTemporaryFileEngine QTemporaryFileEngine::~QTemporaryFileEngine() { + Q_D(QFSFileEngine); + d->unmapAll(); QFSFileEngine::close(); } @@ -363,6 +365,7 @@ bool QTemporaryFileEngine::remove() Q_D(QFSFileEngine); // Since the QTemporaryFileEngine::close() does not really close the file, // we must explicitly call QFSFileEngine::close() before we remove it. + d->unmapAll(); QFSFileEngine::close(); if (QFSFileEngine::remove()) { d->fileEntry.clear(); diff --git a/src/corelib/json/qjsonarray.cpp b/src/corelib/json/qjsonarray.cpp index 61bb158ff5..c1e831192a 100644 --- a/src/corelib/json/qjsonarray.cpp +++ b/src/corelib/json/qjsonarray.cpp @@ -138,6 +138,18 @@ QJsonArray::QJsonArray() } /*! + \fn QJsonArray::QJsonArray(std::initializer_list<QJsonValue> args) + \since 5.4 + Creates an array initialized from \a args initialization list. + + QJsonArray can be constructed in a way similar to JSON notation, + for example: + \code + QJsonArray array = { 1, 2.2, QString() }; + \endcode + */ + +/*! \internal */ QJsonArray::QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array) @@ -149,6 +161,19 @@ QJsonArray::QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array) } /*! + This method replaces part of QJsonArray(std::initializer_list<QJsonValue> args) . + The constructor needs to be inline, but we do not want to leak implementation details + of this class. + \note this method is called for an uninitialized object + \internal + */ +void QJsonArray::initialize() +{ + d = 0; + a = 0; +} + +/*! Deletes the array. */ QJsonArray::~QJsonArray() diff --git a/src/corelib/json/qjsonarray.h b/src/corelib/json/qjsonarray.h index 84c162f0a0..4cada7cec1 100644 --- a/src/corelib/json/qjsonarray.h +++ b/src/corelib/json/qjsonarray.h @@ -44,6 +44,9 @@ #include <QtCore/qjsonvalue.h> #include <QtCore/qiterator.h> +#if defined(Q_COMPILER_INITIALIZER_LISTS) +#include <initializer_list> +#endif QT_BEGIN_NAMESPACE @@ -56,6 +59,16 @@ class Q_CORE_EXPORT QJsonArray { public: QJsonArray(); + +#if defined(Q_COMPILER_INITIALIZER_LISTS) || defined(Q_QDOC) + QJsonArray(std::initializer_list<QJsonValue> args) + { + initialize(); + for (std::initializer_list<QJsonValue>::const_iterator i = args.begin(); i != args.end(); ++i) + append(*i); + } +#endif + ~QJsonArray(); QJsonArray(const QJsonArray &other); @@ -212,6 +225,7 @@ private: friend Q_CORE_EXPORT QDebug operator<<(QDebug, const QJsonArray &); QJsonArray(QJsonPrivate::Data *data, QJsonPrivate::Array *array); + void initialize(); void compact(); void detach(uint reserve = 0); diff --git a/src/corelib/tools/qsharedpointer.cpp b/src/corelib/tools/qsharedpointer.cpp index 180f45eb56..e0cd54022e 100644 --- a/src/corelib/tools/qsharedpointer.cpp +++ b/src/corelib/tools/qsharedpointer.cpp @@ -374,12 +374,12 @@ /*! \class QEnableSharedFromThis \inmodule QtCore - \brief A base class that allows to obtain a QSharedPointer for an object already managed by a shared pointer + \brief A base class that allows obtaining a QSharedPointer for an object already managed by a shared pointer \since 5.4 You can inherit this class when you need to create a QSharedPointer - from any instance of a class -- for instance, from within the - object itself. The key point is that the "obvious" technique of + from any instance of a class; for instance, from within the + object itself. The key point is that the technique of just returning QSharedPointer<T>(this) can not be used, because this winds up creating multiple distinct QSharedPointer objects with separate reference counts. For this reason you must never @@ -406,6 +406,27 @@ Q_ASSERT(p == y); // p and q must share ownership } \endcode + + It is also possible to get a shared pointer from an object outside of + the class itself. This is especially useful in code that provides an + interface to scripts, where it is currently not possible to use shared + pointers. For example: + + \code + class ScriptInterface : public QObject + { + Q_OBJECT + + // ... + + public slots: + void slotCalledByScript(Y *managedBySharedPointer) + { + QSharedPointer<Y> yPtr = managedBySharedPointer->sharedFromThis(); + // Some other code unrelated to scripts that expects a QSharedPointer<Y> ... + } + }; + \endcode */ /*! diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index ddc8d630a3..956c6c8a64 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qaccessiblebridge.cpp b/src/gui/accessible/qaccessiblebridge.cpp index 60bc1ae0d1..1250666cd9 100644 --- a/src/gui/accessible/qaccessiblebridge.cpp +++ b/src/gui/accessible/qaccessiblebridge.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qaccessiblebridge.h b/src/gui/accessible/qaccessiblebridge.h index 0a0002af2c..164582af2c 100644 --- a/src/gui/accessible/qaccessiblebridge.h +++ b/src/gui/accessible/qaccessiblebridge.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qaccessibleobject.cpp b/src/gui/accessible/qaccessibleobject.cpp index b01c8e45db..44ebd5709a 100644 --- a/src/gui/accessible/qaccessibleobject.cpp +++ b/src/gui/accessible/qaccessibleobject.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qaccessibleobject.h b/src/gui/accessible/qaccessibleobject.h index 5cc71a121b..233a43f804 100644 --- a/src/gui/accessible/qaccessibleobject.h +++ b/src/gui/accessible/qaccessibleobject.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qaccessibleplugin.cpp b/src/gui/accessible/qaccessibleplugin.cpp index 17b3f52805..4d12d9ec73 100644 --- a/src/gui/accessible/qaccessibleplugin.cpp +++ b/src/gui/accessible/qaccessibleplugin.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qaccessibleplugin.h b/src/gui/accessible/qaccessibleplugin.h index ac56c83f98..08160f244d 100644 --- a/src/gui/accessible/qaccessibleplugin.h +++ b/src/gui/accessible/qaccessibleplugin.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qplatformaccessibility.cpp b/src/gui/accessible/qplatformaccessibility.cpp index 490fb7a407..1e5f8928ad 100644 --- a/src/gui/accessible/qplatformaccessibility.cpp +++ b/src/gui/accessible/qplatformaccessibility.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/accessible/qplatformaccessibility.h b/src/gui/accessible/qplatformaccessibility.h index f86a9b6157..6b8056918d 100644 --- a/src/gui/accessible/qplatformaccessibility.h +++ b/src/gui/accessible/qplatformaccessibility.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/gui/doc/qtgui.qdocconf b/src/gui/doc/qtgui.qdocconf index b1707e1eef..e2194839d2 100644 --- a/src/gui/doc/qtgui.qdocconf +++ b/src/gui/doc/qtgui.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtGui description = Qt GUI Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = gui diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index bb79a139b3..036d0615e3 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -798,6 +798,8 @@ bool QBmpHandler::write(const QImage &img) case QImage::Format_ARGB4444_Premultiplied: case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_A2RGB30_Premultiplied: image = img.convertToFormat(QImage::Format_ARGB32); break; case QImage::Format_RGB16: @@ -806,6 +808,8 @@ bool QBmpHandler::write(const QImage &img) case QImage::Format_RGB555: case QImage::Format_RGB444: case QImage::Format_RGBX8888: + case QImage::Format_BGR30: + case QImage::Format_RGB30: image = img.convertToFormat(QImage::Format_RGB32); break; default: diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index b0b6b27b71..d8c3a8c2eb 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -222,6 +222,16 @@ bool QImageData::checkForAlphaPixels() const } } break; + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_A2RGB30_Premultiplied: { + uchar *bits = data; + for (int y=0; y<height && !has_alpha_pixels; ++y) { + for (int x=0; x<width; ++x) + has_alpha_pixels |= (((uint *)bits)[x] & 0xc0000000) != 0xc0000000; + bits += bytes_per_line; + } + } break; + case QImage::Format_ARGB8555_Premultiplied: case QImage::Format_ARGB8565_Premultiplied: { uchar *bits = data; @@ -701,6 +711,10 @@ bool QImageData::checkForAlphaPixels() const is the same on any architecture if read as bytes 0xRR,0xGG,0xBB,0xAA. \value Format_RGBA8888_Premultiplied The image is stored using a premultiplied 32-bit byte-ordered RGBA format (8-8-8-8). + \value Format_BGR30 The image is stored using a 32-bit BGR format (x-10-10-10). + \value Format_A2BGR30_Premultiplied The image is stored using a 32-bit premultiplied ABGR format (2-10-10-10). + \value Format_RGB30 The image is stored using a 32-bit RGB format (x-10-10-10). + \value Format_A2RGB30_Premultiplied The image is stored using a 32-bit premultiplied ARGB format (2-10-10-10). \note Drawing into a QImage with QImage::Format_Indexed8 is not supported. @@ -708,6 +722,9 @@ bool QImageData::checkForAlphaPixels() const \note Do not render into ARGB32 images using QPainter. Using QImage::Format_ARGB32_Premultiplied is significantly faster. + \note Formats with more than 8 bit per color channel will only be processed by the raster engine using 8 bit + per color. + \sa format(), convertToFormat() */ @@ -1670,6 +1687,8 @@ void QImage::fill(uint pixel) #else pixel |= 0x000000ff; #endif + if (d->format == Format_BGR30 || d->format == Format_RGB30) + pixel |= 0xc0000000; qt_rectfill<uint>(reinterpret_cast<uint*>(d->data), pixel, 0, 0, d->width, d->height, d->bytes_per_line); @@ -1736,6 +1755,14 @@ void QImage::fill(const QColor &color) case QImage::Format_RGBA8888_Premultiplied: fill(ARGB2RGBA(qPremultiply(color.rgba()))); break; + case QImage::Format_BGR30: + case QImage::Format_A2BGR30_Premultiplied: + fill(qConvertArgb32ToA2rgb30<PixelOrderBGR>(color.rgba())); + break; + case QImage::Format_RGB30: + case QImage::Format_A2RGB30_Premultiplied: + fill(qConvertArgb32ToA2rgb30<PixelOrderRGB>(color.rgba())); + break; case QImage::Format_RGB16: fill((uint) qConvertRgb32To16(color.rgba())); break; @@ -2142,6 +2169,12 @@ QRgb QImage::pixel(int x, int y) const case Format_RGBA8888: // Match ARGB32 behavior. case Format_RGBA8888_Premultiplied: return RGBA2ARGB(reinterpret_cast<const quint32 *>(s)[x]); + case Format_BGR30: + case Format_A2BGR30_Premultiplied: + return qConvertA2rgb30ToArgb32<PixelOrderBGR>(reinterpret_cast<const quint32 *>(s)[x]); + case Format_RGB30: + case Format_A2RGB30_Premultiplied: + return qConvertA2rgb30ToArgb32<PixelOrderRGB>(reinterpret_cast<const quint32 *>(s)[x]); case Format_RGB16: return qConvertRgb16To32(reinterpret_cast<const quint16 *>(s)[x]); default: @@ -2232,6 +2265,18 @@ void QImage::setPixel(int x, int y, uint index_or_rgb) case Format_RGBA8888_Premultiplied: ((uint *)s)[x] = ARGB2RGBA(index_or_rgb); return; + case Format_BGR30: + ((uint *)s)[x] = qConvertRgb32ToRgb30<PixelOrderBGR>(index_or_rgb); + return; + case Format_A2BGR30_Premultiplied: + ((uint *)s)[x] = qConvertArgb32ToA2rgb30<PixelOrderBGR>(index_or_rgb); + return; + case Format_RGB30: + ((uint *)s)[x] = qConvertRgb32ToRgb30<PixelOrderRGB>(index_or_rgb); + return; + case Format_A2RGB30_Premultiplied: + ((uint *)s)[x] = qConvertArgb32ToA2rgb30<PixelOrderRGB>(index_or_rgb); + return; case Format_Invalid: case NImageFormats: Q_ASSERT(false); @@ -2959,6 +3004,23 @@ QImage QImage::rgbSwapped_helper() const } } break; + case Format_BGR30: + case Format_A2BGR30_Premultiplied: + case Format_RGB30: + case Format_A2RGB30_Premultiplied: + res = QImage(d->width, d->height, d->format); + QIMAGE_SANITYCHECK_MEMORY(res); + for (int i = 0; i < d->height; i++) { + uint *q = (uint*)res.scanLine(i); + const uint *p = (const uint*)constScanLine(i); + const uint *end = p + d->width; + while (p < end) { + *q = qRgbSwapRgb30(*p); + p++; + q++; + } + } + break; default: res = QImage(d->width, d->height, d->format); rgbSwapped_generic(d->width, d->height, this, &res, &qPixelLayouts[d->format]); @@ -3019,6 +3081,19 @@ void QImage::rgbSwapped_inplace() } } break; + case Format_BGR30: + case Format_A2BGR30_Premultiplied: + case Format_RGB30: + case Format_A2RGB30_Premultiplied: + for (int i = 0; i < d->height; i++) { + uint *p = (uint*)scanLine(i); + uint *end = p + d->width; + while (p < end) { + *p = qRgbSwapRgb30(*p); + p++; + } + } + break; default: rgbSwapped_generic(d->width, d->height, this, this, &qPixelLayouts[d->format]); break; @@ -4044,6 +4119,8 @@ bool QImage::hasAlphaChannel() const || d->format == Format_ARGB4444_Premultiplied || d->format == Format_RGBA8888 || d->format == Format_RGBA8888_Premultiplied + || d->format == Format_A2BGR30_Premultiplied + || d->format == Format_A2RGB30_Premultiplied || (d->has_alpha_clut && (d->format == Format_Indexed8 || d->format == Format_Mono || d->format == Format_MonoLSB))); @@ -4069,6 +4146,10 @@ int QImage::bitPlaneCount() const switch (d->format) { case QImage::Format_Invalid: break; + case QImage::Format_BGR30: + case QImage::Format_RGB30: + bpc = 30; + break; case QImage::Format_RGB32: case QImage::Format_RGBX8888: bpc = 24; @@ -4122,6 +4203,10 @@ static QImage rotated90(const QImage &image) { case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: + case QImage::Format_BGR30: + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_RGB30: + case QImage::Format_A2RGB30_Premultiplied: qt_memrotate270(reinterpret_cast<const quint32*>(image.bits()), w, h, image.bytesPerLine(), reinterpret_cast<quint32*>(out.bits()), @@ -4184,6 +4269,10 @@ static QImage rotated270(const QImage &image) { case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: + case QImage::Format_BGR30: + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_RGB30: + case QImage::Format_A2RGB30_Premultiplied: qt_memrotate90(reinterpret_cast<const quint32*>(image.bits()), w, h, image.bytesPerLine(), reinterpret_cast<quint32*>(out.bits()), @@ -4332,6 +4421,12 @@ QImage QImage::transformed(const QTransform &matrix, Qt::TransformationMode mode case QImage::Format_RGBX8888: target_format = Format_RGBA8888_Premultiplied; break; + case QImage::Format_BGR30: + target_format = Format_A2BGR30_Premultiplied; + break; + case QImage::Format_RGB30: + target_format = Format_A2RGB30_Premultiplied; + break; default: target_format = Format_ARGB32_Premultiplied; break; @@ -4741,6 +4836,58 @@ static const QPixelFormat pixelformats[] = { /*PREMULTIPLIED*/ QPixelFormat::Premultiplied, /*INTERPRETATION*/ QPixelFormat::UnsignedByte, /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), + //QImage::Format_BGR30: + QPixelFormat(QPixelFormat::BGR, + /*RED*/ 10, + /*GREEN*/ 10, + /*BLUE*/ 10, + /*FOURTH*/ 0, + /*FIFTH*/ 0, + /*ALPHA*/ 2, + /*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha, + /*ALPHA POSITION*/ QPixelFormat::AtBeginning, + /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied, + /*INTERPRETATION*/ QPixelFormat::UnsignedInteger, + /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), + //QImage::Format_A2BGR30_Premultiplied: + QPixelFormat(QPixelFormat::BGR, + /*RED*/ 10, + /*GREEN*/ 10, + /*BLUE*/ 10, + /*FOURTH*/ 0, + /*FIFTH*/ 0, + /*ALPHA*/ 2, + /*ALPHA USAGE*/ QPixelFormat::UsesAlpha, + /*ALPHA POSITION*/ QPixelFormat::AtBeginning, + /*PREMULTIPLIED*/ QPixelFormat::Premultiplied, + /*INTERPRETATION*/ QPixelFormat::UnsignedInteger, + /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), + //QImage::Format_RGB30: + QPixelFormat(QPixelFormat::RGB, + /*RED*/ 10, + /*GREEN*/ 10, + /*BLUE*/ 10, + /*FOURTH*/ 0, + /*FIFTH*/ 0, + /*ALPHA*/ 2, + /*ALPHA USAGE*/ QPixelFormat::IgnoresAlpha, + /*ALPHA POSITION*/ QPixelFormat::AtBeginning, + /*PREMULTIPLIED*/ QPixelFormat::NotPremultiplied, + /*INTERPRETATION*/ QPixelFormat::UnsignedInteger, + /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), + //QImage::Format_A2RGB30_Premultiplied: + QPixelFormat(QPixelFormat::RGB, + /*RED*/ 10, + /*GREEN*/ 10, + /*BLUE*/ 10, + /*FOURTH*/ 0, + /*FIFTH*/ 0, + /*ALPHA*/ 2, + /*ALPHA USAGE*/ QPixelFormat::UsesAlpha, + /*ALPHA POSITION*/ QPixelFormat::AtBeginning, + /*PREMULTIPLIED*/ QPixelFormat::Premultiplied, + /*INTERPRETATION*/ QPixelFormat::UnsignedInteger, + /*BYTE ORDER*/ QPixelFormat::CurrentSystemEndian), }; Q_STATIC_ASSERT(sizeof(pixelformats) / sizeof(*pixelformats) == QImage::NImageFormats); diff --git a/src/gui/image/qimage.h b/src/gui/image/qimage.h index 365a7873a4..62f9f5cce2 100644 --- a/src/gui/image/qimage.h +++ b/src/gui/image/qimage.h @@ -124,6 +124,10 @@ public: Format_Grayscale2, Format_Grayscale2LSB #endif + Format_BGR30, + Format_A2BGR30_Premultiplied, + Format_RGB30, + Format_A2RGB30_Premultiplied, #ifndef Q_QDOC NImageFormats #endif diff --git a/src/gui/image/qimage_conversions.cpp b/src/gui/image/qimage_conversions.cpp index 11c4b6d504..195b56afbe 100644 --- a/src/gui/image/qimage_conversions.cpp +++ b/src/gui/image/qimage_conversions.cpp @@ -172,6 +172,35 @@ bool convert_generic_inplace(QImageData *data, QImage::Format dst_format, Qt::Im return true; } +static void convert_passthrough(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = *src_data; + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +template<QImage::Format Format> +static bool convert_passthrough_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + data->format = Format; + return true; +} + static void convert_ARGB_to_ARGB_PM(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) { Q_ASSERT(src->format == QImage::Format_ARGB32 || src->format == QImage::Format_RGBA8888); @@ -404,6 +433,292 @@ static bool convert_RGBA_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversio return true; } +template<QtPixelOrder PixelOrder> +static void convert_RGB_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + + Q_ASSERT(src->format == QImage::Format_RGB32 || src->format == QImage::Format_ARGB32); + Q_ASSERT(dest->format == QImage::Format_BGR30 || dest->format == QImage::Format_A2BGR30_Premultiplied + || dest->format == QImage::Format_RGB30 || dest->format == QImage::Format_A2RGB30_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = qConvertRgb32ToRgb30<PixelOrder>(*src_data); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +template<QtPixelOrder PixelOrder> +static void convert_RGB30_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_BGR30 || src->format == QImage::Format_RGB30); + Q_ASSERT(dest->format == QImage::Format_RGB32 || dest->format == QImage::Format_ARGB32 || dest->format == QImage::Format_ARGB32_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = qConvertA2rgb30ToArgb32<PixelOrder>(*src_data); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +template<QtPixelOrder PixelOrder> +static void convert_A2RGB30_PM_to_RGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_RGB32); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = 0xff000000 | qUnpremultiply(qConvertA2rgb30ToArgb32<PixelOrder>(*src_data)); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +template<QtPixelOrder PixelOrder> +static void convert_ARGB_PM_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_BGR30 || dest->format == QImage::Format_RGB30); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(*src_data)); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +template<QtPixelOrder PixelOrder> +static void convert_ARGB_to_A2RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_ARGB32_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_A2BGR30_Premultiplied || dest->format == QImage::Format_A2RGB30_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = qConvertArgb32ToA2rgb30<PixelOrder>(*src_data); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +template<QtPixelOrder PixelOrder> +static void convert_A2RGB30_to_ARGB(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_A2BGR30_Premultiplied || src->format == QImage::Format_A2RGB30_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_ARGB32_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = qConvertA2rgb30ToArgb32<PixelOrder>(*src_data); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +static inline uint qUnpremultiplyRgb30(uint rgb30) +{ + const uint a = rgb30 >> 30; + switch (a) { + case 0: + return 0; + case 1: { + uint rgb = rgb30 & 0x3fffffff; + rgb *= 3; + return (a << 30) | rgb; + } + case 2: { + uint rgb = rgb30 & 0x3fffffff; + rgb += rgb >> 1; + return (a << 30) | rgb; + } + case 3: + return rgb30; + } + Q_UNREACHABLE(); + return 0; +} + +static void convert_A2RGB30_PM_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_RGB30 || dest->format == QImage::Format_BGR30); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = 0xc0000000 | qUnpremultiplyRgb30(*src_data); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +static bool convert_A2RGB30_PM_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied); + + const int pad = (data->bytes_per_line >> 2) - data->width; + uint *rgb_data = (uint *) data->data; + + for (int i = 0; i < data->height; ++i) { + const uint *end = rgb_data + data->width; + while (rgb_data < end) { + *rgb_data = 0xc0000000 | qUnpremultiplyRgb30(*rgb_data); + ++rgb_data; + } + rgb_data += pad; + } + + if (data->format == QImage::Format_A2RGB30_Premultiplied) + data->format = QImage::Format_RGB30; + else + data->format = QImage::Format_BGR30; + return true; +} + +static void convert_BGR30_to_RGB30(QImageData *dest, const QImageData *src, Qt::ImageConversionFlags) +{ + Q_ASSERT(src->format == QImage::Format_RGB30 || src->format == QImage::Format_BGR30 || + src->format == QImage::Format_A2RGB30_Premultiplied || src->format == QImage::Format_A2BGR30_Premultiplied); + Q_ASSERT(dest->format == QImage::Format_RGB30 || dest->format == QImage::Format_BGR30 || + dest->format == QImage::Format_A2RGB30_Premultiplied || dest->format == QImage::Format_A2BGR30_Premultiplied); + Q_ASSERT(src->width == dest->width); + Q_ASSERT(src->height == dest->height); + + const int src_pad = (src->bytes_per_line >> 2) - src->width; + const int dest_pad = (dest->bytes_per_line >> 2) - dest->width; + const quint32 *src_data = (quint32 *) src->data; + quint32 *dest_data = (quint32 *) dest->data; + + for (int i = 0; i < src->height; ++i) { + const quint32 *end = src_data + src->width; + while (src_data < end) { + *dest_data = qRgbSwapRgb30(*src_data); + ++src_data; + ++dest_data; + } + src_data += src_pad; + dest_data += dest_pad; + } +} + +static bool convert_BGR30_to_RGB30_inplace(QImageData *data, Qt::ImageConversionFlags) +{ + Q_ASSERT(data->format == QImage::Format_RGB30 || data->format == QImage::Format_BGR30 || + data->format == QImage::Format_A2RGB30_Premultiplied || data->format == QImage::Format_A2BGR30_Premultiplied); + + const int pad = (data->bytes_per_line >> 2) - data->width; + uint *rgb_data = (uint *) data->data; + + for (int i = 0; i < data->height; ++i) { + const uint *end = rgb_data + data->width; + while (rgb_data < end) { + *rgb_data = qRgbSwapRgb30(*rgb_data); + ++rgb_data; + } + rgb_data += pad; + } + + switch (data->format) { + case QImage::Format_BGR30: + data->format = QImage::Format_RGB30; + break; + case QImage::Format_A2BGR30_Premultiplied: + data->format = QImage::Format_A2RGB30_Premultiplied; + break; + case QImage::Format_RGB30: + data->format = QImage::Format_BGR30; + break; + case QImage::Format_A2RGB30_Premultiplied: + data->format = QImage::Format_A2BGR30_Premultiplied; + break; + default: + Q_UNREACHABLE(); + data->format = QImage::Format_Invalid; + return false; + } + return true; +} + static bool convert_indexed8_to_ARGB_PM_inplace(QImageData *data, Qt::ImageConversionFlags) { Q_ASSERT(data->format == QImage::Format_Indexed8); @@ -1557,7 +1872,7 @@ static void convert_Mono_to_Indexed8(QImageData *dest, const QImageData *src, Qt Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormats] = { { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { 0, @@ -1578,7 +1893,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_Mono { @@ -1600,7 +1915,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_MonoLSB { @@ -1622,7 +1937,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_Indexed8 { @@ -1644,7 +1959,11 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, convert_RGB_to_RGBA, convert_RGB_to_RGBA, - convert_RGB_to_RGBA + convert_RGB_to_RGBA, + convert_RGB_to_RGB30<PixelOrderBGR>, + convert_RGB_to_RGB30<PixelOrderBGR>, + convert_RGB_to_RGB30<PixelOrderRGB>, + convert_RGB_to_RGB30<PixelOrderRGB>, }, // Format_RGB32 { @@ -1667,6 +1986,10 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat convert_ARGB_to_RGBx, convert_ARGB_to_RGBA, convert_ARGB_to_RGBA_PM, + convert_RGB_to_RGB30<PixelOrderBGR>, + 0, + convert_RGB_to_RGB30<PixelOrderRGB>, + 0, }, // Format_ARGB32 { @@ -1689,6 +2012,10 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat convert_ARGB_PM_to_RGBx, convert_ARGB_PM_to_RGBA, convert_ARGB_to_RGBA, + convert_ARGB_PM_to_RGB30<PixelOrderBGR>, + convert_ARGB_to_A2RGB30<PixelOrderBGR>, + convert_ARGB_PM_to_RGB30<PixelOrderRGB>, + convert_ARGB_to_A2RGB30<PixelOrderRGB>, }, // Format_ARGB32_Premultiplied { @@ -1710,7 +2037,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_RGB16 { @@ -1732,7 +2059,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_ARGB8565_Premultiplied { @@ -1754,7 +2081,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_RGB666 { @@ -1776,7 +2103,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_ARGB6666_Premultiplied { @@ -1798,7 +2125,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_RGB555 { @@ -1820,7 +2147,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_ARGB8555_Premultiplied { @@ -1842,7 +2169,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_RGB888 { @@ -1864,7 +2191,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_RGB444 { @@ -1885,7 +2212,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0, 0, - 0 + 0, 0, 0, 0, 0 }, // Format_ARGB4444_Premultiplied { 0, @@ -1907,6 +2234,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, mask_alpha_converter_RGBx, mask_alpha_converter_RGBx, + 0, 0, 0, 0 }, // Format_RGBX8888 { 0, @@ -1933,6 +2261,7 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0 #endif + 0, 0, 0, 0 }, // Format_RGBA8888 { @@ -1961,19 +2290,121 @@ Image_Converter qimage_converter_map[QImage::NImageFormats][QImage::NImageFormat 0, 0 #endif - } // Format_RGBA8888_Premultiplied + 0, 0, 0, 0 + }, // Format_RGBA8888_Premultiplied + + { + 0, + 0, + 0, + 0, + convert_RGB30_to_RGB<PixelOrderBGR>, + convert_RGB30_to_RGB<PixelOrderBGR>, + convert_RGB30_to_RGB<PixelOrderBGR>, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_passthrough, + convert_BGR30_to_RGB30, + convert_BGR30_to_RGB30 + }, // Format_BGR30 + { + 0, + 0, + 0, + 0, + convert_A2RGB30_PM_to_RGB<PixelOrderBGR>, + 0, + convert_A2RGB30_to_ARGB<PixelOrderBGR>, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_A2RGB30_PM_to_RGB30, + 0, + 0, + convert_BGR30_to_RGB30 + }, // Format_BGR30A2_Premultiplied + { + 0, + 0, + 0, + 0, + convert_RGB30_to_RGB<PixelOrderRGB>, + convert_RGB30_to_RGB<PixelOrderRGB>, + convert_RGB30_to_RGB<PixelOrderRGB>, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_BGR30_to_RGB30, + convert_BGR30_to_RGB30, + 0, + 0, + convert_passthrough, + }, // Format_RGB30 + { + 0, + 0, + 0, + 0, + convert_A2RGB30_PM_to_RGB<PixelOrderRGB>, + 0, + convert_A2RGB30_to_ARGB<PixelOrderRGB>, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_BGR30_to_RGB30, + convert_A2RGB30_PM_to_RGB30, + 0, + }, // Format_RGB30A2_Premultiplied }; InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QImage::NImageFormats] = { { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_Mono { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_MonoLSB { 0, @@ -1994,7 +2425,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, + 0, 0, 0, 0, 0 }, // Format_Indexed8 { 0, @@ -2015,7 +2446,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, + 0, 0, 0, 0, 0 }, // Format_RGB32 { 0, @@ -2040,7 +2471,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, convert_ARGB_to_RGBA_inplace, - 0, + 0, 0, 0, 0, 0 }, // Format_ARGB32 { 0, @@ -2061,34 +2492,35 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - convert_ARGB_to_RGBA_inplace + convert_ARGB_to_RGBA_inplace, + 0, 0, 0, 0 }, // Format_ARGB32_Premultiplied { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_RGB16 { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_ARGB8565_Premultiplied { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_RGB666 { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_ARGB6666_Premultiplied { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_RGB555 { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_ARGB8555_Premultiplied { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_RGB888 { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_RGB444 { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // Format_ARGB4444_Premultiplied { 0, @@ -2108,8 +2540,9 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - 0, - 0, + convert_passthrough_inplace<QImage::Format_RGBA8888>, + convert_passthrough_inplace<QImage::Format_RGBA8888_Premultiplied>, + 0, 0, 0, 0 }, // Format_RGBX8888 { 0, @@ -2131,6 +2564,7 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, + 0, 0, 0, 0 }, // Format_RGBA8888 { 0, @@ -2152,7 +2586,108 @@ InPlace_Image_Converter qimage_inplace_converter_map[QImage::NImageFormats][QIma 0, 0, 0, - } // Format_RGBA8888_Premultiplied + 0, 0, 0, 0 + }, // Format_RGBA8888_Premultiplied + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_passthrough_inplace<QImage::Format_A2BGR30_Premultiplied>, + convert_BGR30_to_RGB30_inplace, + convert_BGR30_to_RGB30_inplace + }, // Format_BGR30 + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_A2RGB30_PM_to_RGB30_inplace, + 0, + 0, + convert_BGR30_to_RGB30_inplace + }, // Format_BGR30A2_Premultiplied + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_BGR30_to_RGB30_inplace, + convert_BGR30_to_RGB30_inplace, + 0, + convert_passthrough_inplace<QImage::Format_A2RGB30_Premultiplied> + }, // Format_RGB30 + { + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0, + convert_BGR30_to_RGB30_inplace, + convert_A2RGB30_PM_to_RGB30_inplace, + 0 + }, // Format_RGB30A2_Premultiplied }; void qInitImageConversions() diff --git a/src/gui/image/qimage_p.h b/src/gui/image/qimage_p.h index 81730b92f2..a22e207812 100644 --- a/src/gui/image/qimage_p.h +++ b/src/gui/image/qimage_p.h @@ -130,7 +130,7 @@ inline int qt_depthForFormat(QImage::Format format) switch(format) { case QImage::Format_Invalid: case QImage::NImageFormats: - Q_ASSERT(false); + Q_UNREACHABLE(); case QImage::Format_Mono: case QImage::Format_MonoLSB: depth = 1; @@ -144,6 +144,10 @@ inline int qt_depthForFormat(QImage::Format format) case QImage::Format_RGBX8888: case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: + case QImage::Format_BGR30: + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_RGB30: + case QImage::Format_A2RGB30_Premultiplied: depth = 32; break; case QImage::Format_RGB555: diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index c6d8d19bb1..f4222d2360 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -1511,7 +1511,8 @@ QBitmap QPixmap::mask() const return QBitmap(); const QImage img = toImage(); - const QImage image = (img.depth() < 32 ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied) : img); + bool shouldConvert = (img.format() != QImage::Format_ARGB32 && img.format() != QImage::Format_ARGB32_Premultiplied); + const QImage image = (shouldConvert ? img.convertToFormat(QImage::Format_ARGB32_Premultiplied) : img); const int w = image.width(); const int h = image.height(); diff --git a/src/gui/image/qppmhandler.cpp b/src/gui/image/qppmhandler.cpp index 39f63a620c..64eaf7f19e 100644 --- a/src/gui/image/qppmhandler.cpp +++ b/src/gui/image/qppmhandler.cpp @@ -275,6 +275,8 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy case QImage::Format_RGB888: case QImage::Format_RGB444: case QImage::Format_RGBX8888: + case QImage::Format_BGR30: + case QImage::Format_RGB30: image = image.convertToFormat(QImage::Format_RGB32); break; case QImage::Format_ARGB8565_Premultiplied: @@ -283,6 +285,8 @@ static bool write_pbm_image(QIODevice *out, const QImage &sourceImage, const QBy case QImage::Format_ARGB4444_Premultiplied: case QImage::Format_RGBA8888: case QImage::Format_RGBA8888_Premultiplied: + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_A2RGB30_Premultiplied: image = image.convertToFormat(QImage::Format_ARGB32); break; default: diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 87c95e6420..96bea942ea 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -897,7 +897,19 @@ QList<QScreen *> QGuiApplication::screens() This signal is emitted whenever a new screen \a screen has been added to the system. - \sa screens(), primaryScreen() + \sa screens(), primaryScreen(), screenRemoved() +*/ + +/*! + \fn void QGuiApplication::screenRemoved(QScreen *screen) + + This signal is emitted whenever a \a screen is removed from the system. It + provides an opportunity to manage the windows on the screen before Qt falls back + to moving them to the primary screen. + + \sa screens(), screenAdded(), QObject::destroyed(), QWindow::setScreen() + + \since 5.4 */ diff --git a/src/gui/kernel/qguiapplication.h b/src/gui/kernel/qguiapplication.h index 1b1e1dabff..6e751e1275 100644 --- a/src/gui/kernel/qguiapplication.h +++ b/src/gui/kernel/qguiapplication.h @@ -165,6 +165,7 @@ public: Q_SIGNALS: void fontDatabaseChanged(); void screenAdded(QScreen *screen); + void screenRemoved(QScreen *screen); void lastWindowClosed(); void focusObjectChanged(QObject *focusObject); void focusWindowChanged(QWindow *focusWindow); diff --git a/src/gui/kernel/qscreen.cpp b/src/gui/kernel/qscreen.cpp index 70ee631fc8..90f48d4593 100644 --- a/src/gui/kernel/qscreen.cpp +++ b/src/gui/kernel/qscreen.cpp @@ -74,6 +74,16 @@ QScreen::QScreen(QPlatformScreen *screen) { } + +/*! + Destroys the screen. + */ +QScreen::~QScreen() +{ + if (qApp) + Q_EMIT qApp->screenRemoved(this); +} + /*! Get the platform screen handle. */ diff --git a/src/gui/kernel/qscreen.h b/src/gui/kernel/qscreen.h index bdd5939657..9e439f5a20 100644 --- a/src/gui/kernel/qscreen.h +++ b/src/gui/kernel/qscreen.h @@ -89,6 +89,7 @@ class Q_GUI_EXPORT QScreen : public QObject Q_PROPERTY(qreal refreshRate READ refreshRate NOTIFY refreshRateChanged) public: + ~QScreen(); QPlatformScreen *handle() const; QString name() const; diff --git a/src/gui/opengl/qopenglframebufferobject.cpp b/src/gui/opengl/qopenglframebufferobject.cpp index 97b006b4fc..0c05b61e76 100644 --- a/src/gui/opengl/qopenglframebufferobject.cpp +++ b/src/gui/opengl/qopenglframebufferobject.cpp @@ -100,6 +100,23 @@ QT_BEGIN_NAMESPACE #define GL_DRAW_FRAMEBUFFER 0x8CA9 #endif +#ifndef GL_RGB8 +#define GL_RGB8 0x8051 +#endif + +#ifndef GL_RGBA8 +#define GL_RGBA8 0x8058 +#endif + +#ifndef GL_BGRA +#define GL_BGRA 0x80E1 +#endif + +#ifndef GL_UNSIGNED_INT_8_8_8_8_REV +#define GL_UNSIGNED_INT_8_8_8_8_REV 0x8367 +#endif + + /*! \class QOpenGLFramebufferObjectFormat \brief The QOpenGLFramebufferObjectFormat class specifies the format of an OpenGL @@ -1097,38 +1114,68 @@ QOpenGLFramebufferObjectFormat QOpenGLFramebufferObject::format() const return d->format; } -Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha) +static inline QImage qt_gl_read_framebuffer_rgba8(const QSize &size, bool include_alpha, QOpenGLContext *context) { - int w = size.width(); - int h = size.height(); - - QOpenGLFunctions *funcs = QOpenGLContext::currentContext()->functions(); - while (funcs->glGetError()); + QOpenGLFunctions *funcs = context->functions(); + const int w = size.width(); + const int h = size.height(); + bool isOpenGL12orBetter = !context->isOpenGLES() && (context->format().majorVersion() >= 2 || context->format().minorVersion() >= 2); + if (isOpenGL12orBetter) { + QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); + funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, img.bits()); + return img; + } #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN - QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied - : QImage::Format_RGB32); -#ifdef QT_OPENGL_ES - GLint fmt = GL_BGRA_EXT; -#else - GLint fmt = GL_BGRA; -#endif - funcs->glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits()); - if (!funcs->glGetError()) - return img.mirrored(); + // Without GL_UNSIGNED_INT_8_8_8_8_REV, GL_BGRA only makes sense on little endian. + const bool supports_bgra = context->isOpenGLES() + ? context->hasExtension(QByteArrayLiteral("GL_EXT_read_format_bgra")) + : context->hasExtension(QByteArrayLiteral("GL_EXT_bgra")); + if (supports_bgra) { + QImage img(size, include_alpha ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32); + funcs->glReadPixels(0, 0, w, h, GL_BGRA, GL_UNSIGNED_BYTE, img.bits()); + return img; + } #endif - - QImage rgbaImage(size, (alpha_format && include_alpha) ? QImage::Format_RGBA8888_Premultiplied - : QImage::Format_RGBX8888); + QImage rgbaImage(size, include_alpha ? QImage::Format_RGBA8888_Premultiplied : QImage::Format_RGBX8888); funcs->glReadPixels(0, 0, w, h, GL_RGBA, GL_UNSIGNED_BYTE, rgbaImage.bits()); - return rgbaImage.mirrored(); + return rgbaImage; +} + +static QImage qt_gl_read_framebuffer(const QSize &size, GLenum internal_format, bool include_alpha, bool flip) +{ + QOpenGLContext *ctx = QOpenGLContext::currentContext(); + QOpenGLFunctions *funcs = ctx->functions(); + while (funcs->glGetError()); + + switch (internal_format) { + case GL_RGB: + case GL_RGB8: + return qt_gl_read_framebuffer_rgba8(size, false, ctx).mirrored(false, flip); + case GL_RGBA: + case GL_RGBA8: + default: + return qt_gl_read_framebuffer_rgba8(size, include_alpha, ctx).mirrored(false, flip); + } + + Q_UNREACHABLE(); + return QImage(); +} + +Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, bool include_alpha) +{ + return qt_gl_read_framebuffer(size, alpha_format ? GL_RGBA : GL_RGB, include_alpha, true); } /*! - \fn QImage QOpenGLFramebufferObject::toImage() const + \fn QImage QOpenGLFramebufferObject::toImage(bool flipped) const Returns the contents of this framebuffer object as a QImage. + If \a flipped is true the image is flipped from OpenGL coordinates to raster coordinates. + If used together with QOpenGLPaintDevice, \a flipped should be the opposite of the value + of QOpenGLPaintDevice::paintFlipped(). + Will try to return a premultiplied ARBG32 or RGB32 image. Since 5.2 it will fall back to a premultiplied RGBA8888 or RGBx8888 image when reading to ARGB32 is not supported. @@ -1139,8 +1186,11 @@ Q_GUI_EXPORT QImage qt_gl_read_framebuffer(const QSize &size, bool alpha_format, For singlesampled framebuffers the contents is retrieved via \c glReadPixels. This is a potentially expensive and inefficient operation. Therefore it is recommended that this function is used as seldom as possible. + + \sa QOpenGLPaintDevice::paintFlipped() */ -QImage QOpenGLFramebufferObject::toImage() const + +QImage QOpenGLFramebufferObject::toImage(bool flipped) const { Q_D(const QOpenGLFramebufferObject); if (!d->valid) @@ -1166,9 +1216,9 @@ QImage QOpenGLFramebufferObject::toImage() const QRect rect(QPoint(0, 0), size()); blitFramebuffer(&temp, rect, const_cast<QOpenGLFramebufferObject *>(this), rect); - image = temp.toImage(); + image = temp.toImage(flipped); } else { - image = qt_gl_read_framebuffer(d->size, format().internalTextureFormat() != GL_RGB, true); + image = qt_gl_read_framebuffer(d->size, format().internalTextureFormat(), true, flipped); } if (prevFbo != d->fbo()) @@ -1178,6 +1228,19 @@ QImage QOpenGLFramebufferObject::toImage() const } /*! + \fn QImage QOpenGLFramebufferObject::toImage() const + \overload + + Returns the contents of this framebuffer object as a QImage. This method flips + the image from OpenGL coordinates to raster coordinates. +*/ +// ### Qt 6: Remove this method and make it a default argument instead. +QImage QOpenGLFramebufferObject::toImage() const +{ + return toImage(true); +} + +/*! \fn bool QOpenGLFramebufferObject::bindDefault() Switches rendering back to the default, windowing system provided diff --git a/src/gui/opengl/qopenglframebufferobject.h b/src/gui/opengl/qopenglframebufferobject.h index 3df929c210..0b1aaae36d 100644 --- a/src/gui/opengl/qopenglframebufferobject.h +++ b/src/gui/opengl/qopenglframebufferobject.h @@ -94,6 +94,7 @@ public: GLuint takeTexture(); QSize size() const; QImage toImage() const; + QImage toImage(bool flipped) const; Attachment attachment() const; void setAttachment(Attachment attachment); diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index ed45b8ea17..bc4b2f27d8 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -98,6 +98,7 @@ contains(QT_CPU_FEATURES.$$QT_ARCH, sse2) { IWMMXT_SOURCES += painting/qdrawhelper_iwmmxt.cpp !ios:contains(QT_CPU_FEATURES.$$QT_ARCH, neon) { + CONFIG += no_clang_integrated_as SOURCES += painting/qdrawhelper_neon.cpp HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp index f22c37aecc..438eb6f34f 100644 --- a/src/gui/painting/qblendfunctions.cpp +++ b/src/gui/painting/qblendfunctions.cpp @@ -403,7 +403,168 @@ void qt_blend_rgb32_on_rgb32(uchar *destPixels, int dbpl, } } +template<QtPixelOrder PixelOrder> +static void qt_blend_argb32pm_on_a2rgb30pm(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifdef QT_DEBUG_DRAW + fprintf(stdout, "qt_blend_argb32pm_on_a2rgb30pm: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", + destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + fflush(stdout); +#endif + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (const_alpha == 256) { + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = src[x]; + dst[x] = qConvertArgb32ToA2rgb30<PixelOrder>(s) + BYTE_MUL_RGB30(dst[x], 255 - qAlpha(s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + const_alpha = (const_alpha * 255) >> 8; + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = BYTE_MUL(src[x], const_alpha); + dst[x] = qConvertArgb32ToA2rgb30<PixelOrder>(s) + BYTE_MUL_RGB30(dst[x], 255 - qAlpha(s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + +template<QtPixelOrder PixelOrder> +void qt_blend_rgb32_on_rgb30(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifdef QT_DEBUG_DRAW + fprintf(stdout, "qt_blend_rgb32_on_rgb30: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", + destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + fflush(stdout); +#endif + + if (const_alpha != 256) { + qt_blend_argb32pm_on_a2rgb30pm<PixelOrder>(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + for (int y = 0; y < h; ++y) { + for (int x = 0; x < w; ++x) { + dst[x] = qConvertRgb32ToRgb30<PixelOrder>(src[x]); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } +} + +static void qt_blend_a2rgb30pm_on_a2rgb30pm(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifdef QT_DEBUG_DRAW + fprintf(stdout, "qt_blend_a2rgb30pm_on_a2rgb30pm: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", + destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + fflush(stdout); +#endif + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (const_alpha == 256) { + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = src[x]; + dst[x] = s + BYTE_MUL_RGB30(dst[x], 255 - qAlphaRgb30(s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + const uint const_alpha255 = (const_alpha * 255) >> 8; + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint a = (qAlphaRgb30(src[x]) * const_alpha) >> 8; + uint s = BYTE_MUL_RGB30(src[x], const_alpha255); + dst[x] = s + BYTE_MUL_RGB30(dst[x], 255 - a); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} + + +void qt_blend_rgb30_on_rgb30(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifdef QT_DEBUG_DRAW + fprintf(stdout, "qt_blend_rgb30_on_rgb30: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", + destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + fflush(stdout); +#endif + + if (const_alpha != 256) { + qt_blend_a2rgb30pm_on_a2rgb30pm(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + return; + } + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + int len = w * 4; + for (int y=0; y<h; ++y) { + memcpy(dst, src, len); + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } +} +static void qt_blend_a2bgr30pm_on_a2rgb30pm(uchar *destPixels, int dbpl, + const uchar *srcPixels, int sbpl, + int w, int h, + int const_alpha) +{ +#ifdef QT_DEBUG_DRAW + fprintf(stdout, "qt_blend_a2bgr30pm_on_a2rgb32pm: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n", + destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); + fflush(stdout); +#endif + + const uint *src = (const uint *) srcPixels; + uint *dst = (uint *) destPixels; + if (const_alpha == 256) { + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint s = qRgbSwapRgb30(src[x]); + dst[x] = s + BYTE_MUL_RGB30(dst[x], 255 - qAlphaRgb30(s)); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } else if (const_alpha != 0) { + const uint const_alpha255 = (const_alpha * 255) >> 8; + for (int y=0; y<h; ++y) { + for (int x=0; x<w; ++x) { + uint a = (qAlphaRgb30(src[x]) * const_alpha) >> 8; + uint s = BYTE_MUL_RGB30(src[x], const_alpha255); + dst[x] = qRgbSwapRgb30(s) + BYTE_MUL_RGB30(dst[x], 255 - a); + } + dst = (quint32 *)(((uchar *) dst) + dbpl); + src = (const quint32 *)(((const uchar *) src) + sbpl); + } + } +} struct Blend_RGB32_on_RGB32_NoAlpha { inline void write(quint32 *dst, quint32 src) { *dst = src; } @@ -607,7 +768,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGRs30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_Mono 0, // Format_Invalid, @@ -628,7 +793,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_MonoLSB 0, // Format_Invalid, @@ -649,7 +818,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_Indexed8 0, // Format_Invalid, @@ -670,7 +843,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB32 0, // Format_Invalid, @@ -691,7 +868,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB32 0, // Format_Invalid, @@ -712,7 +893,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB32_Premultiplied 0, // Format_Invalid, @@ -733,7 +918,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB16 0, // Format_Invalid, @@ -754,7 +943,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB8565_Premultiplied 0, // Format_Invalid, @@ -775,7 +968,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB666 0, // Format_Invalid, @@ -796,7 +993,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB6666_Premultiplied 0, // Format_Invalid, @@ -817,7 +1018,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB555 0, // Format_Invalid, @@ -838,7 +1043,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB8555_Premultiplied 0, // Format_Invalid, @@ -859,7 +1068,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB888 0, // Format_Invalid, @@ -880,7 +1093,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB444 0, // Format_Invalid, @@ -901,7 +1118,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB4444_Premultiplied 0, // Format_Invalid, @@ -922,7 +1143,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBX8888 0, // Format_Invalid, @@ -948,8 +1173,12 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = #else 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, #endif + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBA8888 0, // Format_Invalid, @@ -970,7 +1199,11 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBA8888_Premultiplied 0, // Format_Invalid, @@ -996,9 +1229,113 @@ SrcOverScaleFunc qScaleFunctions[QImage::NImageFormats][QImage::NImageFormats] = #else 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, #endif - } + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_BGR30 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_A2BGR30_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_RGB30 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_A2RGB30_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, }; @@ -1022,7 +1359,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_Mono 0, // Format_Invalid, @@ -1043,7 +1384,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_MonoLSB 0, // Format_Invalid, @@ -1064,7 +1409,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_Indexed8 0, // Format_Invalid, @@ -1085,7 +1434,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB32 0, // Format_Invalid, @@ -1106,7 +1459,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB32 0, // Format_Invalid, @@ -1127,7 +1484,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB32_Premultiplied 0, // Format_Invalid, @@ -1148,7 +1509,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB16 0, // Format_Invalid, @@ -1169,7 +1534,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB8565_Premultiplied 0, // Format_Invalid, @@ -1190,7 +1559,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB666 0, // Format_Invalid, @@ -1211,7 +1584,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB6666_Premultiplied 0, // Format_Invalid, @@ -1232,7 +1609,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB555 0, // Format_Invalid, @@ -1253,7 +1634,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB8555_Premultiplied 0, // Format_Invalid, @@ -1274,7 +1659,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB888 0, // Format_Invalid, @@ -1295,7 +1684,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB444 0, // Format_Invalid, @@ -1316,7 +1709,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB4444_Premultiplied 0, // Format_Invalid, @@ -1337,7 +1734,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBX8888 0, // Format_Invalid, @@ -1363,8 +1764,12 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = #else 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, #endif + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBA8888 0, // Format_Invalid, @@ -1385,7 +1790,11 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBA8888_Premultiplied 0, // Format_Invalid, @@ -1411,9 +1820,113 @@ SrcOverBlendFunc qBlendFunctions[QImage::NImageFormats][QImage::NImageFormats] = #else 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, #endif - } + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0, // Format_A2RGB30_Premultiplied, + }, + { // Format_BGR30 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + qt_blend_rgb32_on_rgb30<PixelOrderBGR>, // Format_RGB32, + 0, // Format_ARGB32, + qt_blend_argb32pm_on_a2rgb30pm<PixelOrderBGR>, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + qt_blend_rgb30_on_rgb30, // Format_RGB30, + qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_RGB30, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + }, + { // Format_A2BGR30_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + qt_blend_rgb32_on_rgb30<PixelOrderBGR>, // Format_RGB32, + 0, // Format_ARGB32, + qt_blend_argb32pm_on_a2rgb30pm<PixelOrderBGR>, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + qt_blend_rgb30_on_rgb30, // Format_BGR30, + qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_RGB30, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + }, + { // Format_RGB30 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + qt_blend_rgb32_on_rgb30<PixelOrderRGB>, // Format_RGB32, + 0, // Format_ARGB32, + qt_blend_argb32pm_on_a2rgb30pm<PixelOrderRGB>, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_BGR30, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied, + qt_blend_rgb30_on_rgb30, // Format_RGB30, + qt_blend_a2rgb30pm_on_a2rgb30pm, // Format_A2RGB30_Premultiplied, + }, + { // Format_A2RGB30_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + qt_blend_rgb32_on_rgb30<PixelOrderRGB>, // Format_RGB32, + 0, // Format_ARGB32, + qt_blend_argb32pm_on_a2rgb30pm<PixelOrderRGB>, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_BGR30, + qt_blend_a2bgr30pm_on_a2rgb30pm, // Format_A2BGR30_Premultiplied, + qt_blend_rgb30_on_rgb30, // Format_RGB30, + qt_blend_a2rgb30pm_on_a2rgb30pm // Format_A2RGB30_Premultiplied, + }, }; SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFormats] = { @@ -1436,7 +1949,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_Mono 0, // Format_Invalid, @@ -1457,7 +1974,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_MonoLSB 0, // Format_Invalid, @@ -1478,7 +1999,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_Indexed8 0, // Format_Invalid, @@ -1499,7 +2024,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB32 0, // Format_Invalid, @@ -1520,7 +2049,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB32 0, // Format_Invalid, @@ -1541,7 +2074,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB32_Premultiplied 0, // Format_Invalid, @@ -1562,7 +2099,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB16 0, // Format_Invalid, @@ -1583,7 +2124,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB8565_Premultiplied 0, // Format_Invalid, @@ -1604,7 +2149,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB666 0, // Format_Invalid, @@ -1625,7 +2174,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB6666_Premultiplied 0, // Format_Invalid, @@ -1646,7 +2199,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB555 0, // Format_Invalid, @@ -1667,7 +2224,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB8555_Premultiplied 0, // Format_Invalid, @@ -1688,7 +2249,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB888 0, // Format_Invalid, @@ -1709,7 +2274,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGB444 0, // Format_Invalid, @@ -1730,7 +2299,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_ARGB4444_Premultiplied 0, // Format_Invalid, @@ -1751,7 +2324,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBX8888 0, // Format_Invalid, @@ -1777,8 +2354,12 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo #else 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, #endif + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBA8888 0, // Format_Invalid, @@ -1799,7 +2380,11 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo 0, // Format_ARGB4444_Premultiplied, 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, }, { // Format_RGBA8888_Premultiplied 0, // Format_Invalid, @@ -1825,9 +2410,113 @@ SrcOverTransformFunc qTransformFunctions[QImage::NImageFormats][QImage::NImageFo #else 0, // Format_RGBX8888, 0, // Format_RGBA8888, - 0 // Format_RGBA8888_Premultiplied, + 0, // Format_RGBA8888_Premultiplied, #endif - } + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_BGR30 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_A2BGR30_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_RGB30 + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, + { // Format_A2RGB30_Premultiplied + 0, // Format_Invalid, + 0, // Format_Mono, + 0, // Format_MonoLSB, + 0, // Format_Indexed8, + 0, // Format_RGB32, + 0, // Format_ARGB32, + 0, // Format_ARGB32_Premultiplied, + 0, // Format_RGB16, + 0, // Format_ARGB8565_Premultiplied, + 0, // Format_RGB666, + 0, // Format_ARGB6666_Premultiplied, + 0, // Format_RGB555, + 0, // Format_ARGB8555_Premultiplied, + 0, // Format_RGB888, + 0, // Format_RGB444, + 0, // Format_ARGB4444_Premultiplied, + 0, // Format_RGBX8888, + 0, // Format_RGBA8888, + 0, // Format_RGBA8888_Premultiplied, + 0, // Format_BGR30, + 0, // Format_A2BGR30_Premultiplied, + 0, // Format_RGB30, + 0 // Format_A2RGB30_Premultiplied, + }, }; QT_END_NAMESPACE diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index 44b38dcf1c..ffb952bce4 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -575,6 +575,42 @@ static const uint *QT_FASTCALL convertRGBXFromARGB32PM(uint *buffer, const uint return buffer; } +template<QtPixelOrder PixelOrder> +static const uint *QT_FASTCALL convertA2RGB30PMToARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qConvertA2rgb30ToArgb32<PixelOrder>(src[i]); + return buffer; +} + +template<QtPixelOrder PixelOrder> +static const uint *QT_FASTCALL convertA2RGB30PMFromARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qConvertArgb32ToA2rgb30<PixelOrder>(src[i]); + return buffer; +} + +template<QtPixelOrder PixelOrder> +static const uint *QT_FASTCALL convertRGB30FromRGB32(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(src[i]); + return buffer; +} + +template<QtPixelOrder PixelOrder> +static const uint *QT_FASTCALL convertRGB30FromARGB32PM(uint *buffer, const uint *src, int count, + const QPixelLayout *, const QRgb *) +{ + for (int i = 0; i < count; ++i) + buffer[i] = qConvertRgb32ToRgb30<PixelOrder>(qUnpremultiply(src[i])); + return buffer; +} + template <QPixelLayout::BPP bpp> static uint QT_FASTCALL fetchPixel(const uchar *src, int index); @@ -722,8 +758,12 @@ QPixelLayout qPixelLayouts[QImage::NImageFormats] = { #else { 8, 0, 8, 8, 8, 16, 0, 24, false, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBXFromARGB32PM, convertRGBXFromRGB32 }, // Format_RGBX8888 { 8, 0, 8, 8, 8, 16, 8, 24, false, QPixelLayout::BPP32, convertRGBA8888ToARGB32PM, convertRGBA8888FromARGB32PM, 0 }, // Format_RGBA8888 (ABGR32) - { 8, 0, 8, 8, 8, 16, 8, 24, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, 0 } // Format_RGBA8888_Premultiplied + { 8, 0, 8, 8, 8, 16, 8, 24, true, QPixelLayout::BPP32, convertRGBA8888PMToARGB32PM, convertRGBA8888PMFromARGB32PM, 0 }, // Format_RGBA8888_Premultiplied #endif + { 10, 20, 10, 10, 10, 0, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertRGB30FromARGB32PM<PixelOrderBGR>, convertRGB30FromRGB32<PixelOrderBGR> }, // Format_BGR30 + { 10, 20, 10, 10, 10, 0, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderBGR>, convertA2RGB30PMFromARGB32PM<PixelOrderBGR>, 0 }, // Format_A2BGR30_Premultiplied + { 10, 0, 10, 10, 10, 20, 0, 30, false, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertRGB30FromARGB32PM<PixelOrderRGB>, convertRGB30FromRGB32<PixelOrderRGB> }, // Format_RGB30 + { 10, 0, 10, 10, 10, 20, 2, 30, true, QPixelLayout::BPP32, convertA2RGB30PMToARGB32PM<PixelOrderRGB>, convertA2RGB30PMFromARGB32PM<PixelOrderRGB>, 0 }, // Format_A2RGB30_Premultiplied }; FetchPixelsFunc qFetchPixels[QPixelLayout::BPPCount] = { @@ -831,6 +871,10 @@ static DestFetchProc destFetchProc[QImage::NImageFormats] = destFetch, // Format_RGBX8888 destFetch, // Format_RGBA8888 destFetch, // Format_RGBA8888_Premultiplied + destFetch, // Format_BGR30 + destFetch, // Format_A2BGR30_Premultiplied + destFetch, // Format_RGB30 + destFetch, // Format_A2RGB30_Premultiplied }; /* @@ -970,7 +1014,11 @@ static DestStoreProc destStoreProc[QImage::NImageFormats] = destStore, // Format_ARGB4444_Premultiplied destStore, // Format_RGBX8888 destStore, // Format_RGBA8888 - destStore // Format_RGBA8888_Premultiplied + destStore, // Format_RGBA8888_Premultiplied + destStore, // Format_BGR30 + destStore, // Format_A2BGR30_Premultiplied + destStore, // Format_RGB30 + destStore, // Format_A2RGB30_Premultiplied }; /* @@ -2221,7 +2269,11 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchUntransformed, // ARGB4444_Premultiplied fetchUntransformed, // RGBX8888 fetchUntransformed, // RGBA8888 - fetchUntransformed // RGBA8888_Premultiplied + fetchUntransformed, // RGBA8888_Premultiplied + fetchUntransformed, // Format_BGR30 + fetchUntransformed, // Format_A2BGR30_Premultiplied + fetchUntransformed, // Format_RGB30 + fetchUntransformed, // Format_A2RGB30_Premultiplied }, // Tiled { @@ -2243,7 +2295,11 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchUntransformed, // ARGB4444_Premultiplied fetchUntransformed, // RGBX8888 fetchUntransformed, // RGBA8888 - fetchUntransformed // RGBA8888_Premultiplied + fetchUntransformed, // RGBA8888_Premultiplied + fetchUntransformed, // BGR30 + fetchUntransformed, // A2BGR30_Premultiplied + fetchUntransformed, // RGB30 + fetchUntransformed // A2RGB30_Premultiplied }, // Transformed { @@ -2266,6 +2322,10 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformed<BlendTransformed>, // RGBX8888 fetchTransformed<BlendTransformed>, // RGBA8888 fetchTransformed<BlendTransformed>, // RGBA8888_Premultiplied + fetchTransformed<BlendTransformed>, // BGR30 + fetchTransformed<BlendTransformed>, // A2BGR30_Premultiplied + fetchTransformed<BlendTransformed>, // RGB30 + fetchTransformed<BlendTransformed>, // A2RGB30_Premultiplied }, { 0, // TransformedTiled @@ -2287,6 +2347,10 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformed<BlendTransformedTiled>, // RGBX8888 fetchTransformed<BlendTransformedTiled>, // RGBA8888 fetchTransformed<BlendTransformedTiled>, // RGBA8888_Premultiplied + fetchTransformed<BlendTransformedTiled>, // BGR30 + fetchTransformed<BlendTransformedTiled>, // A2BGR30_Premultiplied + fetchTransformed<BlendTransformedTiled>, // RGB30 + fetchTransformed<BlendTransformedTiled>, // A2RGB30_Premultiplied }, { 0, // Bilinear @@ -2307,7 +2371,11 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformedBilinear<BlendTransformedBilinear>, // ARGB4444_Premultiplied fetchTransformedBilinear<BlendTransformedBilinear>, // RGBX8888 fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888 - fetchTransformedBilinear<BlendTransformedBilinear> // RGBA8888_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinear>, // RGBA8888_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinear>, // BGR30 + fetchTransformedBilinear<BlendTransformedBilinear>, // A2BGR30_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinear>, // RGB30 + fetchTransformedBilinear<BlendTransformedBilinear>, // A2RGB30_Premultiplied }, { 0, // BilinearTiled @@ -2328,7 +2396,11 @@ static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = { fetchTransformedBilinear<BlendTransformedBilinearTiled>, // ARGB4444_Premultiplied fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBX8888 fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888 - fetchTransformedBilinear<BlendTransformedBilinearTiled> // RGBA8888_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGBA8888_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinearTiled>, // BGR30 + fetchTransformedBilinear<BlendTransformedBilinearTiled>, // A2BGR30_Premultiplied + fetchTransformedBilinear<BlendTransformedBilinearTiled>, // RGB30 + fetchTransformedBilinear<BlendTransformedBilinearTiled> // A2RGB30_Premultiplied }, }; @@ -5749,6 +5821,10 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_untransformed_generic, blend_untransformed_generic, blend_untransformed_generic, + blend_untransformed_generic, + blend_untransformed_generic, + blend_untransformed_generic, + blend_untransformed_generic, }, // Tiled { @@ -5771,6 +5847,10 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_tiled_generic, blend_tiled_generic, blend_tiled_generic, + blend_tiled_generic, + blend_tiled_generic, + blend_tiled_generic, + blend_tiled_generic, }, // Transformed { @@ -5793,6 +5873,10 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, + blend_src_generic, + blend_src_generic, + blend_src_generic, }, // TransformedTiled { @@ -5814,6 +5898,10 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, + blend_src_generic, + blend_src_generic, + blend_src_generic, blend_src_generic }, // Bilinear @@ -5837,6 +5925,10 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, blend_src_generic, blend_src_generic, + blend_src_generic, + blend_src_generic, + blend_src_generic, + blend_src_generic, }, // BilinearTiled { @@ -5859,6 +5951,10 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats blend_src_generic, // RGBX8888 blend_src_generic, // RGBA8888 blend_src_generic, // RGBA8888_Premultiplied + blend_src_generic, // BGR30 + blend_src_generic, // A2BGR30_Premultiplied + blend_src_generic, // RGB30 + blend_src_generic, // A2RGB30_Premultiplied } }; @@ -6379,7 +6475,6 @@ static void qt_rectfill_nonpremul_rgba(QRasterBuffer *rasterBuffer, ARGB2RGBA(qUnpremultiply(color)), x, y, width, height, rasterBuffer->bytesPerLine()); } - // Map table for destination image format. Contains function pointers // for blends of various types unto the destination @@ -6527,7 +6622,43 @@ DrawHelper qDrawHelper[QImage::NImageFormats] = #endif 0, qt_rectfill_rgba - } + }, + // Format_BGR30 + { + blend_color_generic, + blend_src_generic, + 0, + 0, + 0, + 0 + }, + // Format_A2BGR30_Premultiplied + { + blend_color_generic, + blend_src_generic, + 0, + 0, + 0, + 0 + }, + // Format_RGB30 + { + blend_color_generic, + blend_src_generic, + 0, + 0, + 0, + 0 + }, + // Format_A2RGB30_Premultiplied + { + blend_color_generic, + blend_src_generic, + 0, + 0, + 0, + 0 + }, }; #if defined(Q_CC_MSVC) && !defined(_MIPS_) diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h index 1c05fc305a..d6b557af01 100644 --- a/src/gui/painting/qdrawhelper_p.h +++ b/src/gui/painting/qdrawhelper_p.h @@ -672,6 +672,36 @@ static Q_ALWAYS_INLINE uint BYTE_MUL_RGB16_32(uint x, uint a) { return t; } +#if defined(Q_CC_RVCT) +# pragma push +# pragma arm +#endif +static Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } +#if defined(Q_CC_RVCT) +# pragma pop +#endif + +static Q_ALWAYS_INLINE uint BYTE_MUL_RGB30(uint x, uint a) { + uint xa = x >> 30; + uint xr = (x >> 20) & 0x3ff; + uint xg = (x >> 10) & 0x3ff; + uint xb = x & 0x3ff; + xa = qt_div_255(xa * a); + xr = qt_div_255(xr * a); + xg = qt_div_255(xg * a); + xb = qt_div_255(xb * a); + return (xa << 30) | (xr << 20) | (xg << 10) | xb; +} + +static Q_ALWAYS_INLINE uint qAlphaRgb30(uint c) +{ + uint a = c >> 30; + a |= a << 2; + a |= a << 4; + return a; +} + + // FIXME: Remove when all Qt modules have stopped using PREMUL and INV_PREMUL #define PREMUL(x) qPremultiply(x) #define INV_PREMUL(p) qUnpremultiply(p) @@ -795,15 +825,6 @@ do { \ } \ } while (0) -#if defined(Q_CC_RVCT) -# pragma push -# pragma arm -#endif -static Q_ALWAYS_INLINE int qt_div_255(int x) { return (x + (x>>8) + 0x80) >> 8; } -#if defined(Q_CC_RVCT) -# pragma pop -#endif - inline ushort qConvertRgb32To16(uint c) { return (((c) >> 3) & 0x001f) @@ -819,6 +840,84 @@ inline QRgb qConvertRgb16To32(uint c) | ((((c) << 8) & 0xf80000) | (((c) << 3) & 0x70000)); } +enum QtPixelOrder { + PixelOrderRGB, + PixelOrderBGR +}; + +template<enum QtPixelOrder> inline uint qConvertArgb32ToA2rgb30(QRgb); + +template<enum QtPixelOrder> inline uint qConvertRgb32ToRgb30(QRgb); + +template<enum QtPixelOrder> inline QRgb qConvertA2rgb30ToArgb32(uint c); + +template<> +inline uint qConvertArgb32ToA2rgb30<PixelOrderBGR>(QRgb c) +{ + return (c & 0xc0000000) + | (((c << 22) & 0x3fc00000) | ((c << 14) & 0x00300000)) + | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00)) + | (((c >> 14) & 0x000003fc) | ((c >> 22) & 0x00000003)); +} + +template<> +inline uint qConvertArgb32ToA2rgb30<PixelOrderRGB>(QRgb c) +{ + return (c & 0xc0000000) + | (((c << 6) & 0x3fc00000) | ((c >> 2) & 0x00300000)) + | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00)) + | (((c << 2) & 0x000003fc) | ((c >> 6) & 0x00000003)); +} + +template<> +inline uint qConvertRgb32ToRgb30<PixelOrderBGR>(QRgb c) +{ + return 0xc0000000 + | (((c << 22) & 0x3fc00000) | ((c << 14) & 0x00300000)) + | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00)) + | (((c >> 14) & 0x000003fc) | ((c >> 22) & 0x00000003)); +} + +template<> +inline uint qConvertRgb32ToRgb30<PixelOrderRGB>(QRgb c) +{ + return 0xc0000000 + | (((c << 6) & 0x3fc00000) | ((c >> 2) & 0x00300000)) + | (((c << 4) & 0x000ff000) | ((c >> 4) & 0x00000c00)) + | (((c << 2) & 0x000003fc) | ((c >> 6) & 0x00000003)); +} + +template<> +inline QRgb qConvertA2rgb30ToArgb32<PixelOrderBGR>(uint c) +{ + uint a = c >> 30; + a |= a << 2; + a |= a << 4; + return (a << 24) + | ((c << 14) & 0x00ff0000) + | ((c >> 4) & 0x0000ff00) + | ((c >> 22) & 0x000000ff); +} + +template<> +inline QRgb qConvertA2rgb30ToArgb32<PixelOrderRGB>(uint c) +{ + uint a = c >> 30; + a |= a << 2; + a |= a << 4; + return (a << 24) + | ((c >> 6) & 0x00ff0000) + | ((c >> 4) & 0x0000ff00) + | ((c >> 2) & 0x000000ff); +} + +inline uint qRgbSwapRgb30(uint c) +{ + const uint ag = c & 0xc00ffc00; + const uint rb = c & 0x3ff003ff; + return ag | (rb << 20) | (rb >> 20); +} + inline int qRed565(quint16 rgb) { const int r = (rgb & 0xf800); return (r >> 8) | (r >> 13); diff --git a/src/gui/painting/qmemrotate.cpp b/src/gui/painting/qmemrotate.cpp index 087231df43..e5eb7cf22d 100644 --- a/src/gui/painting/qmemrotate.cpp +++ b/src/gui/painting/qmemrotate.cpp @@ -532,7 +532,10 @@ MemRotateFunc qMemRotateFunctions[QImage::NImageFormats][3] = { 0, 0, 0 }, // Format_ARGB4444_Premultiplied, { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGBX8888, { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGBA8888, - { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 } // Format_RGBA8888_Premultiplied, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGBA8888_Premultiplied, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_RGB30, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 }, // Format_A2RGB30, + { qt_memrotate90_32, qt_memrotate180_32, qt_memrotate270_32 } // Format_A2RGB30_Premultiplied, }; QT_END_NAMESPACE diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index a004428fab..2e340219b9 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -423,6 +423,8 @@ void QRasterPaintEngine::init() case QImage::Format_ARGB32: case QImage::Format_RGBA8888_Premultiplied: case QImage::Format_RGBA8888: + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_A2RGB30_Premultiplied: gccaps |= PorterDuff; break; case QImage::Format_RGB32: @@ -432,6 +434,8 @@ void QRasterPaintEngine::init() case QImage::Format_RGB888: case QImage::Format_RGB16: case QImage::Format_RGBX8888: + case QImage::Format_BGR30: + case QImage::Format_RGB30: break; default: break; @@ -2243,6 +2247,8 @@ void QRasterPaintEngine::drawImage(const QRectF &r, const QImage &img, const QRe case QImage::Format_ARGB8555_Premultiplied: case QImage::Format_ARGB4444_Premultiplied: case QImage::Format_RGBA8888_Premultiplied: + case QImage::Format_A2BGR30_Premultiplied: + case QImage::Format_A2RGB30_Premultiplied: // Combine premultiplied color with the opacity set on the painter. d->solid_color_filler.solid.color = ((((color & 0x00ff00ff) * s->intOpacity) >> 8) & 0x00ff00ff) diff --git a/src/network/doc/qtnetwork.qdocconf b/src/network/doc/qtnetwork.qdocconf index 33d6c24461..522d71fd27 100644 --- a/src/network/doc/qtnetwork.qdocconf +++ b/src/network/doc/qtnetwork.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtNetwork description = Qt Network Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = network diff --git a/src/platformsupport/accessibility/accessibility.pri b/src/platformsupport/accessibility/accessibility.pri index d63cd9656b..fb56edbf1a 100644 --- a/src/platformsupport/accessibility/accessibility.pri +++ b/src/platformsupport/accessibility/accessibility.pri @@ -1,7 +1,9 @@ -INCLUDEPATH += $$PWD +contains(QT_CONFIG, accessibility) { + INCLUDEPATH += $$PWD -HEADERS += \ - $$PWD/qaccessiblebridgeutils_p.h + HEADERS += \ + $$PWD/qaccessiblebridgeutils_p.h -SOURCES += \ - $$PWD/qaccessiblebridgeutils.cpp + SOURCES += \ + $$PWD/qaccessiblebridgeutils.cpp +} diff --git a/src/platformsupport/linuxaccessibility/application.cpp b/src/platformsupport/linuxaccessibility/application.cpp index 2b932a816d..5a8d0e73f0 100644 --- a/src/platformsupport/linuxaccessibility/application.cpp +++ b/src/platformsupport/linuxaccessibility/application.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/application_p.h b/src/platformsupport/linuxaccessibility/application_p.h index 4cdce4de9e..72c27c0d88 100644 --- a/src/platformsupport/linuxaccessibility/application_p.h +++ b/src/platformsupport/linuxaccessibility/application_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp index 60972af70d..0b3a0a6834 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor.cpp +++ b/src/platformsupport/linuxaccessibility/atspiadaptor.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. @@ -1639,13 +1639,13 @@ bool AtSpiAdaptor::componentInterface(QAccessibleInterface *interface, const QSt size << rect.width() << rect.height(); connection.send(message.createReply(size)); } else if (function == QLatin1String("GrabFocus")) { -// FIXME: implement focus grabbing -// if (interface->object() && interface->object()->isWidgetType()) { -// QWidget* w = static_cast<QWidget*>(interface->object()); -// w->setFocus(Qt::OtherFocusReason); -// sendReply(connection, message, true); -// } - sendReply(connection, message, false); + QAccessibleActionInterface *actionIface = interface->actionInterface(); + if (actionIface && actionIface->actionNames().contains(QAccessibleActionInterface::setFocusAction())) { + actionIface->doAction(QAccessibleActionInterface::setFocusAction()); + sendReply(connection, message, true); + } else { + sendReply(connection, message, false); + } } else if (function == QLatin1String("SetExtents")) { // int x = message.arguments().at(0).toInt(); // int y = message.arguments().at(1).toInt(); diff --git a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h index 2116a4e6a9..244d3d7594 100644 --- a/src/platformsupport/linuxaccessibility/atspiadaptor_p.h +++ b/src/platformsupport/linuxaccessibility/atspiadaptor_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/bridge.cpp b/src/platformsupport/linuxaccessibility/bridge.cpp index 350c67f1ed..612fce501b 100644 --- a/src/platformsupport/linuxaccessibility/bridge.cpp +++ b/src/platformsupport/linuxaccessibility/bridge.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/bridge_p.h b/src/platformsupport/linuxaccessibility/bridge_p.h index 0e1624c522..56018ef14c 100644 --- a/src/platformsupport/linuxaccessibility/bridge_p.h +++ b/src/platformsupport/linuxaccessibility/bridge_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/cache.cpp b/src/platformsupport/linuxaccessibility/cache.cpp index f9d519b9cd..a850c6dec4 100644 --- a/src/platformsupport/linuxaccessibility/cache.cpp +++ b/src/platformsupport/linuxaccessibility/cache.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/cache_p.h b/src/platformsupport/linuxaccessibility/cache_p.h index a8128d9320..dd7ef24e5e 100644 --- a/src/platformsupport/linuxaccessibility/cache_p.h +++ b/src/platformsupport/linuxaccessibility/cache_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/constant_mappings.cpp b/src/platformsupport/linuxaccessibility/constant_mappings.cpp index 9de667158b..0bafaa036c 100644 --- a/src/platformsupport/linuxaccessibility/constant_mappings.cpp +++ b/src/platformsupport/linuxaccessibility/constant_mappings.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/constant_mappings_p.h b/src/platformsupport/linuxaccessibility/constant_mappings_p.h index a0287a910b..50b7864836 100644 --- a/src/platformsupport/linuxaccessibility/constant_mappings_p.h +++ b/src/platformsupport/linuxaccessibility/constant_mappings_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/dbusconnection.cpp b/src/platformsupport/linuxaccessibility/dbusconnection.cpp index 7bdd586a1f..b5485c034e 100644 --- a/src/platformsupport/linuxaccessibility/dbusconnection.cpp +++ b/src/platformsupport/linuxaccessibility/dbusconnection.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/dbusconnection_p.h b/src/platformsupport/linuxaccessibility/dbusconnection_p.h index 70f6fb80ac..b4d1bea8af 100644 --- a/src/platformsupport/linuxaccessibility/dbusconnection_p.h +++ b/src/platformsupport/linuxaccessibility/dbusconnection_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/struct_marshallers.cpp b/src/platformsupport/linuxaccessibility/struct_marshallers.cpp index a5b663bfec..8c6f4959de 100644 --- a/src/platformsupport/linuxaccessibility/struct_marshallers.cpp +++ b/src/platformsupport/linuxaccessibility/struct_marshallers.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/platformsupport/linuxaccessibility/struct_marshallers_p.h b/src/platformsupport/linuxaccessibility/struct_marshallers_p.h index 0b775d5521..fb1e6756eb 100644 --- a/src/platformsupport/linuxaccessibility/struct_marshallers_p.h +++ b/src/platformsupport/linuxaccessibility/struct_marshallers_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtGui module of the Qt Toolkit. diff --git a/src/plugins/platforms/ios/quiaccessibilityelement.mm b/src/plugins/platforms/ios/quiaccessibilityelement.mm index c9e9e34cbd..331c38460c 100644 --- a/src/plugins/platforms/ios/quiaccessibilityelement.mm +++ b/src/plugins/platforms/ios/quiaccessibilityelement.mm @@ -65,8 +65,7 @@ QMacAccessibilityElement *element = cache->elementForId(anId); if (!element) { - QAccessibleInterface *iface = QAccessible::accessibleInterface(anId); - Q_ASSERT(iface); + Q_ASSERT(QAccessible::accessibleInterface(anId)); element = [[self alloc] initWithId:anId withAccessibilityContainer: view]; cache->insertElement(anId, element); } diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp index 6c67345e05..366adb9059 100644 --- a/src/plugins/platforms/windows/accessible/comutils.cpp +++ b/src/plugins/platforms/windows/accessible/comutils.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/windows/accessible/comutils.h b/src/plugins/platforms/windows/accessible/comutils.h index ebf16dfdf8..2ef11ec0dd 100644 --- a/src/plugins/platforms/windows/accessible/comutils.h +++ b/src/plugins/platforms/windows/accessible/comutils.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp index 082ddf625a..64a2891e49 100644 --- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp +++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.h b/src/plugins/platforms/windows/accessible/iaccessible2.h index 9c42fdc631..fd92fb25bf 100644 --- a/src/plugins/platforms/windows/accessible/iaccessible2.h +++ b/src/plugins/platforms/windows/accessible/iaccessible2.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index 307f2fc3bb..f5b0f2f166 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h index f25e2281a0..9e14868415 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index bda806d102..f6ba03151d 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -890,6 +890,11 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::get_accName(VARIANT varID, BST } } } + + QString shortcut = accessible->text(QAccessible::Accelerator); + if (!shortcut.isEmpty()) + name.append(QLatin1Char(' ') + shortcut); + if (name.size()) { *pszName = QStringToBSTR(name); return S_OK; diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h index 43482da4be..b9cc2ccb44 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/plugins/platforms/windows/cursors.qrc b/src/plugins/platforms/windows/cursors.qrc new file mode 100644 index 0000000000..fded527aac --- /dev/null +++ b/src/plugins/platforms/windows/cursors.qrc @@ -0,0 +1,25 @@ +<RCC> + <qresource prefix="/qt-project.org/windows/cursors"> + <file>images/closedhandcursor_32.png</file> + <file>images/closedhandcursor_48.png</file> + <file>images/closedhandcursor_64.png</file> + <file>images/dragcopycursor_32.png</file> + <file>images/dragcopycursor_48.png</file> + <file>images/dragcopycursor_64.png</file> + <file>images/draglinkcursor_32.png</file> + <file>images/draglinkcursor_48.png</file> + <file>images/draglinkcursor_64.png</file> + <file>images/dragmovecursor_32.png</file> + <file>images/dragmovecursor_48.png</file> + <file>images/dragmovecursor_64.png</file> + <file>images/openhandcursor_32.png</file> + <file>images/openhandcursor_48.png</file> + <file>images/openhandcursor_64.png</file> + <file>images/splithcursor_32.png</file> + <file>images/splithcursor_48.png</file> + <file>images/splithcursor_64.png</file> + <file>images/splitvcursor_32.png</file> + <file>images/splitvcursor_48.png</file> + <file>images/splitvcursor_64.png</file> + </qresource> +</RCC> diff --git a/src/plugins/platforms/windows/images/closedhandcursor_32.png b/src/plugins/platforms/windows/images/closedhandcursor_32.png Binary files differnew file mode 100644 index 0000000000..7b3cba1965 --- /dev/null +++ b/src/plugins/platforms/windows/images/closedhandcursor_32.png diff --git a/src/plugins/platforms/windows/images/closedhandcursor_48.png b/src/plugins/platforms/windows/images/closedhandcursor_48.png Binary files differnew file mode 100644 index 0000000000..e63031605e --- /dev/null +++ b/src/plugins/platforms/windows/images/closedhandcursor_48.png diff --git a/src/plugins/platforms/windows/images/closedhandcursor_64.png b/src/plugins/platforms/windows/images/closedhandcursor_64.png Binary files differnew file mode 100644 index 0000000000..438680ed4e --- /dev/null +++ b/src/plugins/platforms/windows/images/closedhandcursor_64.png diff --git a/src/plugins/platforms/windows/images/dragcopycursor_32.png b/src/plugins/platforms/windows/images/dragcopycursor_32.png Binary files differnew file mode 100644 index 0000000000..f40ac6a600 --- /dev/null +++ b/src/plugins/platforms/windows/images/dragcopycursor_32.png diff --git a/src/plugins/platforms/windows/images/dragcopycursor_48.png b/src/plugins/platforms/windows/images/dragcopycursor_48.png Binary files differnew file mode 100644 index 0000000000..21ee467f46 --- /dev/null +++ b/src/plugins/platforms/windows/images/dragcopycursor_48.png diff --git a/src/plugins/platforms/windows/images/dragcopycursor_64.png b/src/plugins/platforms/windows/images/dragcopycursor_64.png Binary files differnew file mode 100644 index 0000000000..c49bcf33aa --- /dev/null +++ b/src/plugins/platforms/windows/images/dragcopycursor_64.png diff --git a/src/plugins/platforms/windows/images/draglinkcursor_32.png b/src/plugins/platforms/windows/images/draglinkcursor_32.png Binary files differnew file mode 100644 index 0000000000..5efbce90d3 --- /dev/null +++ b/src/plugins/platforms/windows/images/draglinkcursor_32.png diff --git a/src/plugins/platforms/windows/images/draglinkcursor_48.png b/src/plugins/platforms/windows/images/draglinkcursor_48.png Binary files differnew file mode 100644 index 0000000000..51205101b1 --- /dev/null +++ b/src/plugins/platforms/windows/images/draglinkcursor_48.png diff --git a/src/plugins/platforms/windows/images/draglinkcursor_64.png b/src/plugins/platforms/windows/images/draglinkcursor_64.png Binary files differnew file mode 100644 index 0000000000..55eb0e313a --- /dev/null +++ b/src/plugins/platforms/windows/images/draglinkcursor_64.png diff --git a/src/plugins/platforms/windows/images/dragmovecursor_32.png b/src/plugins/platforms/windows/images/dragmovecursor_32.png Binary files differnew file mode 100644 index 0000000000..32781a15ff --- /dev/null +++ b/src/plugins/platforms/windows/images/dragmovecursor_32.png diff --git a/src/plugins/platforms/windows/images/dragmovecursor_48.png b/src/plugins/platforms/windows/images/dragmovecursor_48.png Binary files differnew file mode 100644 index 0000000000..6b15af6e84 --- /dev/null +++ b/src/plugins/platforms/windows/images/dragmovecursor_48.png diff --git a/src/plugins/platforms/windows/images/dragmovecursor_64.png b/src/plugins/platforms/windows/images/dragmovecursor_64.png Binary files differnew file mode 100644 index 0000000000..e9e4ece29f --- /dev/null +++ b/src/plugins/platforms/windows/images/dragmovecursor_64.png diff --git a/src/plugins/platforms/windows/images/openhandcursor_32.png b/src/plugins/platforms/windows/images/openhandcursor_32.png Binary files differnew file mode 100644 index 0000000000..a6948d48f7 --- /dev/null +++ b/src/plugins/platforms/windows/images/openhandcursor_32.png diff --git a/src/plugins/platforms/windows/images/openhandcursor_48.png b/src/plugins/platforms/windows/images/openhandcursor_48.png Binary files differnew file mode 100644 index 0000000000..e8beb8d29d --- /dev/null +++ b/src/plugins/platforms/windows/images/openhandcursor_48.png diff --git a/src/plugins/platforms/windows/images/openhandcursor_64.png b/src/plugins/platforms/windows/images/openhandcursor_64.png Binary files differnew file mode 100644 index 0000000000..d12e3a7283 --- /dev/null +++ b/src/plugins/platforms/windows/images/openhandcursor_64.png diff --git a/src/plugins/platforms/windows/images/splithcursor_32.png b/src/plugins/platforms/windows/images/splithcursor_32.png Binary files differnew file mode 100644 index 0000000000..1ad479eddf --- /dev/null +++ b/src/plugins/platforms/windows/images/splithcursor_32.png diff --git a/src/plugins/platforms/windows/images/splithcursor_48.png b/src/plugins/platforms/windows/images/splithcursor_48.png Binary files differnew file mode 100644 index 0000000000..bf59b9cdca --- /dev/null +++ b/src/plugins/platforms/windows/images/splithcursor_48.png diff --git a/src/plugins/platforms/windows/images/splithcursor_64.png b/src/plugins/platforms/windows/images/splithcursor_64.png Binary files differnew file mode 100644 index 0000000000..b857458671 --- /dev/null +++ b/src/plugins/platforms/windows/images/splithcursor_64.png diff --git a/src/plugins/platforms/windows/images/splitvcursor_32.png b/src/plugins/platforms/windows/images/splitvcursor_32.png Binary files differnew file mode 100644 index 0000000000..ebb55ae2e1 --- /dev/null +++ b/src/plugins/platforms/windows/images/splitvcursor_32.png diff --git a/src/plugins/platforms/windows/images/splitvcursor_48.png b/src/plugins/platforms/windows/images/splitvcursor_48.png Binary files differnew file mode 100644 index 0000000000..5408920652 --- /dev/null +++ b/src/plugins/platforms/windows/images/splitvcursor_48.png diff --git a/src/plugins/platforms/windows/images/splitvcursor_64.png b/src/plugins/platforms/windows/images/splitvcursor_64.png Binary files differnew file mode 100644 index 0000000000..7f09a40c01 --- /dev/null +++ b/src/plugins/platforms/windows/images/splitvcursor_64.png diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index bfe22dac3f..021a1dfb02 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -208,12 +208,13 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, static inline QSize systemCursorSize() { return QSize(GetSystemMetrics(SM_CXCURSOR), GetSystemMetrics(SM_CYCURSOR)); } static inline QSize standardCursorSize() { return QSize(32, 32); } +#if defined (Q_OS_WINCE) || defined (QT_NO_IMAGEFORMAT_PNG) // Create pixmap cursors from data and scale the image if the cursor size is // higher than the standard 32. Note that bitmap cursors as produced by // createBitmapCursor() only work for standard sizes (32,48,64...), which does // not work when scaling the 16x16 openhand cursor bitmaps to 150% (resulting // in a non-standard 24x24 size). -static HCURSOR createPixmapCursorFromData(const QSize &systemCursorSize, +static QCursor createPixmapCursorFromData(const QSize &systemCursorSize, // The cursor size the bitmap is targeted for const QSize &bitmapTargetCursorSize, // The actual size of the bitmap data @@ -231,33 +232,11 @@ static HCURSOR createPixmapCursorFromData(const QSize &systemCursorSize, rawImage = rawImage.transformed(transform, Qt::SmoothTransformation); } const QPoint hotSpot(rawImage.width() / 2, rawImage.height() / 2); - return QWindowsCursor::createPixmapCursor(rawImage, hotSpot); + return QCursor(rawImage, hotSpot.x(), hotSpot.y()); } -struct QWindowsStandardCursorMapping { - Qt::CursorShape shape; - LPCWSTR resource; -}; - -HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c) +QCursor QWindowsCursor::customCursor(Qt::CursorShape cursorShape) { - static const QWindowsStandardCursorMapping standardCursors[] = { - { Qt::ArrowCursor, IDC_ARROW}, - { Qt::UpArrowCursor, IDC_UPARROW }, - { Qt::CrossCursor, IDC_CROSS }, - { Qt::WaitCursor, IDC_WAIT }, - { Qt::IBeamCursor, IDC_IBEAM }, - { Qt::SizeVerCursor, IDC_SIZENS }, - { Qt::SizeHorCursor, IDC_SIZEWE }, - { Qt::SizeBDiagCursor, IDC_SIZENESW }, - { Qt::SizeFDiagCursor, IDC_SIZENWSE }, - { Qt::SizeAllCursor, IDC_SIZEALL }, - { Qt::ForbiddenCursor, IDC_NO }, - { Qt::WhatsThisCursor, IDC_HELP }, - { Qt::BusyCursor, IDC_APPSTARTING }, - { Qt::PointingHandCursor, IDC_HAND } - }; - // Non-standard Windows cursors are created from bitmaps static const uchar vsplit_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -324,6 +303,107 @@ HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c) 0xf0,0x7f,0xf8,0x7f,0xfc,0x7f,0xfc,0x3f,0xf8,0x3f,0xf0,0x1f, 0xe0,0x1f,0xe0,0x1f,0x00,0x00,0x00,0x00}; + switch (cursorShape) { + case Qt::SplitVCursor: + return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 32, vsplit_bits, vsplitm_bits); + case Qt::SplitHCursor: + return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 32, hsplit_bits, hsplitm_bits); + case Qt::OpenHandCursor: + return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 16, openhand_bits, openhandm_bits); + case Qt::ClosedHandCursor: + return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 16, closedhand_bits, closedhandm_bits); + case Qt::DragCopyCursor: + case Qt::DragMoveCursor: + case Qt::DragLinkCursor: + return QCursor(QGuiApplicationPrivate::instance()->getPixmapCursor(cursorShape), 0, 0); + } + + return QCursor(); +} +#else // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG +struct QWindowsCustomPngCursor { + Qt::CursorShape shape; + int size; + const char *fileName; + int hotSpotX; + int hotSpotY; +}; + +QCursor QWindowsCursor::customCursor(Qt::CursorShape cursorShape) +{ + static const QWindowsCustomPngCursor pngCursors[] = { + { Qt::SplitVCursor, 32, "splitvcursor_32.png", 11, 11 }, + { Qt::SplitVCursor, 48, "splitvcursor_48.png", 16, 17 }, + { Qt::SplitVCursor, 64, "splitvcursor_64.png", 22, 22 }, + { Qt::SplitHCursor, 32, "splithcursor_32.png", 11, 11 }, + { Qt::SplitHCursor, 48, "splithcursor_48.png", 16, 17 }, + { Qt::SplitHCursor, 64, "splithcursor_64.png", 22, 22 }, + { Qt::OpenHandCursor, 32, "openhandcursor_32.png", 10, 12 }, + { Qt::OpenHandCursor, 48, "openhandcursor_48.png", 15, 16 }, + { Qt::OpenHandCursor, 64, "openhandcursor_64.png", 20, 24 }, + { Qt::ClosedHandCursor, 32, "closedhandcursor_32.png", 10, 12 }, + { Qt::ClosedHandCursor, 48, "closedhandcursor_48.png", 15, 16 }, + { Qt::ClosedHandCursor, 64, "closedhandcursor_64.png", 20, 24 }, + { Qt::DragCopyCursor, 32, "dragcopycursor_32.png", 0, 0 }, + { Qt::DragCopyCursor, 48, "dragcopycursor_48.png", 0, 0 }, + { Qt::DragCopyCursor, 64, "dragcopycursor_64.png", 0, 0 }, + { Qt::DragMoveCursor, 32, "dragmovecursor_32.png", 0, 0 }, + { Qt::DragMoveCursor, 48, "dragmovecursor_48.png", 0, 0 }, + { Qt::DragMoveCursor, 64, "dragmovecursor_64.png", 0, 0 }, + { Qt::DragLinkCursor, 32, "draglinkcursor_32.png", 0, 0 }, + { Qt::DragLinkCursor, 48, "draglinkcursor_48.png", 0, 0 }, + { Qt::DragLinkCursor, 64, "draglinkcursor_64.png", 0, 0 } + }; + + const int cursorSize = GetSystemMetrics(SM_CXCURSOR); + const QWindowsCustomPngCursor *sEnd = pngCursors + sizeof(pngCursors) / sizeof(pngCursors[0]); + const QWindowsCustomPngCursor *bestFit = 0; + int sizeDelta = INT_MAX; + for (const QWindowsCustomPngCursor *s = pngCursors; s < sEnd; ++s) { + if (s->shape != cursorShape) + continue; + const int currentSizeDelta = qMax(s->size, cursorSize) - qMin(s->size, cursorSize); + if (currentSizeDelta < sizeDelta) { + bestFit = s; + if (currentSizeDelta == 0) + break; // Perfect match found + sizeDelta = currentSizeDelta; + } + } + + if (!bestFit) + return QCursor(); + + const QPixmap rawImage(QStringLiteral(":/qt-project.org/windows/cursors/images/") + + QString::fromLatin1(bestFit->fileName)); + return QCursor(rawImage, bestFit->hotSpotX, bestFit->hotSpotY); +} +#endif // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG + +struct QWindowsStandardCursorMapping { + Qt::CursorShape shape; + LPCWSTR resource; +}; + +HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c) +{ + static const QWindowsStandardCursorMapping standardCursors[] = { + { Qt::ArrowCursor, IDC_ARROW}, + { Qt::UpArrowCursor, IDC_UPARROW }, + { Qt::CrossCursor, IDC_CROSS }, + { Qt::WaitCursor, IDC_WAIT }, + { Qt::IBeamCursor, IDC_IBEAM }, + { Qt::SizeVerCursor, IDC_SIZENS }, + { Qt::SizeHorCursor, IDC_SIZEWE }, + { Qt::SizeBDiagCursor, IDC_SIZENESW }, + { Qt::SizeFDiagCursor, IDC_SIZENWSE }, + { Qt::SizeAllCursor, IDC_SIZEALL }, + { Qt::ForbiddenCursor, IDC_NO }, + { Qt::WhatsThisCursor, IDC_HELP }, + { Qt::BusyCursor, IDC_APPSTARTING }, + { Qt::PointingHandCursor, IDC_HAND } + }; + const Qt::CursorShape cursorShape = c.shape(); switch (cursorShape) { case Qt::BitmapCursor: { @@ -342,17 +422,13 @@ HCURSOR QWindowsCursor::createSystemCursor(const QCursor &c) return createBitmapCursor(blank, blank); } case Qt::SplitVCursor: - return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 32, vsplit_bits, vsplitm_bits); case Qt::SplitHCursor: - return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 32, hsplit_bits, hsplitm_bits); case Qt::OpenHandCursor: - return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 16, openhand_bits, openhandm_bits); case Qt::ClosedHandCursor: - return createPixmapCursorFromData(systemCursorSize(), standardCursorSize(), 16, closedhand_bits, closedhandm_bits); case Qt::DragCopyCursor: case Qt::DragMoveCursor: case Qt::DragLinkCursor: - return createPixmapCursor(QGuiApplicationPrivate::instance()->getPixmapCursor(cursorShape), c.hotSpot()); + return createSystemCursor(customCursor(cursorShape)); default: break; } diff --git a/src/plugins/platforms/windows/qwindowscursor.h b/src/plugins/platforms/windows/qwindowscursor.h index 81ae051824..bf2021cd9d 100644 --- a/src/plugins/platforms/windows/qwindowscursor.h +++ b/src/plugins/platforms/windows/qwindowscursor.h @@ -107,6 +107,7 @@ public: static HCURSOR createPixmapCursor(const QPixmap &pixmap, const QPoint &hotSpot); static HCURSOR createSystemCursor(const QCursor &c); + static QCursor customCursor(Qt::CursorShape cursorShape); static QPoint mousePosition(); static CursorState cursorState(); diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index 0343b7f110..37f51e85bd 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. @@ -1035,17 +1035,14 @@ bool QWindowsMimeImage::canConvertToMime(const QString &mimeType, IDataObject *p bool QWindowsMimeImage::canConvertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData) const { int cf = getCf(formatetc); - if (mimeData->hasImage()) { - if (cf == CF_DIB) - return true; - else if (cf == CF_DIBV5) { - //support DIBV5 conversion only if the image has alpha channel - QImage image = qvariant_cast<QImage>(mimeData->imageData()); - if (!image.isNull() && image.hasAlphaChannel()) - return true; - } - } - return false; + if (!mimeData->hasImage()) + return false; + const QImage image = qvariant_cast<QImage>(mimeData->imageData()); + if (image.isNull()) + return false; + // QTBUG-11463, deny CF_DIB support for images with alpha to prevent loss of + // transparency in conversion. + return cf == CF_DIBV5 || (cf == CF_DIB && !image.hasAlphaChannel()); } bool QWindowsMimeImage::convertFromMime(const FORMATETC &formatetc, const QMimeData *mimeData, STGMEDIUM * pmedium) const diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 18b4cc85cc..7d0b00b312 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -956,10 +956,12 @@ void QWindowsWindow::destroyWindow() if (hasMouseCapture()) setMouseGrabEnabled(false); setDropSiteEnabled(false); +#ifndef QT_NO_OPENGL if (m_surface) { m_data.staticOpenGLContext->destroyWindowSurface(m_surface); m_surface = 0; } +#endif #ifdef Q_OS_WINCE if ((m_windowState & Qt::WindowFullScreen) && !m_previouslyHidden) { HWND handle = FindWindow(L"HHTaskBar", L""); @@ -2287,10 +2289,14 @@ void QWindowsWindow::setCustomMargins(const QMargins &newCustomMargins) void *QWindowsWindow::surface(void *nativeConfig) { +#ifdef QT_NO_OPENGL + return 0; +#else if (!m_surface) m_surface = m_data.staticOpenGLContext->createWindowSurface(m_data.hwnd, nativeConfig); return m_surface; +#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index fec9af2645..104d882fba 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -113,6 +113,10 @@ contains(QT_CONFIG,dynamicgl) { HEADERS += $$PWD/qwindowssessionmanager.h } +!wince*:!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ) { + RESOURCES += $$PWD/cursors.qrc +} + contains(QT_CONFIG, freetype) { DEFINES *= QT_NO_FONTCONFIG QT_FREETYPE_DIR = $$QT_SOURCE_TREE/src/3rdparty/freetype diff --git a/src/plugins/platforms/xcb/qxcbimage.cpp b/src/plugins/platforms/xcb/qxcbimage.cpp index 181d99e85b..bc800524ef 100644 --- a/src/plugins/platforms/xcb/qxcbimage.cpp +++ b/src/plugins/platforms/xcb/qxcbimage.cpp @@ -68,6 +68,14 @@ QImage::Format qt_xcb_imageFormatForVisual(QXcbConnection *connection, uint8_t d && visual->green_mask == 0xff00 && visual->blue_mask == 0xff) return QImage::Format_ARGB32_Premultiplied; + if (depth == 30 && format->bits_per_pixel == 32 && visual->red_mask == 0x3ff + && visual->green_mask == 0x0ffc00 && visual->blue_mask == 0x3ff00000) + return QImage::Format_BGR30; + + if (depth == 30 && format->bits_per_pixel == 32 && visual->blue_mask == 0x3ff + && visual->green_mask == 0x0ffc00 && visual->red_mask == 0x3ff00000) + return QImage::Format_RGB30; + if (depth == 24 && format->bits_per_pixel == 32 && visual->red_mask == 0xff0000 && visual->green_mask == 0xff00 && visual->blue_mask == 0xff) return QImage::Format_RGB32; @@ -147,6 +155,13 @@ QPixmap qt_xcb_pixmapFromXPixmap(QXcbConnection *connection, xcb_pixmap_t pixmap p[x] |= 0xff000000; p += bytes_per_line / 4; } + } else if (format == QImage::Format_BGR30 || format == QImage::Format_RGB30) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < height; ++y) { + for (int x = 0; x < width; ++x) + p[x] |= 0xc0000000; + p += bytes_per_line / 4; + } } result = QPixmap::fromImage(image.copy()); diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index f002d473b7..0cc8c8dbfe 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -166,16 +166,36 @@ static inline bool isTransient(const QWindow *w) || w->type() == Qt::Popup; } -static inline QImage::Format imageFormatForDepth(int depth) +static inline QImage::Format imageFormatForVisual(int depth, quint32 red_mask, quint32 blue_mask) { switch (depth) { - case 32: return QImage::Format_ARGB32_Premultiplied; - case 24: return QImage::Format_RGB32; - case 16: return QImage::Format_RGB16; - default: - qWarning("Unsupported screen depth: %d", depth); - return QImage::Format_Invalid; + case 32: + if (blue_mask == 0xff) + return QImage::Format_ARGB32_Premultiplied; + if (red_mask == 0x3ff) + return QImage::Format_A2BGR30_Premultiplied; + if (blue_mask == 0x3ff) + return QImage::Format_A2RGB30_Premultiplied; + break; + case 30: + if (red_mask == 0x3ff) + return QImage::Format_BGR30; + if (blue_mask == 0x3ff) + return QImage::Format_RGB30; + break; + case 24: + if (blue_mask == 0xff) + return QImage::Format_RGB32; + break; + case 16: + if (blue_mask == 0x1f) + return QImage::Format_RGB16; + break; + default: + break; } + qWarning("Unsupported screen format: depth: %d, red_mask: %x, blue_mask: %x", depth, red_mask, blue_mask); + return QImage::Format_Invalid; } static inline bool positionIncludesFrame(QWindow *w) @@ -227,7 +247,9 @@ void QXcbWindow::create() if (type == Qt::Desktop) { m_window = m_screen->root(); m_depth = m_screen->screen()->root_depth; - m_imageFormat = imageFormatForDepth(m_depth); + m_visualId = m_screen->screen()->root_visual; + const xcb_visualtype_t *visual = m_screen->visualForId(m_visualId); + m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask); connection()->addWindowEventListener(m_window, this); return; } @@ -317,7 +339,7 @@ void QXcbWindow::create() } if (visualInfo) { m_depth = visualInfo->depth; - m_imageFormat = imageFormatForDepth(m_depth); + m_imageFormat = imageFormatForVisual(visualInfo->depth, visualInfo->red_mask, visualInfo->blue_mask); Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), xcb_parent_id, visualInfo->visual, AllocNone); XSetWindowAttributes a; @@ -367,7 +389,8 @@ void QXcbWindow::create() } } - m_imageFormat = imageFormatForDepth(m_depth); + const xcb_visualtype_t *visual = m_screen->visualForId(m_visualId); + m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask); Q_XCB_CALL(xcb_create_window(xcb_connection(), m_depth, diff --git a/src/printsupport/doc/qtprintsupport.qdocconf b/src/printsupport/doc/qtprintsupport.qdocconf index 4d1f0c39f1..2ec33f6600 100644 --- a/src/printsupport/doc/qtprintsupport.qdocconf +++ b/src/printsupport/doc/qtprintsupport.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtPrintSupport description = Qt Print Support Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = printsupport diff --git a/src/sql/doc/qtsql.qdocconf b/src/sql/doc/qtsql.qdocconf index 7f37904039..b8632c5260 100644 --- a/src/sql/doc/qtsql.qdocconf +++ b/src/sql/doc/qtsql.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtSql description = Qt SQL Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = sql diff --git a/src/testlib/doc/qttestlib.qdocconf b/src/testlib/doc/qttestlib.qdocconf index 92e5c97aab..35b4fbcb7b 100644 --- a/src/testlib/doc/qttestlib.qdocconf +++ b/src/testlib/doc/qttestlib.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtTestLib description = Qt Test Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = testlib diff --git a/src/tools/qdoc/doc/config/qdoc.qdocconf b/src/tools/qdoc/doc/config/qdoc.qdocconf index 0f4ad07711..9d841e9b64 100644 --- a/src/tools/qdoc/doc/config/qdoc.qdocconf +++ b/src/tools/qdoc/doc/config/qdoc.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QDoc description = QDoc Manual -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION sourcedirs = .. diff --git a/src/tools/qdoc/doc/files/qtgui.qdocconf b/src/tools/qdoc/doc/files/qtgui.qdocconf index 7f80808bfc..855ed538c2 100644 --- a/src/tools/qdoc/doc/files/qtgui.qdocconf +++ b/src/tools/qdoc/doc/files/qtgui.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtGui description = Qt GUI Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = gui diff --git a/src/tools/qdoc/qdocindexfiles.cpp b/src/tools/qdoc/qdocindexfiles.cpp index 317209dd64..4531ce8eea 100644 --- a/src/tools/qdoc/qdocindexfiles.cpp +++ b/src/tools/qdoc/qdocindexfiles.cpp @@ -1070,6 +1070,25 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("type", functionNode->returnType()); if (!brief.isEmpty()) writer.writeAttribute("brief", brief); + + /* + Note: The "signature" attribute is written to the + index file, but it is not read back in. Is that ok? + */ + QString signature = functionNode->signature(); + if (functionNode->isConst()) + signature += " const"; + writer.writeAttribute("signature", signature); + + for (int i = 0; i < functionNode->parameters().size(); ++i) { + Parameter parameter = functionNode->parameters()[i]; + writer.writeStartElement("parameter"); + writer.writeAttribute("left", parameter.leftType()); + writer.writeAttribute("right", parameter.rightType()); + writer.writeAttribute("name", parameter.name()); + writer.writeAttribute("default", parameter.defaultValue()); + writer.writeEndElement(); // parameter + } } break; case Node::QmlProperty: @@ -1137,6 +1156,28 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, writer.writeAttribute("brief", brief); } break; + case Node::Enum: + { + const EnumNode* enumNode = static_cast<const EnumNode*>(node); + if (enumNode->flagsType()) { + writer.writeAttribute("typedef",enumNode->flagsType()->fullDocumentName()); + } + foreach (const EnumItem& item, enumNode->items()) { + writer.writeStartElement("value"); + writer.writeAttribute("name", item.name()); + writer.writeAttribute("value", item.value()); + writer.writeEndElement(); // value + } + } + break; + case Node::Typedef: + { + const TypedefNode* typedefNode = static_cast<const TypedefNode*>(node); + if (typedefNode->associatedEnum()) { + writer.writeAttribute("enum",typedefNode->associatedEnum()->fullDocumentName()); + } + } + break; default: break; } @@ -1198,45 +1239,6 @@ bool QDocIndexFiles::generateIndexSection(QXmlStreamWriter& writer, } } } - else if (node->type() == Node::Function) { - const FunctionNode* functionNode = static_cast<const FunctionNode*>(node); - /* - Note: The "signature" attribute is written to the - index file, but it is not read back in. Is that ok? - */ - QString signature = functionNode->signature(); - if (functionNode->isConst()) - signature += " const"; - writer.writeAttribute("signature", signature); - - for (int i = 0; i < functionNode->parameters().size(); ++i) { - Parameter parameter = functionNode->parameters()[i]; - writer.writeStartElement("parameter"); - writer.writeAttribute("left", parameter.leftType()); - writer.writeAttribute("right", parameter.rightType()); - writer.writeAttribute("name", parameter.name()); - writer.writeAttribute("default", parameter.defaultValue()); - writer.writeEndElement(); // parameter - } - } - else if (node->type() == Node::Enum) { - const EnumNode* enumNode = static_cast<const EnumNode*>(node); - if (enumNode->flagsType()) { - writer.writeAttribute("typedef",enumNode->flagsType()->fullDocumentName()); - } - foreach (const EnumItem& item, enumNode->items()) { - writer.writeStartElement("value"); - writer.writeAttribute("name", item.name()); - writer.writeAttribute("value", item.value()); - writer.writeEndElement(); // value - } - } - else if (node->type() == Node::Typedef) { - const TypedefNode* typedefNode = static_cast<const TypedefNode*>(node); - if (typedefNode->associatedEnum()) { - writer.writeAttribute("enum",typedefNode->associatedEnum()->fullDocumentName()); - } - } return true; } diff --git a/src/widgets/accessible/complexwidgets.cpp b/src/widgets/accessible/complexwidgets.cpp index 3b7ff2ea26..f7c2ac0cf1 100644 --- a/src/widgets/accessible/complexwidgets.cpp +++ b/src/widgets/accessible/complexwidgets.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/complexwidgets.h b/src/widgets/accessible/complexwidgets.h index 00186282f3..d3df224d95 100644 --- a/src/widgets/accessible/complexwidgets.h +++ b/src/widgets/accessible/complexwidgets.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/itemviews.cpp b/src/widgets/accessible/itemviews.cpp index 36b48cfd05..723a670739 100644 --- a/src/widgets/accessible/itemviews.cpp +++ b/src/widgets/accessible/itemviews.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/itemviews.h b/src/widgets/accessible/itemviews.h index 45a07c5972..2f9ca6163b 100644 --- a/src/widgets/accessible/itemviews.h +++ b/src/widgets/accessible/itemviews.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblemenu.cpp b/src/widgets/accessible/qaccessiblemenu.cpp index a6877404eb..f47980d786 100644 --- a/src/widgets/accessible/qaccessiblemenu.cpp +++ b/src/widgets/accessible/qaccessiblemenu.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblemenu.h b/src/widgets/accessible/qaccessiblemenu.h index e8c9f8af3a..593821e7ff 100644 --- a/src/widgets/accessible/qaccessiblemenu.h +++ b/src/widgets/accessible/qaccessiblemenu.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblewidget.cpp b/src/widgets/accessible/qaccessiblewidget.cpp index 8a2e38df7e..73425b9acd 100644 --- a/src/widgets/accessible/qaccessiblewidget.cpp +++ b/src/widgets/accessible/qaccessiblewidget.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblewidget.h b/src/widgets/accessible/qaccessiblewidget.h index 819bb5b8c4..079e5dbc42 100644 --- a/src/widgets/accessible/qaccessiblewidget.h +++ b/src/widgets/accessible/qaccessiblewidget.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblewidgetfactory.cpp b/src/widgets/accessible/qaccessiblewidgetfactory.cpp index a925dd2708..3d123cc9ab 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory.cpp +++ b/src/widgets/accessible/qaccessiblewidgetfactory.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblewidgetfactory_p.h b/src/widgets/accessible/qaccessiblewidgetfactory_p.h index 70ac462950..bf5e2da6bc 100644 --- a/src/widgets/accessible/qaccessiblewidgetfactory_p.h +++ b/src/widgets/accessible/qaccessiblewidgetfactory_p.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the QtWidgets module of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblewidgets.cpp b/src/widgets/accessible/qaccessiblewidgets.cpp index f0a8ecf608..da57d4657d 100644 --- a/src/widgets/accessible/qaccessiblewidgets.cpp +++ b/src/widgets/accessible/qaccessiblewidgets.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/qaccessiblewidgets.h b/src/widgets/accessible/qaccessiblewidgets.h index 3f50010685..27764cb0ac 100644 --- a/src/widgets/accessible/qaccessiblewidgets.h +++ b/src/widgets/accessible/qaccessiblewidgets.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/rangecontrols.cpp b/src/widgets/accessible/rangecontrols.cpp index f2d98df719..26e32d682b 100644 --- a/src/widgets/accessible/rangecontrols.cpp +++ b/src/widgets/accessible/rangecontrols.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/rangecontrols.h b/src/widgets/accessible/rangecontrols.h index dd69788bb1..98cef46c5c 100644 --- a/src/widgets/accessible/rangecontrols.h +++ b/src/widgets/accessible/rangecontrols.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/simplewidgets.cpp b/src/widgets/accessible/simplewidgets.cpp index 89bda70f31..6160b37a0f 100644 --- a/src/widgets/accessible/simplewidgets.cpp +++ b/src/widgets/accessible/simplewidgets.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/accessible/simplewidgets.h b/src/widgets/accessible/simplewidgets.h index af67a1e669..e4ce6150e2 100644 --- a/src/widgets/accessible/simplewidgets.h +++ b/src/widgets/accessible/simplewidgets.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies). ** Contact: http://www.qt-project.org/legal ** ** This file is part of the plugins of the Qt Toolkit. diff --git a/src/widgets/dialogs/qcolordialog.cpp b/src/widgets/dialogs/qcolordialog.cpp index 714dcfa1f4..3f1773c88e 100644 --- a/src/widgets/dialogs/qcolordialog.cpp +++ b/src/widgets/dialogs/qcolordialog.cpp @@ -1553,12 +1553,10 @@ void QColorDialogPrivate::_q_pickScreenColor() q->installEventFilter(colorPickingEventFilter); // If user pushes Escape, the last color before picking will be restored. beforeScreenColorPicking = cs->currentColor(); - /*For some reason, q->grabMouse(Qt::CrossCursor) doesn't change - * the cursor, and therefore I have to change it manually. - */ - q->grabMouse(); #ifndef QT_NO_CURSOR - q->setCursor(Qt::CrossCursor); + q->grabMouse(Qt::CrossCursor); +#else + q->grabMouse(); #endif q->grabKeyboard(); /* With setMouseTracking(true) the desired color can be more precisedly picked up, @@ -1583,9 +1581,6 @@ void QColorDialogPrivate::releaseColorPicking() q->removeEventFilter(colorPickingEventFilter); q->releaseMouse(); q->releaseKeyboard(); -#ifndef QT_NO_CURSOR - q->setCursor(Qt::ArrowCursor); -#endif q->setMouseTracking(false); lblScreenColorInfo->setText(QLatin1String("\n")); addCusBt->setDisabled(false); diff --git a/src/widgets/doc/qtwidgets.qdocconf b/src/widgets/doc/qtwidgets.qdocconf index 508a257fa5..4b19702208 100644 --- a/src/widgets/doc/qtwidgets.qdocconf +++ b/src/widgets/doc/qtwidgets.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtWidgets description = Qt Widgets Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = widgets diff --git a/src/widgets/kernel/qwidget.cpp b/src/widgets/kernel/qwidget.cpp index c17f5c6e2e..f53bafcc5f 100644 --- a/src/widgets/kernel/qwidget.cpp +++ b/src/widgets/kernel/qwidget.cpp @@ -5515,7 +5515,9 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP if (renderToTexture) { // This widget renders into a texture which is composed later. We just need to // punch a hole in the backingstore, so the texture will be visible. +#ifndef QT_NO_OPENGL QPainter p(q); + if (backingStore) { p.setCompositionMode(QPainter::CompositionMode_Source); p.fillRect(q->rect(), Qt::transparent); @@ -5523,6 +5525,7 @@ void QWidgetPrivate::drawWidget(QPaintDevice *pdev, const QRegion &rgn, const QP // We are not drawing to a backingstore: fall back to QImage p.drawImage(q->rect(), grabFramebuffer()); } +#endif } else { //actually send the paint event QPaintEvent e(toBePainted); @@ -12179,6 +12182,7 @@ QPoint QWidget::mapFromGlobal(const QPoint &pos) const QWidget *qt_pressGrab = 0; QWidget *qt_mouseGrb = 0; +static bool mouseGrabWithCursor = false; static QWidget *keyboardGrb = 0; static inline QWindow *grabberWindow(const QWidget *w) @@ -12190,6 +12194,46 @@ static inline QWindow *grabberWindow(const QWidget *w) return window; } +#ifndef QT_NO_CURSOR +static void grabMouseForWidget(QWidget *widget, const QCursor *cursor = 0) +#else +static void grabMouseForWidget(QWidget *widget) +#endif +{ + if (qt_mouseGrb) + qt_mouseGrb->releaseMouse(); + + mouseGrabWithCursor = false; + if (QWindow *window = grabberWindow(widget)) { +#ifndef QT_NO_CURSOR + if (cursor) { + mouseGrabWithCursor = true; + QGuiApplication::setOverrideCursor(*cursor); + } +#endif // !QT_NO_CURSOR + window->setMouseGrabEnabled(true); + } + + qt_mouseGrb = widget; + qt_pressGrab = 0; +} + +static void releaseMouseGrabOfWidget(QWidget *widget) +{ + if (qt_mouseGrb == widget) { + if (QWindow *window = grabberWindow(widget)) { +#ifndef QT_NO_CURSOR + if (mouseGrabWithCursor) { + QGuiApplication::restoreOverrideCursor(); + mouseGrabWithCursor = false; + } +#endif // !QT_NO_CURSOR + window->setMouseGrabEnabled(false); + } + } + qt_mouseGrb = 0; +} + /*! \fn void QWidget::grabMouse() @@ -12221,14 +12265,7 @@ static inline QWindow *grabberWindow(const QWidget *w) */ void QWidget::grabMouse() { - if (qt_mouseGrb) - qt_mouseGrb->releaseMouse(); - - if (QWindow *window = grabberWindow(this)) - window->setMouseGrabEnabled(true); - - qt_mouseGrb = this; - qt_pressGrab = 0; + grabMouseForWidget(this); } /*! @@ -12250,8 +12287,7 @@ void QWidget::grabMouse() #ifndef QT_NO_CURSOR void QWidget::grabMouse(const QCursor &cursor) { - Q_UNUSED(cursor); - grabMouse(); + grabMouseForWidget(this, &cursor); } #endif @@ -12273,11 +12309,7 @@ bool QWidgetPrivate::stealMouseGrab(bool grab) */ void QWidget::releaseMouse() { - if (qt_mouseGrb == this) { - if (QWindow *window = grabberWindow(this)) - window->setMouseGrabEnabled(false); - qt_mouseGrb = 0; - } + releaseMouseGrabOfWidget(this); } /*! diff --git a/src/widgets/widgets/qdockwidget.cpp b/src/widgets/widgets/qdockwidget.cpp index ad9481a928..3efa89edb3 100644 --- a/src/widgets/widgets/qdockwidget.cpp +++ b/src/widgets/widgets/qdockwidget.cpp @@ -591,10 +591,6 @@ void QDockWidgetPrivate::init() QObject::connect(button, SIGNAL(clicked()), q, SLOT(close())); layout->setWidgetForRole(QDockWidgetLayout::CloseButton, button); - resizer = new QWidgetResizeHandler(q); - resizer->setMovingEnabled(false); - resizer->setActive(false); - #ifndef QT_NO_ACTION toggleViewAction = new QAction(q); toggleViewAction->setCheckable(true); @@ -760,13 +756,12 @@ void QDockWidgetPrivate::endDrag(bool abort) Qt::WindowFlags flags = q->windowFlags(); flags &= ~Qt::X11BypassWindowManagerHint; q->setWindowFlags(flags); - resizer->setActive(QWidgetResizeHandler::Resize, true); + setResizerActive(true); q->show(); } else { QDockWidgetLayout *myLayout = qobject_cast<QDockWidgetLayout*>(layout); - resizer->setActive(QWidgetResizeHandler::Resize, - myLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0); + setResizerActive(myLayout->widgetForRole(QDockWidgetLayout::TitleBar) != 0); } undockedGeometry = q->geometry(); q->activateWindow(); @@ -779,6 +774,17 @@ void QDockWidgetPrivate::endDrag(bool abort) state = 0; } +void QDockWidgetPrivate::setResizerActive(bool active) +{ + Q_Q(QDockWidget); + if (active && !resizer) { + resizer = new QWidgetResizeHandler(q); + resizer->setMovingEnabled(false); + } + if (resizer) + resizer->setActive(QWidgetResizeHandler::Resize, active); +} + bool QDockWidgetPrivate::isAnimating() const { Q_Q(const QDockWidget); @@ -1052,7 +1058,7 @@ void QDockWidgetPrivate::setWindowState(bool floating, bool unplug, const QRect } } - resizer->setActive(QWidgetResizeHandler::Resize, !unplug && floating && !nativeDeco); + setResizerActive(!unplug && floating && !nativeDeco); } /*! diff --git a/src/widgets/widgets/qdockwidget_p.h b/src/widgets/widgets/qdockwidget_p.h index f7cd8c0039..a4dc68dd7d 100644 --- a/src/widgets/widgets/qdockwidget_p.h +++ b/src/widgets/widgets/qdockwidget_p.h @@ -88,7 +88,7 @@ public: features(QDockWidget::DockWidgetClosable | QDockWidget::DockWidgetMovable | QDockWidget::DockWidgetFloatable), - allowedAreas(Qt::AllDockWidgetAreas) + allowedAreas(Qt::AllDockWidgetAreas), resizer(0) { } void init(); @@ -101,8 +101,6 @@ public: QDockWidget::DockWidgetFeatures features; Qt::DockWidgetAreas allowedAreas; - QWidgetResizeHandler *resizer; - #ifndef QT_NO_ACTION QAction *toggleViewAction; #endif @@ -124,8 +122,12 @@ public: void unplug(const QRect &rect); void plug(const QRect &rect); + void setResizerActive(bool active); bool isAnimating() const; + +private: + QWidgetResizeHandler *resizer; }; class Q_WIDGETS_EXPORT QDockWidgetLayout : public QLayout diff --git a/src/widgets/widgets/qwidgetresizehandler.cpp b/src/widgets/widgets/qwidgetresizehandler.cpp index ba4e69126a..d4d44e60cd 100644 --- a/src/widgets/widgets/qwidgetresizehandler.cpp +++ b/src/widgets/widgets/qwidgetresizehandler.cpp @@ -58,6 +58,10 @@ QT_BEGIN_NAMESPACE static bool resizeHorizontalDirectionFixed = false; static bool resizeVerticalDirectionFixed = false; +// ### fixme: Qt 6: No longer export QWidgetResizeHandler and remove "Move" +// functionality. Currently, only the resize functionality is used by QDockWidget. +// Historically, the class was used in Qt 3's QWorkspace (predecessor to QMdiArea). + QWidgetResizeHandler::QWidgetResizeHandler(QWidget *parent, QWidget *cw) : QObject(parent), widget(parent), childWidget(cw ? cw : parent), fw(0), extrahei(0), buttonDown(false), moveResizeMode(false), sizeprotect(true), movingEnabled(true) diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp index a6b1aceb66..5f60bf02d0 100644 --- a/src/widgets/widgets/qwidgettextcontrol.cpp +++ b/src/widgets/widgets/qwidgettextcontrol.cpp @@ -645,8 +645,8 @@ void QWidgetTextControlPrivate::_q_emitCursorPosChanged(const QTextCursor &someC void QWidgetTextControlPrivate::_q_contentsChanged(int from, int charsRemoved, int charsAdded) { - Q_Q(QWidgetTextControl); #ifndef QT_NO_ACCESSIBILITY + Q_Q(QWidgetTextControl); if (QAccessible::isActive() && q->parent() && q->parent()->isWidgetType()) { QTextCursor tmp(doc); @@ -670,6 +670,10 @@ void QWidgetTextControlPrivate::_q_contentsChanged(int from, int charsRemoved, i QAccessible::updateAccessibility(ev); delete ev; } +#else + Q_UNUSED(from) + Q_UNUSED(charsRemoved) + Q_UNUSED(charsAdded) #endif } diff --git a/src/xml/doc/qtxml.qdocconf b/src/xml/doc/qtxml.qdocconf index 7f8fddfd11..f36848b566 100644 --- a/src/xml/doc/qtxml.qdocconf +++ b/src/xml/doc/qtxml.qdocconf @@ -2,7 +2,6 @@ include($QT_INSTALL_DOCS/global/qt-module-defaults.qdocconf) project = QtXml description = Qt XML Reference Documentation -url = http://qt-project.org/doc/qt-$QT_VER version = $QT_VERSION examplesinstallpath = xml |