summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/corelib.pro14
-rw-r--r--src/corelib/global/qcompilerdetection.h6
-rw-r--r--src/corelib/global/qglobal.h12
-rw-r--r--src/corelib/io/io.pri2
-rw-r--r--src/corelib/io/qdir.cpp13
-rw-r--r--src/corelib/io/qstandardpaths_android.cpp331
-rw-r--r--src/corelib/io/qurl.cpp2
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp28
-rw-r--r--src/corelib/kernel/qjnihelpers.cpp21
-rw-r--r--src/corelib/kernel/qjnihelpers_p.h1
-rw-r--r--src/corelib/kernel/qobject.cpp9
-rw-r--r--src/corelib/kernel/qobject_p.h6
-rw-r--r--src/corelib/thread/qthread_p.h2
-rw-r--r--src/corelib/thread/qthread_unix.cpp4
-rw-r--r--src/corelib/thread/qthread_win.cpp4
-rw-r--r--src/corelib/tools/qcommandlineparser.cpp3
-rw-r--r--src/corelib/tools/qdatetime.cpp42
-rw-r--r--src/corelib/tools/qstring.cpp35
-rw-r--r--src/corelib/tools/qstring_mips_dsp_asm.S449
-rw-r--r--src/corelib/tools/qvector.h21
-rw-r--r--src/corelib/tools/tools.pri4
-rw-r--r--src/gui/image/image.pri2
-rw-r--r--src/gui/image/qimage.cpp6
-rw-r--r--src/gui/image/qimage_mips_dspr2.cpp69
-rw-r--r--src/gui/image/qimage_mips_dspr2_asm.S207
-rw-r--r--src/gui/kernel/qguiapplication.cpp3
-rw-r--r--src/gui/painting/qdrawhelper.cpp23
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp.cpp97
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp_asm.S478
-rw-r--r--src/gui/painting/qdrawhelper_mips_dsp_p.h45
-rw-r--r--src/gui/painting/qdrawhelper_mips_dspr2_asm.S550
-rw-r--r--src/gui/painting/qpainter.cpp5
-rw-r--r--src/gui/painting/qt_mips_asm_dsp_p.h166
-rw-r--r--src/network/socket/qabstractsocket.cpp8
-rw-r--r--src/network/ssl/qsslcontext.cpp3
-rw-r--r--src/plugins/platforms/cocoa/qcocoatheme.mm24
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks.h3
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp26
-rw-r--r--src/plugins/platforms/windows/qwindowsdialoghelpers.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp2
-rw-r--r--src/plugins/platforms/xcb/qxcbwindow.cpp6
-rw-r--r--src/sql/drivers/sqlite/qsql_sqlite.cpp2
-rw-r--r--src/testlib/qtestcase.cpp7
-rw-r--r--src/testlib/qtestkeyboard.h12
-rw-r--r--src/testlib/qtestresult.cpp6
-rw-r--r--src/testlib/qtestsystem.h2
-rw-r--r--src/tools/moc/main.cpp3
-rw-r--r--src/tools/moc/preprocessor.cpp3
-rw-r--r--src/tools/moc/preprocessor.h2
-rw-r--r--src/tools/qdoc/doc/config/qdoc.qdocconf1
-rw-r--r--src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp2
-rw-r--r--src/widgets/graphicsview/qgraphicswidget.cpp4
-rw-r--r--src/widgets/itemviews/qlistview.cpp5
-rw-r--r--src/widgets/styles/qcommonstyle.cpp5
-rw-r--r--src/widgets/styles/qstylesheetstyle.cpp4
-rw-r--r--src/widgets/styles/qwindowsvistastyle.cpp6
-rw-r--r--src/widgets/widgets/qtextedit.cpp2
57 files changed, 2692 insertions, 108 deletions
diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index b513149e7c..df28183fdc 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -111,3 +111,17 @@ ctest_qt5_module_files.files += $$ctest_macros_file.output $$cmake_extras_mkspec
ctest_qt5_module_files.path = $$[QT_INSTALL_LIBS]/cmake/Qt5Core
INSTALLS += ctest_qt5_module_files cmake_qt5_umbrella_module_files
+
+mips_dsp:*-g++* {
+ HEADERS += $$MIPS_DSP_HEADERS
+
+ mips_dsp_corelib_assembler.commands = $$QMAKE_CXX -c
+ mips_dsp_corelib_assembler.commands += $(CXXFLAGS) $(INCPATH) -mips32r2 -mdsp ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
+ mips_dsp_corelib_assembler.dependency_type = TYPE_C
+ mips_dsp_corelib_assembler.output = ${QMAKE_VAR_OBJECTS_DIR}${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+ mips_dsp_corelib_assembler.input = MIPS_DSP_ASM
+ mips_dsp_corelib_assembler.variable_out = OBJECTS
+ mips_dsp_corelib_assembler.name = assembling[mips_dsp] ${QMAKE_FILE_IN}
+ silent:mips_dsp_corelib_assembler.commands = @echo assembling[mips_dsp] ${QMAKE_FILE_IN} && $$mips_dsp_corelib_assembler.commands
+ QMAKE_EXTRA_COMPILERS += mips_dsp_corelib_assembler
+}
diff --git a/src/corelib/global/qcompilerdetection.h b/src/corelib/global/qcompilerdetection.h
index 44077132d4..d526d40398 100644
--- a/src/corelib/global/qcompilerdetection.h
+++ b/src/corelib/global/qcompilerdetection.h
@@ -251,7 +251,7 @@
# if defined(__EDG__)
# define Q_CC_EDG
# endif
-/* Compaq have disabled EDG's _BOOL macro and use _BOOL_EXISTS instead
+/* Compaq has disabled EDG's _BOOL macro and uses _BOOL_EXISTS instead
- observed on Compaq C++ V6.3-002.
In any case versions prior to Compaq C++ V6.0-005 do not have bool. */
# if !defined(_BOOL_EXISTS)
@@ -722,13 +722,13 @@
# define Q_COMPILER_DECLTYPE
# define Q_COMPILER_RVALUE_REFS
# define Q_COMPILER_STATIC_ASSERT
-// MSVC's library has std::initilizer_list, but the compiler does not support the braces initialization
+// MSVC's library has std::initializer_list, but the compiler does not support the braces initialization
//# define Q_COMPILER_INITIALIZER_LISTS
//# define Q_COMPILER_UNIFORM_INIT
# endif
# if _MSC_VER >= 1700
/* C++11 features supported in VC11 = VC2012: */
-# undef Q_DECL_OVERRIDE /* undo 2005/2098 settings... */
+# undef Q_DECL_OVERRIDE /* undo 2005/2008 settings... */
# undef Q_DECL_FINAL /* undo 2005/2008 settings... */
# define Q_COMPILER_EXPLICIT_OVERRIDES /* ...and use std C++11 now */
# define Q_COMPILER_RANGE_FOR
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index d8c987d2e0..30db4e75cf 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -45,11 +45,11 @@
#include <stddef.h>
-#define QT_VERSION_STR "5.2.1"
+#define QT_VERSION_STR "5.2.2"
/*
QT_VERSION is (major << 16) + (minor << 8) + patch.
*/
-#define QT_VERSION 0x050201
+#define QT_VERSION 0x050202
/*
can be used like #if (QT_VERSION >= QT_VERSION_CHECK(4, 4, 0))
*/
@@ -826,9 +826,13 @@ Q_CORE_EXPORT void qFreeAligned(void *ptr);
# pragma warning(disable: 4800) /* 'type' : forcing value to bool 'true' or 'false' (performance warning) */
# pragma warning(disable: 4097) /* typedef-name 'identifier1' used as synonym for class-name 'identifier2' */
# pragma warning(disable: 4706) /* assignment within conditional expression */
-# pragma warning(disable: 4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */
+# if _MSC_VER <= 1310 // MSVC 2003
+# pragma warning(disable: 4786) /* 'identifier' : identifier was truncated to 'number' characters in the debug information */
+# endif
# pragma warning(disable: 4355) /* 'this' : used in base member initializer list */
-# pragma warning(disable: 4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */
+# if _MSC_VER < 1800 // MSVC 2013
+# pragma warning(disable: 4231) /* nonstandard extension used : 'identifier' before template explicit instantiation */
+# endif
# pragma warning(disable: 4710) /* function not inlined */
# pragma warning(disable: 4530) /* C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc */
# elif defined(Q_CC_BOR)
diff --git a/src/corelib/io/io.pri b/src/corelib/io/io.pri
index f06bf61b09..649493f8b7 100644
--- a/src/corelib/io/io.pri
+++ b/src/corelib/io/io.pri
@@ -142,6 +142,8 @@ win32 {
}
} else:blackberry {
SOURCES += io/qstandardpaths_blackberry.cpp
+ } else:android {
+ SOURCES += io/qstandardpaths_android.cpp
} else {
SOURCES += io/qstandardpaths_unix.cpp
}
diff --git a/src/corelib/io/qdir.cpp b/src/corelib/io/qdir.cpp
index 43db2ec1fe..b704126efa 100644
--- a/src/corelib/io/qdir.cpp
+++ b/src/corelib/io/qdir.cpp
@@ -716,11 +716,12 @@ QString QDir::absoluteFilePath(const QString &fileName) const
return fileName;
d->resolveAbsoluteEntry();
+ const QString absoluteDirPath = d->absoluteDirEntry.filePath();
if (fileName.isEmpty())
- return d->absoluteDirEntry.filePath();
- if (!d->absoluteDirEntry.isRoot())
- return d->absoluteDirEntry.filePath() % QLatin1Char('/') % fileName;
- return d->absoluteDirEntry.filePath() % fileName;
+ return absoluteDirPath;
+ if (!absoluteDirPath.endsWith(QLatin1Char('/')))
+ return absoluteDirPath % QLatin1Char('/') % fileName;
+ return absoluteDirPath % fileName;
}
/*!
@@ -855,7 +856,7 @@ QString QDir::fromNativeSeparators(const QString &pathName)
/*!
Changes the QDir's directory to \a dirName.
- Returns \c true if the new directory exists and is readable;
+ Returns \c true if the new directory exists;
otherwise returns \c false. Note that the logical cd() operation is
not performed if the new directory does not exist.
@@ -923,7 +924,7 @@ bool QDir::cd(const QString &dirName)
Changes directory by moving one directory up from the QDir's
current directory.
- Returns \c true if the new directory exists and is readable;
+ Returns \c true if the new directory exists;
otherwise returns \c false. Note that the logical cdUp() operation is
not performed if the new directory does not exist.
diff --git a/src/corelib/io/qstandardpaths_android.cpp b/src/corelib/io/qstandardpaths_android.cpp
new file mode 100644
index 0000000000..60b285a3d6
--- /dev/null
+++ b/src/corelib/io/qstandardpaths_android.cpp
@@ -0,0 +1,331 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtCore module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qstandardpaths.h"
+
+#ifndef QT_NO_STANDARDPATHS
+
+#include <QtCore/private/qjni_p.h>
+#include <QtCore/private/qjnihelpers_p.h>
+#include <QtCore/qmap.h>
+#include <QDir>
+
+QT_BEGIN_NAMESPACE
+
+typedef QMap<QString, QString> AndroidDirCache;
+Q_GLOBAL_STATIC(AndroidDirCache, androidDirCache)
+
+static QString testDir()
+{
+ return QStandardPaths::isTestModeEnabled() ? QLatin1String("/qttest")
+ : QLatin1String("");
+}
+
+static QJNIObjectPrivate applicationContext()
+{
+ static QJNIObjectPrivate appCtx;
+ if (appCtx.isValid())
+ return appCtx;
+
+ QJNIObjectPrivate activity = QtAndroidPrivate::activity();
+ if (!activity.isValid())
+ return appCtx;
+
+ appCtx = activity.callObjectMethod("getApplicationContext",
+ "()Landroid/content/Context;");
+ return appCtx;
+}
+
+static inline QString getAbsolutePath(const QJNIObjectPrivate &file)
+{
+ QJNIObjectPrivate path = file.callObjectMethod("getAbsolutePath",
+ "()Ljava/lang/String;");
+ if (!path.isValid())
+ return QString();
+
+ return path.toString();
+}
+
+/*
+ * The root of the external storage
+ *
+ */
+static QString getExternalStorageDirectory()
+{
+ QString &path = (*androidDirCache)[QStringLiteral("EXT_ROOT")];
+ if (!path.isEmpty())
+ return path;
+
+ QJNIObjectPrivate file = QJNIObjectPrivate::callStaticObjectMethod("android/os/Environment",
+ "getExternalStorageDirectory",
+ "()Ljava/io/File;");
+ if (!file.isValid())
+ return QString();
+
+ return (path = getAbsolutePath(file));
+}
+
+/*
+ * Locations where applications can place user files (public).
+ * E.g., /storage/Music
+ */
+static QString getExternalStoragePublicDirectory(const char *directoryField)
+{
+ QString &path = (*androidDirCache)[QLatin1String(directoryField)];
+ if (!path.isEmpty())
+ return path;
+
+ QJNIObjectPrivate dirField = QJNIObjectPrivate::getStaticObjectField("android/os/Environment",
+ directoryField,
+ "Ljava/lang/String;");
+ if (!dirField.isValid())
+ return QString();
+
+ QJNIObjectPrivate file = QJNIObjectPrivate::callStaticObjectMethod("android/os/Environment",
+ "getExternalStoragePublicDirectory",
+ "(Ljava/lang/String;)Ljava/io/File;",
+ dirField.object());
+ if (!file.isValid())
+ return QString();
+
+ return (path = getAbsolutePath(file));
+}
+
+/*
+ * Locations where applications can place persistent files it owns.
+ * E.g., /storage/org.app/Music
+ */
+static QString getExternalFilesDir(const char *directoryField = 0)
+{
+ QString &path = (*androidDirCache)[QString(QLatin1String("APPNAME_%1")).arg(QLatin1String(directoryField))];
+ if (!path.isEmpty())
+ return path;
+
+ QJNIObjectPrivate activity = QtAndroidPrivate::activity();
+ if (!activity.isValid())
+ return QString();
+
+ QJNIObjectPrivate appCtx = applicationContext();
+ if (!appCtx.isValid())
+ return QString();
+
+ QJNIObjectPrivate dirField = QJNIObjectPrivate::fromString(QLatin1String(""));
+ if (directoryField) {
+ dirField = QJNIObjectPrivate::getStaticObjectField("android/os/Environment",
+ directoryField,
+ "Ljava/lang/String;");
+ if (!dirField.isValid())
+ return QString();
+ }
+
+ QJNIObjectPrivate file = appCtx.callObjectMethod("getExternalFilesDir",
+ "(Ljava/lang/String;)Ljava/io/File;",
+ dirField.object());
+
+ if (!file.isValid())
+ return QString();
+
+ return (path = getAbsolutePath(file));
+}
+
+/*
+ * Directory where applications can store cache files it owns (public).
+ * E.g., /storage/org.app/
+ */
+static QString getExternalCacheDir()
+{
+ QString &path = (*androidDirCache)[QStringLiteral("APPNAME_CACHE")];
+ if (!path.isEmpty())
+ return path;
+
+ QJNIObjectPrivate appCtx = applicationContext();
+ if (!appCtx.isValid())
+ return QString();
+
+ QJNIObjectPrivate file = appCtx.callObjectMethod("getExternalCacheDir",
+ "()Ljava/io/File;");
+
+ if (!file.isValid())
+ return QString();
+
+ return (path = getAbsolutePath(file));
+}
+
+/*
+ * Directory where applications can store cache files it owns (private).
+ */
+static QString getCacheDir()
+{
+ QString &path = (*androidDirCache)[QStringLiteral("APPROOT_CACHE")];
+ if (!path.isEmpty())
+ return path;
+
+ QJNIObjectPrivate appCtx = applicationContext();
+ if (!appCtx.isValid())
+ return QString();
+
+ QJNIObjectPrivate file = appCtx.callObjectMethod("getCacheDir",
+ "()Ljava/io/File;");
+ if (!file.isValid())
+ return QString();
+
+ return (path = getAbsolutePath(file));
+}
+
+/*
+ * Directory where applications can store files it owns (private).
+ * (Same location as $HOME)
+ */
+static QString getFilesDir()
+{
+ QString &path = (*androidDirCache)[QStringLiteral("APPROOT_FILES")];
+ if (!path.isEmpty())
+ return path;
+
+ return (path = QDir::homePath());
+}
+
+QString QStandardPaths::writableLocation(StandardLocation type)
+{
+ switch (type) {
+ case QStandardPaths::MusicLocation:
+ return getExternalStoragePublicDirectory("DIRECTORY_MUSIC");
+ case QStandardPaths::MoviesLocation:
+ return getExternalStoragePublicDirectory("DIRECTORY_MOVIES");
+ case QStandardPaths::PicturesLocation:
+ return getExternalStoragePublicDirectory("DIRECTORY_PICTURES");
+ case QStandardPaths::DocumentsLocation:
+ if (QtAndroidPrivate::androidSdkVersion() > 18)
+ return getExternalStoragePublicDirectory("DIRECTORY_DOCUMENTS");
+ else
+ return getExternalStorageDirectory() + QLatin1String("/Documents");
+ case QStandardPaths::DownloadLocation:
+ return getExternalStoragePublicDirectory("DIRECTORY_DOWNLOADS");
+ case QStandardPaths::GenericConfigLocation:
+ case QStandardPaths::ConfigLocation:
+ return getFilesDir() + testDir() + QLatin1String("/settings");
+ case QStandardPaths::GenericDataLocation:
+ return getExternalStorageDirectory() + testDir();
+ case QStandardPaths::DataLocation:
+ return getFilesDir() + testDir();
+ case QStandardPaths::GenericCacheLocation:
+ case QStandardPaths::RuntimeLocation:
+ case QStandardPaths::TempLocation:
+ case QStandardPaths::CacheLocation:
+ return getCacheDir() + testDir();
+ case QStandardPaths::DesktopLocation:
+ case QStandardPaths::HomeLocation:
+ return getFilesDir();
+ case QStandardPaths::ApplicationsLocation:
+ case QStandardPaths::FontsLocation:
+ default:
+ break;
+ }
+
+ return QString();
+}
+
+QStringList QStandardPaths::standardLocations(StandardLocation type)
+{
+ if (type == MusicLocation) {
+ return QStringList() << writableLocation(type)
+ << getExternalFilesDir("DIRECTORY_MUSIC")
+ << getExternalStoragePublicDirectory("DIRECTORY_PODCASTS")
+ << getExternalFilesDir("DIRECTORY_PODCASTS")
+ << getExternalStoragePublicDirectory("DIRECTORY_NOTIFICATIONS")
+ << getExternalFilesDir("DIRECTORY_NOTIFICATIONS")
+ << getExternalStoragePublicDirectory("DIRECTORY_ALARMS")
+ << getExternalFilesDir("DIRECTORY_ALARMS");
+ }
+
+ if (type == MoviesLocation) {
+ return QStringList() << writableLocation(type)
+ << getExternalFilesDir("DIRECTORY_MOVIES");
+ }
+
+ if (type == PicturesLocation) {
+ return QStringList() << writableLocation(type)
+ << getExternalFilesDir("DIRECTORY_PICTURES");
+ }
+
+ if (type == DocumentsLocation) {
+ if (QtAndroidPrivate::androidSdkVersion() > 18) {
+ return QStringList() << writableLocation(type)
+ << getExternalFilesDir("DIRECTORY_DOCUMENTS");
+ } else {
+ return QStringList() << writableLocation(type)
+ << getExternalFilesDir() + QLatin1String("/Documents");
+ }
+ }
+
+ if (type == DownloadLocation) {
+ return QStringList() << writableLocation(type)
+ << getExternalFilesDir("DIRECTORY_DOWNLOADS");
+ }
+
+ if (type == DataLocation) {
+ return QStringList() << writableLocation(type)
+ << getExternalFilesDir();
+ }
+
+ if (type == CacheLocation) {
+ return QStringList() << writableLocation(type)
+ << getExternalCacheDir();
+ }
+
+ if (type == FontsLocation) {
+ QString &fontLocation = (*androidDirCache)[QStringLiteral("FONT_LOCATION")];
+ if (!fontLocation.isEmpty())
+ return QStringList(fontLocation);
+
+ const QByteArray ba = qgetenv("QT_ANDROID_FONT_LOCATION");
+ if (!ba.isEmpty())
+ return QStringList((fontLocation = QDir::cleanPath(QString::fromLocal8Bit(ba))));
+
+ return QStringList((fontLocation = QLatin1String("/system/fonts")));
+ }
+
+ return QStringList(writableLocation(type));
+}
+
+QT_END_NAMESPACE
+
+#endif // QT_NO_STANDARDPATHS
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 77aa3c4821..eac5a0b738 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3437,7 +3437,7 @@ QString QUrl::fromAce(const QByteArray &domain)
(like \c "example.com") to be written using international
characters.
- This function return an empty QByteArra if \a domain is not a valid
+ This function returns an empty QByteArray if \a domain is not a valid
hostname. Note, in particular, that IPv6 literals are not valid domain
names.
*/
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index ab257a996d..4241fe08ca 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -2334,6 +2334,31 @@ void QAbstractItemModel::doSetRoleNames(const QHash<int,QByteArray> &roleNames)
Returns the model's role names.
+ The default role names set by Qt are:
+
+ \table
+ \header
+ \li Qt Role
+ \li QML Role Name
+ \row
+ \li Qt::DisplayRole
+ \li display
+ \row
+ \li Qt::DecorationRole
+ \li decoration
+ \row
+ \li Qt::EditRole
+ \li edit
+ \row
+ \li Qt::ToolTipRole
+ \li toolTip
+ \row
+ \li Qt::StatusTipRole
+ \li statusTip
+ \row
+ \li Qt::WhatsThisRole
+ \li whatsThis
+ \endtable
*/
QHash<int,QByteArray> QAbstractItemModel::roleNames() const
{
@@ -3378,6 +3403,9 @@ Qt::ItemFlags QAbstractTableModel::flags(const QModelIndex &index) const
of the rowCount() and data() functions. Well behaved models also provide
a headerData() implementation.
+ If your model is used within QML and requires roles other than the
+ default ones provided by the roleNames() function, you must override it.
+
For editable list models, you must also provide an implementation of
setData(), implement the flags() function so that it returns a value
containing \l{Qt::ItemFlags}{Qt::ItemIsEditable}.
diff --git a/src/corelib/kernel/qjnihelpers.cpp b/src/corelib/kernel/qjnihelpers.cpp
index 9ec491f6a9..74eb6f5b27 100644
--- a/src/corelib/kernel/qjnihelpers.cpp
+++ b/src/corelib/kernel/qjnihelpers.cpp
@@ -46,6 +46,7 @@ QT_BEGIN_NAMESPACE
static JavaVM *g_javaVM = Q_NULLPTR;
static jobject g_jActivity = Q_NULLPTR;
static jobject g_jClassLoader = Q_NULLPTR;
+static jint g_androidSdkVersion = 0;
static inline bool exceptionCheck(JNIEnv *env)
{
@@ -60,6 +61,19 @@ static inline bool exceptionCheck(JNIEnv *env)
return false;
}
+static void setAndroidSdkVersion(JNIEnv *env)
+{
+ jclass androidVersionClass = env->FindClass("android/os/Build$VERSION");
+ if (exceptionCheck(env))
+ return;
+
+ jfieldID androidSDKFieldID = env->GetStaticFieldID(androidVersionClass, "SDK_INT", "I");
+ if (exceptionCheck(env))
+ return;
+
+ g_androidSdkVersion = env->GetStaticIntField(androidVersionClass, androidSDKFieldID);
+}
+
jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env)
{
jclass jQtNative = env->FindClass("org/qtproject/qt5/android/QtNative");
@@ -93,6 +107,8 @@ jint QtAndroidPrivate::initJNI(JavaVM *vm, JNIEnv *env)
if (exceptionCheck(env))
return JNI_ERR;
+ setAndroidSdkVersion(env);
+
g_jClassLoader = env->NewGlobalRef(classLoader);
env->DeleteLocalRef(classLoader);
g_jActivity = env->NewGlobalRef(activity);
@@ -118,4 +134,9 @@ jobject QtAndroidPrivate::classLoader()
return g_jClassLoader;
}
+jint QtAndroidPrivate::androidSdkVersion()
+{
+ return g_androidSdkVersion;
+}
+
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qjnihelpers_p.h b/src/corelib/kernel/qjnihelpers_p.h
index 39059db215..c92dbdde7f 100644
--- a/src/corelib/kernel/qjnihelpers_p.h
+++ b/src/corelib/kernel/qjnihelpers_p.h
@@ -64,6 +64,7 @@ namespace QtAndroidPrivate
Q_CORE_EXPORT JavaVM *javaVM();
Q_CORE_EXPORT jint initJNI(JavaVM *vm, JNIEnv *env);
jobject classLoader();
+ jint androidSdkVersion();
}
QT_END_NAMESPACE
diff --git a/src/corelib/kernel/qobject.cpp b/src/corelib/kernel/qobject.cpp
index f1351f5a07..43b88d21b5 100644
--- a/src/corelib/kernel/qobject.cpp
+++ b/src/corelib/kernel/qobject.cpp
@@ -2086,7 +2086,9 @@ void QObject::deleteLater()
const char *qFlagLocation(const char *method)
{
- QThreadData::current()->flaggedSignatures.store(method);
+ QThreadData *currentThreadData = QThreadData::current(false);
+ if (currentThreadData != 0)
+ currentThreadData->flaggedSignatures.store(method);
return method;
}
@@ -3451,8 +3453,11 @@ void QMetaObject::activate(QObject *sender, int signalOffset, int local_signal_i
{
int signal_index = signalOffset + local_signal_index;
- if (!sender->d_func()->isSignalConnected(signal_index))
+ if (!sender->d_func()->isSignalConnected(signal_index)
+ && !qt_signal_spy_callback_set.signal_begin_callback
+ && !qt_signal_spy_callback_set.signal_end_callback) {
return; // nothing connected to these signals, and no spy
+ }
if (sender->d_func()->blockSig)
return;
diff --git a/src/corelib/kernel/qobject_p.h b/src/corelib/kernel/qobject_p.h
index 011e140e3b..8cbb244451 100644
--- a/src/corelib/kernel/qobject_p.h
+++ b/src/corelib/kernel/qobject_p.h
@@ -248,7 +248,7 @@ public:
Returns \c true if the signal with index \a signal_index from object \a sender is connected.
Signals with indices above a certain range are always considered connected (see connectedSignals
- in QObjectPrivate). If a signal spy is installed, all signals are considered connected.
+ in QObjectPrivate).
\a signal_index must be the index returned by QObjectPrivate::signalIndex;
*/
@@ -257,9 +257,7 @@ inline bool QObjectPrivate::isSignalConnected(uint signal_index) const
return signal_index >= sizeof(connectedSignals) * 8
|| (connectedSignals[signal_index >> 5] & (1 << (signal_index & 0x1f))
|| (declarativeData && QAbstractDeclarativeData::isSignalConnected
- && QAbstractDeclarativeData::isSignalConnected(declarativeData, q_func(), signal_index))
- || qt_signal_spy_callback_set.signal_begin_callback
- || qt_signal_spy_callback_set.signal_end_callback);
+ && QAbstractDeclarativeData::isSignalConnected(declarativeData, q_func(), signal_index)));
}
inline QObjectPrivate::Sender *QObjectPrivate::setCurrentSender(QObject *receiver,
diff --git a/src/corelib/thread/qthread_p.h b/src/corelib/thread/qthread_p.h
index 8429e41433..fce84e881b 100644
--- a/src/corelib/thread/qthread_p.h
+++ b/src/corelib/thread/qthread_p.h
@@ -223,7 +223,7 @@ public:
QThreadData(int initialRefCount = 1);
~QThreadData();
- static QThreadData *current();
+ static QThreadData *current(bool createIfNecessary = true);
static void clearCurrentThreadData();
static QThreadData *get2(QThread *thread)
{ Q_ASSERT_X(thread != 0, "QThread", "internal error"); return thread->d_func()->data; }
diff --git a/src/corelib/thread/qthread_unix.cpp b/src/corelib/thread/qthread_unix.cpp
index 15558cb148..b838cb4b28 100644
--- a/src/corelib/thread/qthread_unix.cpp
+++ b/src/corelib/thread/qthread_unix.cpp
@@ -215,10 +215,10 @@ void QThreadData::clearCurrentThreadData()
clear_thread_data();
}
-QThreadData *QThreadData::current()
+QThreadData *QThreadData::current(bool createIfNecessary)
{
QThreadData *data = get_thread_data();
- if (!data) {
+ if (!data && createIfNecessary) {
data = new QThreadData;
QT_TRY {
set_thread_data(data);
diff --git a/src/corelib/thread/qthread_win.cpp b/src/corelib/thread/qthread_win.cpp
index 037343c996..865b1e6af5 100644
--- a/src/corelib/thread/qthread_win.cpp
+++ b/src/corelib/thread/qthread_win.cpp
@@ -101,11 +101,11 @@ void QThreadData::clearCurrentThreadData()
TlsSetValue(qt_current_thread_data_tls_index, 0);
}
-QThreadData *QThreadData::current()
+QThreadData *QThreadData::current(bool createIfNecessary)
{
qt_create_tls();
QThreadData *threadData = reinterpret_cast<QThreadData *>(TlsGetValue(qt_current_thread_data_tls_index));
- if (!threadData) {
+ if (!threadData && createIfNecessary) {
threadData = new QThreadData;
// This needs to be called prior to new AdoptedThread() to
// avoid recursion.
diff --git a/src/corelib/tools/qcommandlineparser.cpp b/src/corelib/tools/qcommandlineparser.cpp
index db4c2961f0..c860b4d155 100644
--- a/src/corelib/tools/qcommandlineparser.cpp
+++ b/src/corelib/tools/qcommandlineparser.cpp
@@ -720,7 +720,8 @@ QStringList QCommandLineParser::values(const QString &optionName) const
*/
bool QCommandLineParser::isSet(const QCommandLineOption &option) const
{
- return isSet(option.names().first());
+ // option.names() might be empty if the constructor failed
+ return !option.names().isEmpty() && isSet(option.names().first());
}
/*!
diff --git a/src/corelib/tools/qdatetime.cpp b/src/corelib/tools/qdatetime.cpp
index 5438f00c67..6177012e4b 100644
--- a/src/corelib/tools/qdatetime.cpp
+++ b/src/corelib/tools/qdatetime.cpp
@@ -1902,7 +1902,7 @@ int QTime::msecsTo(const QTime &t) const
#ifndef QT_NO_DATESTRING
-static QTime fromIsoTimeString(const QString &string, Qt::DateFormat format, bool *isMidnight24)
+static QTime fromIsoTimeString(const QStringRef &string, Qt::DateFormat format, bool *isMidnight24)
{
if (isMidnight24)
*isMidnight24 = false;
@@ -1935,9 +1935,13 @@ static QTime fromIsoTimeString(const QString &string, Qt::DateFormat format, boo
// the maximum amount of millisecond digits it will expand to once converted to
// seconds is 4. E.g. 12:34,99999 will expand to 12:34:59.9994. The milliseconds
// will then be rounded up AND clamped to 999.
- const float minuteFraction = QString::fromUtf8("0.%1").arg(string.mid(6, 5)).toFloat(&ok);
+
+ const QStringRef minuteFractionStr = string.mid(6, 5);
+ const long minuteFractionInt = minuteFractionStr.toLong(&ok);
if (!ok)
return QTime();
+ const float minuteFraction = double(minuteFractionInt) / (std::pow(double(10), minuteFractionStr.count()));
+
const float secondWithMs = minuteFraction * 60;
const float secondNoMs = std::floor(secondWithMs);
const float secondFraction = secondWithMs - secondNoMs;
@@ -1949,9 +1953,11 @@ static QTime fromIsoTimeString(const QString &string, Qt::DateFormat format, boo
if (!ok)
return QTime();
if (size > 8 && (string.at(8) == QLatin1Char(',') || string.at(8) == QLatin1Char('.'))) {
- const double secondFraction = QString::fromUtf8("0.%1").arg(string.mid(9, 4)).toDouble(&ok);
+ const QStringRef msecStr(string.mid(9, 4));
+ int msecInt = msecStr.isEmpty() ? 0 : msecStr.toInt(&ok);
if (!ok)
return QTime();
+ const double secondFraction(msecInt / (std::pow(double(10), msecStr.count())));
msec = qMin(qRound(secondFraction * 1000.0), 999);
}
}
@@ -2001,7 +2007,7 @@ QTime QTime::fromString(const QString& string, Qt::DateFormat format)
case Qt::ISODate:
case Qt::TextDate:
default:
- return fromIsoTimeString(string, format, 0);
+ return fromIsoTimeString(&string, format, 0);
}
}
@@ -4383,26 +4389,40 @@ QDateTime QDateTime::fromString(const QString& string, Qt::DateFormat format)
if (size < 10)
return QDateTime();
- QString isoString = string;
+ QStringRef isoString(&string);
Qt::TimeSpec spec = Qt::LocalTime;
- QDate date = QDate::fromString(isoString.left(10), Qt::ISODate);
+ QDate date = QDate::fromString(string.left(10), Qt::ISODate);
if (!date.isValid())
return QDateTime();
if (size == 10)
return QDateTime(date);
- isoString.remove(0, 11);
+ isoString = isoString.right(11);
int offset = 0;
// Check end of string for Time Zone definition, either Z for UTC or [+-]HH:MM for Offset
if (isoString.endsWith(QLatin1Char('Z'))) {
spec = Qt::UTC;
- isoString.chop(1);
+ isoString = isoString.left(isoString.size() - 1);
} else {
- const int signIndex = isoString.indexOf(QRegExp(QStringLiteral("[+-]")));
- if (signIndex >= 0) {
+ // the loop below is faster but functionally equal to:
+ // const int signIndex = isoString.indexOf(QRegExp(QStringLiteral("[+-]")));
+ const int sizeOfTimeZoneString = 4;
+ int signIndex = isoString.size() - sizeOfTimeZoneString - 1;
+ bool found = false;
+ {
+ const QChar plus = QLatin1Char('+');
+ const QChar minus = QLatin1Char('-');
+ do {
+ QChar character(isoString.at(signIndex));
+ found = character == plus || character == minus;
+ } while (--signIndex >= 0 && !found);
+ ++signIndex;
+ }
+
+ if (found) {
bool ok;
- offset = fromOffsetString(isoString.mid(signIndex), &ok);
+ offset = fromOffsetString(isoString.mid(signIndex).toString(), &ok);
if (!ok)
return QDateTime();
isoString = isoString.left(signIndex);
diff --git a/src/corelib/tools/qstring.cpp b/src/corelib/tools/qstring.cpp
index 3976f2cb6f..d682207314 100644
--- a/src/corelib/tools/qstring.cpp
+++ b/src/corelib/tools/qstring.cpp
@@ -188,9 +188,23 @@ static int ucstricmp(const ushort *a, const ushort *ae, const uchar *b, const uc
return 1;
}
+#if defined(__mips_dsp)
+// From qstring_mips_dsp_asm.S
+extern "C" int qt_ucstrncmp_mips_dsp_asm(const ushort *a,
+ const ushort *b,
+ unsigned len);
+#endif
+
// Unicode case-sensitive compare two same-sized strings
static int ucstrncmp(const QChar *a, const QChar *b, int l)
{
+#if defined(__mips_dsp)
+ if (l >= 8) {
+ return qt_ucstrncmp_mips_dsp_asm(reinterpret_cast<const ushort*>(a),
+ reinterpret_cast<const ushort*>(b),
+ l);
+ }
+#endif // __mips_dsp
while (l-- && *a == *b)
a++,b++;
if (l==-1)
@@ -3937,6 +3951,10 @@ static inline __m128i mergeQuestionMarks(__m128i chunk)
}
#endif
+#if defined(__mips_dsp)
+extern "C" void qt_toLatin1_mips_dsp_asm(uchar *dst, const ushort *src, int length);
+#endif
+
static QByteArray toLatin1_helper(const QChar *data, int length)
{
QByteArray ba;
@@ -3989,10 +4007,14 @@ static QByteArray toLatin1_helper(const QChar *data, int length)
length = length % 8;
}
#endif
+#if defined(__mips_dsp)
+ qt_toLatin1_mips_dsp_asm(dst, src, length);
+#else
while (length--) {
*dst++ = (*src>0xff) ? '?' : (uchar) *src;
++src;
}
+#endif
}
return ba;
}
@@ -4104,6 +4126,12 @@ QVector<uint> QString::toUcs4() const
return v;
}
+#if defined(__mips_dsp)
+// From qstring_mips_dsp_asm.S
+extern "C" void qt_fromlatin1_mips_asm_unroll4 (ushort*, const char*, uint);
+extern "C" void qt_fromlatin1_mips_asm_unroll8 (ushort*, const char*, uint);
+#endif
+
QString::Data *QString::fromLatin1_helper(const char *str, int size)
{
Data *d;
@@ -4144,8 +4172,15 @@ QString::Data *QString::fromLatin1_helper(const char *str, int size)
size = size % 16;
}
#endif
+#if defined(__mips_dsp)
+ if (size > 20)
+ qt_fromlatin1_mips_asm_unroll8(dst, str, size);
+ else
+ qt_fromlatin1_mips_asm_unroll4(dst, str, size);
+#else
while (size--)
*dst++ = (uchar)*str++;
+#endif
}
return d;
}
diff --git a/src/corelib/tools/qstring_mips_dsp_asm.S b/src/corelib/tools/qstring_mips_dsp_asm.S
new file mode 100644
index 0000000000..aee162c290
--- /dev/null
+++ b/src/corelib/tools/qstring_mips_dsp_asm.S
@@ -0,0 +1,449 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../../gui/painting/qt_mips_asm_dsp_p.h"
+
+.macro EXTRACT_HALVES_x2 src1, src2, hi_1, hi_2
+#if defined(__MIPSEL) && __MIPSEL
+ srl \hi_1, \src1, 16
+ ext \src1, \src1, 0, 16
+ srl \hi_2, \src2, 16
+ ext \src2, \src2, 0, 16
+#else
+ ext \hi_1, \src1, 0, 16
+ srl \src1, \src1, 16
+ ext \hi_2, \src2, 0, 16
+ srl \src2, \src2, 16
+#endif
+.endm
+
+
+LEAF_MIPS_DSP(qt_ucstrncmp_mips_dsp_asm)
+/*
+ * Arguments:
+ * a0 - string_a (uint16_t*)
+ * a1 - string_b (uint16_t*)
+ * a2 - length (uint32_t)
+ *
+ * Register usage:
+ * t0 - batches
+ */
+
+ move v0, zero /* result = 0 */
+ andi t0, a0, 0x3 /* t1 = string_a % 4 */
+ andi t1, a1, 0x3 /* t0 = string_b % 4 */
+ or t2, t0, t1 /* t2 = t0 | t1 */
+
+ beqz t2, 5f /* both aligned */
+ and t2, t0 ,t1
+ beqz t2, 6f /* one aligned */
+ nop
+
+ /*
+ * Both strings are unaligned: read 1 halfword from each,
+ * then fall-off to continue with the both-aligned case.
+ */
+ lhu t0, 0 (a0)
+ lhu t1, 0 (a1)
+ addiu a2, a2, -1 /* len-- */
+ sub v0, t0, t1 /* v0 = t0-t1 */
+ addiu a0, a0, 2 /* string_a++ */
+ bnez v0, 0f /* if (t0-t1): return */
+ addiu a1, a1, 2 /* string_b++ */
+ beqz a2, 0f /* if !len: return */
+ /* next instruction (srl) fills delay branch slot */
+
+5: /* Both string pointers are aligned */
+ srl t0, a2, 3 /* batches = length / 8 */
+ beqz t0, 9f /* if !batches: tail */
+ andi a2, a2, 0x7 /* length = length % 8 */
+
+ SAVE_REGS_ON_STACK 0, s0, s1, s2, s3
+
+1: lw t1, 0 (a0) /* [a0 a1] */
+ lw t3, 4 (a0) /* [a2 a3] */
+ lw t5, 8 (a0) /* [a4 a5] */
+ lw t7, 12 (a0) /* [a6 a7] */
+
+ lw t2, 0 (a1) /* [b0 b1] */
+ lw t4, 4 (a1) /* [b2 b3] */
+ lw t6, 8 (a1) /* [b4 b5] */
+ lw t8, 12 (a1) /* [b6 b7] */
+
+ /*
+ * Subtract elements one by one, if the result is zero
+ * both halves of the registers (shorts) are equal.
+ */
+ subq.ph s0, t1, t2 /* [a0-b0 a1-b1] */
+ subq.ph s1, t3, t4 /* [a2-b2 a3-b3] */
+
+ bnez s0, 1f
+ subq.ph s2, t5, t6 /* [a4-b4 a5-b5] */
+ bnez s1, 2f
+ subq.ph s3, t7, t8 /* [a6-b6 a7-b7] */
+ bnez s2, 3f
+ addiu t0, t0, -1 /* batches-- */
+ bnez s3, 4f
+ addiu a0, a0, 8*2 /* string_a += 8 */
+
+ bnez t0, 1b /* if batches: loop */
+ addiu a1, a1, 8*2 /* string_b += 8 */
+
+ RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
+
+ bnez a2, 9f /* if length: tail */
+ nop
+ jr ra
+ nop
+
+
+ 1: /* Check t1 [a0 a1] vs. t2 [b0 b1] */
+ EXTRACT_HALVES_x2 t1, t2, t3, t4 /* a0, b0, a1, b1 */
+ sub v0, t1, t2
+ RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
+ bnez v0, 0f /* if (a0-b0): return */
+ nop
+ jr ra
+ sub v0, t3, t4 /* return a1-b1 */
+
+ 2: /* Check t3 [a2 a3] vs. t4 [b2 b3] */
+ EXTRACT_HALVES_x2 t3, t4, t1, t2 /* a2, b2, a3, b3 */
+ sub v0, t3, t4
+ RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
+ bnez v0, 0f /* if (a2-b2): return */
+ nop
+ jr ra
+ sub v0, t1, t2 /* return a3-b3 */
+
+ 3: /* Check t5 [a4 a5] vs. t6 [b4 b5] */
+ EXTRACT_HALVES_x2 t5, t6, t1, t2 /* a4, b4, a5, b5 */
+ sub v0, t5, t6
+ RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
+ bnez v0, 0f /* if (a4-b4): return */
+ nop
+ jr ra
+ sub v0, t1, t2 /* return a5-b5 */
+
+ 4: /* Check t7 [a6 a7] vs. t8 [b6 b7] */
+ EXTRACT_HALVES_x2 t7, t8, t1, t2 /* a6, b6, a7, b7 */
+ sub v0, t7, t8
+ RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
+ bnez v0, 0f /* if (a6-b6): return */
+ nop
+ jr ra
+ sub v0, t1, t2
+
+
+ /* Process remaining tail items. */
+9: lhu t1, 0 (a0) /* a */
+ lhu t2, 0 (a1) /* b */
+ addiu a2, a2, -1 /* length-- */
+ sub v0, t1, t2 /* result = (a - b) */
+
+ bnez v0, 0f /* if (a - b): return */
+ addiu a0, a0, 2 /* string_a++ */
+
+ bnez a2, 9b /* if length: loop */
+ addiu a1, a1, 2 /* string_b++ */
+
+0: jr ra
+ nop
+
+
+ /* One of the inputs is unaligned, do unrolled half-word loads */
+6: srl t0, a2, 3 /* batches = length / 8 */
+ andi a2, a2, 0x7 /* length = length % 8 */
+
+1: lhu t1, 0 (a0)
+ lhu t2, 0 (a1)
+ lhu t3, 2 (a0)
+ lhu t4, 2 (a1)
+ lhu t5, 4 (a0)
+ lhu t6, 4 (a1)
+ lhu t7, 6 (a0)
+ lhu t8, 6 (a1)
+
+ sub v0, t1, t2
+ sub t1, t3, t4
+
+ bnez v0, 0f
+ sub t2, t5, t6
+ bnez t1, 2f
+ sub t3, t7, t8
+ bnez t2, 3f
+ lhu t1, 8 (a0)
+ bnez t3, 4f
+ lhu t2, 8 (a1)
+
+ lhu t3, 10 (a0)
+ lhu t4, 10 (a1)
+ lhu t5, 12 (a0)
+ lhu t6, 12 (a1)
+ lhu t7, 14 (a0)
+ lhu t8, 14 (a1)
+
+ sub v0, t1, t2
+ sub t1, t3, t4
+
+ bnez v0, 0f
+ sub t2, t5, t6
+ bnez t1, 2f
+ sub t3, t7, t8
+ bnez t2, 3f
+ addiu t0, t0, -1 /* batches-- */
+ bnez t3, 4f
+ addiu a0, a0, 8*2 /* string_a += 8 */
+
+ bnez t0, 1b
+ addiu a1, a1, 8*2 /* string_b += 8 */
+
+ bnez a2, 9b /* if length: tail */
+ nop
+
+0: jr ra
+ nop
+2: jr ra
+ move v0, t1
+3: jr ra
+ move v0, t2
+4: jr ra
+ move v0, t3
+
+END(qt_ucstrncmp_mips_dsp_asm)
+
+
+#if defined(__mips_dspr2)
+LEAF_MIPS_DSPR2(qt_fromlatin1_mips_asm_unroll8)
+#else
+LEAF_MIPS_DSP(qt_fromlatin1_mips_asm_unroll8)
+#endif
+
+ andi t0, a1, 0x3
+ beqz t0, 9f /* check that src is aligned */
+ nop
+
+1: lbu t1, 0 (a1)
+ addiu a1, a1, 1
+ addiu a2, a2, -1
+ sh t1, 0 (a0)
+ beqz a2, 0f
+ andi t0, a1, 0x3
+ bnez t0, 1b
+ addiu a0, a0, 2
+
+9: /* source pointer is aligned: do batches of 8 elements */
+ andi t0, a0, 3 /* check if dst is aligned */
+ bnez t0, 6f
+ srl t0, a2, 3 /* batches = len / 8 */
+ andi a2, a2, 0x7 /* tail = len % 8 */
+
+ beqz t0, 8f /* if !batches: tail */
+ nop
+
+1: lw t1, 0 (a1)
+ lw t2, 4 (a1)
+
+ addiu a1, a1, 8*1
+ addiu t0, t0, -1
+
+ preceu.ph.qbl t3, t1
+ preceu.ph.qbr t1, t1
+ preceu.ph.qbl t4, t2
+ preceu.ph.qbr t2, t2
+
+#if defined(__MIPSEL) && __MIPSEL
+ sw t1, 0 (a0)
+ sw t3, 4 (a0)
+ sw t2, 8 (a0)
+ sw t4, 12 (a0)
+#else
+ sw t3, 0 (a0)
+ sw t1, 4 (a0)
+ sw t4, 8 (a0)
+ sw t2, 12 (a0)
+#endif
+
+ bnez t0, 1b
+ addiu a0, a0, 8*2
+
+8: /* process tail items */
+ beqz a2, 0f
+ nop
+
+1: lbu t1, 0 (a1)
+ addiu a2, a2, -1
+ sh t1, 0 (a0)
+ addiu a1, a1, 1
+ bnez a2, 1b
+ addiu a0, a0, 2
+
+0: jr ra
+ nop
+
+6: beqz t0, 8b
+ andi a2, a2, 7
+7: lw t1, 0(a1)
+ lw t2, 4(a1)
+ addiu t0, t0, -1
+ addiu a1, a1, 8
+ andi t3, t1, 0xff
+#if defined(__mips_dspr2)
+ prepend t1, t2, 8
+#else
+ sll t4, t4, 24
+ srl t1, t1, 8
+ or t1, t1, t4
+#endif
+ srl t2, t2, 8
+ preceu.ph.qbr t4, t1
+ preceu.ph.qbl t1, t1
+ preceu.ph.qbr t5, t2
+ srl t2, t2, 16
+ sh t3, 0(a0)
+ sw t4, 2(a0)
+ sw t1, 6(a0)
+ sw t5, 10(a0)
+ sh t2, 14(a0)
+ bnez t0, 7b
+ addiu a0, a0, 16
+ bnez a2, 1b
+ nop
+
+ jr ra
+ nop
+
+END(qt_fromlatin1_mips_asm_unroll8)
+
+
+LEAF_MIPS_DSP(qt_fromlatin1_mips_asm_unroll4)
+/*
+ * Arguments:
+ * a0 - dst (uint16_t*)
+ * a1 - src (const char*)
+ * a2 - len (unsigned int)
+ */
+
+ /*
+ * QString::fromLatin1_helper() already handles the len==0
+ * case: assume that len is never zero.
+ */
+ srl t0, a2, 2
+ beqz t0, 9f
+ andi a2, a2, 0x3
+
+1: lbu t1, 0(a1)
+ lbu t2, 1(a1)
+ lbu t3, 2(a1)
+ lbu t4, 3(a1)
+ sh t1, 0(a0)
+ sh t2, 2(a0)
+ sh t3, 4(a0)
+ sh t4, 6(a0)
+ addiu t0, t0, -1
+ addiu a1, a1, 4
+ bnez t0, 1b
+ addiu a0, a0, 8
+
+8: beqz a2, 0f
+ nop
+
+9: lbu t1, 0(a1)
+ addiu a2, a2, -1
+ addiu a1, a1, 1
+ sh t1, 0(a0)
+ bnez a2, 9b
+ addiu a0, a0, 2
+
+0: jr ra
+ nop
+
+END(qt_fromlatin1_mips_asm_unroll4)
+
+
+LEAF_MIPS_DSP(qt_toLatin1_mips_dsp_asm)
+ /*
+ * a0 - dst
+ * a1 - src
+ * a2 - length
+ */
+
+ addiu t9, zero, 0x3f
+ srl t8, a2, 2
+ beqz t8, 2f
+ andi a2, a2, 3
+1:
+ lhu t0, 0(a1)
+ lhu t1, 2(a1)
+ lhu t2, 4(a1)
+ lhu t3, 6(a1)
+ srl t4, t0, 8
+ srl t5, t1, 8
+ srl t6, t2, 8
+ srl t7, t3, 8
+ movn t0, t9, t4
+ movn t1, t9, t5
+ movn t2, t9, t6
+ movn t3, t9, t7
+ addiu a1, a1, 8
+ addiu t8, t8, -1
+ sb t0, 0(a0)
+ sb t1, 1(a0)
+ sb t2, 2(a0)
+ sb t3, 3(a0)
+ bgtz t8, 1b
+ addiu a0, a0, 4
+2: beqz a2, 4f
+ nop
+3:
+ lhu t0, 0(a1)
+ addiu a1, a1, 2
+ addiu a2, a2, -1
+ srl t1, t0, 8
+ movn t0, t9, t1
+ sb t0, 0(a0)
+ bgtz a2, 3b
+ addiu a0, a0, 1
+4:
+ jr ra
+ nop
+
+END(qt_toLatin1_mips_dsp_asm)
+
diff --git a/src/corelib/tools/qvector.h b/src/corelib/tools/qvector.h
index f56511edbf..075e8e83e8 100644
--- a/src/corelib/tools/qvector.h
+++ b/src/corelib/tools/qvector.h
@@ -254,7 +254,10 @@ private:
};
#ifdef Q_CC_MSVC
-# pragma warning ( disable : 4345 ) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
+// behavior change: an object of POD type constructed with an initializer of the form ()
+// will be default-initialized
+# pragma warning ( push )
+# pragma warning ( disable : 4345 )
#endif
template <typename T>
@@ -270,7 +273,7 @@ void QVector<T>::defaultConstruct(T *from, T *to)
}
#ifdef Q_CC_MSVC
-# pragma warning ( default: 4345 )
+# pragma warning ( pop )
#endif
template <typename T>
@@ -438,11 +441,15 @@ QVector<T>::QVector(int asize, const T &t)
template <typename T>
QVector<T>::QVector(std::initializer_list<T> args)
{
- d = Data::allocate(args.size());
- // std::initializer_list<T>::iterator is guaranteed to be
- // const T* ([support.initlist]/1), so can be memcpy'ed away from by copyConstruct
- copyConstruct(args.begin(), args.end(), d->begin());
- d->size = int(args.size());
+ if (args.size() > 0) {
+ d = Data::allocate(args.size());
+ // std::initializer_list<T>::iterator is guaranteed to be
+ // const T* ([support.initlist]/1), so can be memcpy'ed away from by copyConstruct
+ copyConstruct(args.begin(), args.end(), d->begin());
+ d->size = int(args.size());
+ } else {
+ d = Data::sharedNull();
+ }
}
#endif
diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
index e4a7b02aee..cac596f0bc 100644
--- a/src/corelib/tools/tools.pri
+++ b/src/corelib/tools/tools.pri
@@ -192,3 +192,7 @@ INCLUDEPATH += ../3rdparty/md5 \
!macx-icc:!vxworks:unix:LIBS_PRIVATE += -lm
TR_EXCLUDE += ../3rdparty/*
+
+# MIPS DSP
+MIPS_DSP_ASM += tools/qstring_mips_dsp_asm.S
+MIPS_DSP_HEADERS += ../gui/painting/qt_mips_asm_dsp_p.h
diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
index a80ab4a2fe..bf4b5ddf01 100644
--- a/src/gui/image/image.pri
+++ b/src/gui/image/image.pri
@@ -78,3 +78,5 @@ NEON_SOURCES += image/qimage_neon.cpp
SSE2_SOURCES += image/qimage_sse2.cpp
SSSE3_SOURCES += image/qimage_ssse3.cpp
AVX_SOURCES += image/qimage_avx.cpp
+MIPS_DSPR2_SOURCES += image/qimage_mips_dspr2.cpp
+MIPS_DSPR2_ASM += image/qimage_mips_dspr2_asm.S
diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp
index 12ab5eaffa..70fe7b783f 100644
--- a/src/gui/image/qimage.cpp
+++ b/src/gui/image/qimage.cpp
@@ -3960,6 +3960,12 @@ void qInitImageConversions()
return;
}
#endif
+
+#ifdef QT_COMPILER_SUPPORTS_MIPS_DSPR2
+ extern bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags);
+ inplace_converter_map[QImage::Format_ARGB32][QImage::Format_ARGB32_Premultiplied] = convert_ARGB_to_ARGB_PM_inplace_mips_dspr2;
+ return;
+#endif
}
extern const uchar *qt_pow_rgb_gamma();
diff --git a/src/gui/image/qimage_mips_dspr2.cpp b/src/gui/image/qimage_mips_dspr2.cpp
new file mode 100644
index 0000000000..a1c40a16df
--- /dev/null
+++ b/src/gui/image/qimage_mips_dspr2.cpp
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "qimage.h"
+#include <private/qimage_p.h>
+
+QT_BEGIN_NAMESPACE
+
+// Defined in qimage_mips_dspr2_asm.S
+//
+extern "C" void premultiply_argb_inplace_mips_asm(void*, unsigned, unsigned, int);
+
+bool convert_ARGB_to_ARGB_PM_inplace_mips_dspr2(QImageData *data, Qt::ImageConversionFlags)
+{
+ Q_ASSERT(data->format == QImage::Format_ARGB32);
+
+ if (!data->width || !data->height)
+ return true;
+
+ Q_ASSERT((data->bytes_per_line - (data->width << 2)) >= 0);
+
+ premultiply_argb_inplace_mips_asm(data->data,
+ data->height,
+ data->width,
+ data->bytes_per_line - (data->width << 2));
+
+ data->format = QImage::Format_ARGB32_Premultiplied;
+ return true;
+}
+
+QT_END_NAMESPACE
diff --git a/src/gui/image/qimage_mips_dspr2_asm.S b/src/gui/image/qimage_mips_dspr2_asm.S
new file mode 100644
index 0000000000..1f03b72dd4
--- /dev/null
+++ b/src/gui/image/qimage_mips_dspr2_asm.S
@@ -0,0 +1,207 @@
+/****************************************************************************
+**
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the QtGui module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and Digia. For licensing terms and
+** conditions see http://qt.digia.com/licensing. For further information
+** use the contact form at http://qt.digia.com/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Digia gives you certain additional
+** rights. These rights are described in the Digia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "../painting/qt_mips_asm_dsp_p.h"
+
+LEAF_MIPS_DSPR2(premultiply_argb_inplace_mips_asm)
+
+ SAVE_REGS_ON_STACK 0, s0, s1, s2, s3
+
+3: srl v1, a2, 3 /* t1 = linelen / 8 */
+ addiu a1, a1, -1 /* numlines-- */
+ beqz v1, 1f /* if (!(linelen / 8)): tail */
+ andi v0, a2, 0x7 /* v0 = linelen % 8 */
+ pref 5, 0 (a0) /* cache-hint: store-streamed */
+
+ /* unrolled loop, handles (v1 = len / 8) batches of 8 pixels */
+2: addiu v1, v1, -1
+ pref 5, 0(a0)
+ pref 5, 32(a0)
+
+ lw t0, 0(a0)
+ lw t1, 4(a0)
+ lw t2, 8(a0)
+ lw t3, 12(a0)
+ srl t4, t0, 24 /* 00|00|00|A1 */
+ replv.ph t5, t4 /* 00|A1|00|A1 */
+ srl t6, t1, 24 /* 00|00|00|A2 */
+ replv.ph t7, t6 /* 00|A2|00|A2 */
+ muleu_s.ph.qbl t8, t0, t5 /* A1*A1|A1*R1 */
+ muleu_s.ph.qbr t0, t0, t5 /* A1*G1|A1*B1 */
+ muleu_s.ph.qbl t9, t1, t7 /* A2*A2|A2*R2 */
+ muleu_s.ph.qbr t1, t1, t7 /* A2*G2|A2*B2 */
+ srl t5, t2, 24 /* 00|00|00|A3 */
+ replv.ph s0, t5 /* 00|A3|00|A3 */
+ srl t7, t3, 24 /* 00|00|00|A4 */
+ replv.ph s1, t7 /* 00|A4|00|A4 */
+ muleu_s.ph.qbl s2, t2, s0 /* A3*A3|A3*R3 */
+ muleu_s.ph.qbr t2, t2, s0 /* A3*G3|A3*B3 */
+ muleu_s.ph.qbl s0, t3, s1 /* A4*A4|A4*R4 */
+ muleu_s.ph.qbr t3, t3, s1 /* A4*G4|A4*B4 */
+ preceu.ph.qbla s1, t8
+ preceu.ph.qbla s3, t0
+ addu.ph t8, t8, s1
+ addu.ph t0, t0, s3
+ preceu.ph.qbla s1, t9
+ preceu.ph.qbla s3, t1
+ addu.ph t9, t9, s1
+ addu.ph t1, t1, s3
+ preceu.ph.qbla s1, s2
+ preceu.ph.qbla s3, t2
+ addu.ph s2, s2, s1
+ addu.ph t2, t2, s3
+ preceu.ph.qbla s1, s0
+ preceu.ph.qbla s3, t3
+ addu.ph s0, s0, s1
+ addu.ph t3, t3, s3
+ shra_r.ph t8, t8, 8 /* xxAA1|xxRR1 */
+ shra_r.ph t0, t0, 8 /* xxBB1|xxGG1 */
+ shra_r.ph t9, t9, 8
+ shra_r.ph t1, t1, 8
+ shra_r.ph s2, s2, 8
+ shra_r.ph t2, t2, 8
+ shra_r.ph s0, s0, 8
+ shra_r.ph t3, t3, 8
+ precr.qb.ph t0, t8, t0
+ precr.qb.ph t1, t9, t1
+ precr.qb.ph t2, s2, t2
+ precr.qb.ph t3, s0, t3
+ append t4, t0, 24
+ append t6, t1, 24
+ append t5, t2, 24
+ append t7, t3, 24
+ sw t4, 0(a0)
+ sw t6, 4(a0)
+ sw t5, 8(a0)
+ sw t7, 12(a0)
+
+ lw t0, 16(a0)
+ lw t1, 20(a0)
+ lw t2, 24(a0)
+ lw t3, 28(a0)
+ srl t4, t0, 24 /* 00|00|00|A1 */
+ replv.ph t5, t4 /* 00|A1|00|A1 */
+ srl t6, t1, 24 /* 00|00|00|A2 */
+ replv.ph t7, t6 /* 00|A2|00|A2 */
+ muleu_s.ph.qbl t8, t0, t5 /* A1*A1|A1*R1 */
+ muleu_s.ph.qbr t0, t0, t5 /* A1*G1|A1*B1 */
+ muleu_s.ph.qbl t9, t1, t7 /* A2*A2|A2*R2 */
+ muleu_s.ph.qbr t1, t1, t7 /* A2*G2|A2*B2 */
+ srl t5, t2, 24 /* 00|00|00|A3 */
+ replv.ph s0, t5 /* 00|A3|00|A3 */
+ srl t7, t3, 24 /* 00|00|00|A4 */
+ replv.ph s1, t7 /* 00|A4|00|A4 */
+ muleu_s.ph.qbl s2, t2, s0 /* A3*A3|A3*R3 */
+ muleu_s.ph.qbr t2, t2, s0 /* A3*G3|A3*B3 */
+ muleu_s.ph.qbl s0, t3, s1 /* A4*A4|A4*R4 */
+ muleu_s.ph.qbr t3, t3, s1 /* A4*G4|A4*B4 */
+ preceu.ph.qbla s1, t8
+ preceu.ph.qbla s3, t0
+ addu.ph t8, t8, s1
+ addu.ph t0, t0, s3
+ preceu.ph.qbla s1, t9
+ preceu.ph.qbla s3, t1
+ addu.ph t9, t9, s1
+ addu.ph t1, t1, s3
+ preceu.ph.qbla s1, s2
+ preceu.ph.qbla s3, t2
+ addu.ph s2, s2, s1
+ addu.ph t2, t2, s3
+ preceu.ph.qbla s1, s0
+ preceu.ph.qbla s3, t3
+ addu.ph s0, s0, s1
+ addu.ph t3, t3, s3
+ shra_r.ph t8, t8, 8 /* xxAA1|xxRR1 */
+ shra_r.ph t0, t0, 8 /* xxBB1|xxGG1 */
+ shra_r.ph t9, t9, 8
+ shra_r.ph t1, t1, 8
+ shra_r.ph s2, s2, 8
+ shra_r.ph t2, t2, 8
+ shra_r.ph s0, s0, 8
+ shra_r.ph t3, t3, 8
+ precr.qb.ph t0, t8, t0
+ precr.qb.ph t1, t9, t1
+ precr.qb.ph t2, s2, t2
+ precr.qb.ph t3, s0, t3
+ append t4, t0, 24
+ append t6, t1, 24
+ append t5, t2, 24
+ append t7, t3, 24
+ sw t4, 16(a0)
+ sw t6, 20(a0)
+ sw t5, 24(a0)
+ sw t7, 28(a0)
+ bgtz v1, 2b /* if (t1): unrolled loop */
+ addiu a0, a0, 32 /* data += 8 */
+
+ beqz v0, 4f /* if (!v0): skip tail loop */
+ nop
+
+ /* tail loop, handles (len < 8), one pixel at a time */
+1: lw t1, 0 (a0)
+ addiu v0, v0, -1 /* len-- */
+ srl t2, t1, 24 /* t2 = alpha */
+ replv.ph t3, t2
+ muleu_s.ph.qbl t4, t1, t3
+ muleu_s.ph.qbr t1, t1, t3
+ preceu.ph.qbla t3, t4
+ preceu.ph.qbla t5, t1
+ addu.ph t4, t4, t3
+ addu.ph t1, t1, t5
+ shra_r.ph t4, t4, 8
+ shra_r.ph t1, t1, 8
+ precr.qb.ph t1, t4, t1
+ append t2, t1, 24
+ sw t2, 0(a0)
+ bgtz v0, 1b
+ addiu a0, a0, 4 /* src++ */
+
+4: bnez a1, 3b /* if (numlines): loop */
+ addu a0, a0, a3 /* src += srclineskip */
+
+0: /* return */
+ RESTORE_REGS_FROM_STACK 0, s0, s1, s2, s3
+
+ jr ra
+ nop
+
+END(premultiply_argb_inplace_mips_asm)
+
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 0711a37edd..10f099a5ca 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -59,6 +59,7 @@
#include <QtCore/qmutex.h>
#include <QtCore/private/qthread_p.h>
#include <QtCore/qdir.h>
+#include <QtCore/qnumeric.h>
#include <QtDebug>
#ifndef QT_NO_ACCESSIBILITY
#include "qaccessible.h"
@@ -110,7 +111,7 @@ Q_GUI_EXPORT bool qt_is_gui_used = true;
Qt::MouseButtons QGuiApplicationPrivate::mouse_buttons = Qt::NoButton;
Qt::KeyboardModifiers QGuiApplicationPrivate::modifier_buttons = Qt::NoModifier;
-QPointF QGuiApplicationPrivate::lastCursorPosition(0.0, 0.0);
+QPointF QGuiApplicationPrivate::lastCursorPosition(qInf(), qInf());
bool QGuiApplicationPrivate::tabletState = false;
QWindow *QGuiApplicationPrivate::tabletPressTarget = 0;
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index a037545dc2..d3e5b645c4 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -374,12 +374,6 @@ inline void QT_FASTCALL storePixel<QPixelLayout::BPP24>(uchar *dest, int index,
reinterpret_cast<quint24 *>(dest)[index] = quint24(pixel);
}
-template <>
-inline void QT_FASTCALL storePixel<QPixelLayout::BPP32>(uchar *dest, int index, uint pixel)
-{
- reinterpret_cast<uint *>(dest)[index] = pixel;
-}
-
template <QPixelLayout::BPP width>
inline void QT_FASTCALL storePixels(uchar *dest, const uint *src, int index, int count)
{
@@ -1790,7 +1784,7 @@ static const uint *QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Oper
return buffer;
}
-static const SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
+static SourceFetchProc sourceFetch[NBlendTypes][QImage::NImageFormats] = {
// Untransformed
{
0, // Invalid
@@ -6402,6 +6396,21 @@ void qInitDrawhelperAsm()
destStoreProc[QImage::Format_ARGB32] = qt_destStoreARGB32_mips_dsp;
+ sourceFetch[BlendUntransformed][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
+ sourceFetch[BlendTiled][QImage::Format_RGB888] = qt_fetchUntransformed_888_mips_dsp;
+
+ sourceFetch[BlendUntransformed][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
+ sourceFetch[BlendTiled][QImage::Format_RGB444] = qt_fetchUntransformed_444_mips_dsp;
+
+ sourceFetch[BlendUntransformed][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
+ sourceFetch[BlendTiled][QImage::Format_ARGB8565_Premultiplied] = qt_fetchUntransformed_argb8565_premultiplied_mips_dsp;
+
+#if defined(QT_COMPILER_SUPPORTS_MIPS_DSPR2)
+ qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dspr2;
+#else
+ qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_mips_dsp;
+#endif // QT_COMPILER_SUPPORTS_MIPS_DSPR2
+
#endif // QT_COMPILER_SUPPORTS_MIPS_DSP
if (functionForModeSolidAsm) {
const int destinationMode = QPainter::CompositionMode_Destination;
diff --git a/src/gui/painting/qdrawhelper_mips_dsp.cpp b/src/gui/painting/qdrawhelper_mips_dsp.cpp
index a9b551c226..2202b78ce8 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp.cpp
+++ b/src/gui/painting/qdrawhelper_mips_dsp.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 MIPS Technologies, www.mips.com, author Damir Tatalovic <dtatalovic@mips.com>
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -110,6 +110,78 @@ void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl,
}
}
+#if defined QT_COMPILER_SUPPORTS_MIPS_DSPR2
+void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ if (w < 256) {
+ const quint16 *src = (const quint16*) srcPixels;
+ quint16 *dst = (quint16*) destPixels;
+ for (int y = 0; y < h; ++y) {
+ qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(dst, src, w);
+ dst = (quint16*) (((uchar*) dst) + dbpl);
+ src = (quint16*) (((uchar*) src) + sbpl);
+ }
+ }
+ else {
+ int length = w << 1;
+ while (h--) {
+ memcpy(destPixels, srcPixels, length);
+ destPixels += dbpl;
+ srcPixels += sbpl;
+ }
+ }
+ }
+ else if (const_alpha != 0) {
+ const quint16 *src = (const quint16*) srcPixels;
+ quint16 *dst = (quint16*) destPixels;
+ for (int y = 0; y < h; ++y) {
+ qt_blend_rgb16_on_rgb16_mips_dspr2_asm(dst, src, w, const_alpha);
+ dst = (quint16*) (((uchar*) dst) + dbpl);
+ src = (quint16*) (((uchar*) src) + sbpl);
+ }
+ }
+}
+#else
+void qt_blend_rgb16_on_rgb16_mips_dsp(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ if (const_alpha == 256) {
+ if (w < 256) {
+ const quint16 *src = (const quint16*) srcPixels;
+ quint16 *dst = (quint16*) destPixels;
+ for (int y = 0; y < h; ++y) {
+ qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(dst, src, w);
+ dst = (quint16*) (((uchar*) dst) + dbpl);
+ src = (quint16*) (((uchar*) src) + sbpl);
+ }
+ }
+ else {
+ int length = w << 1;
+ while (h--) {
+ memcpy(destPixels, srcPixels, length);
+ destPixels += dbpl;
+ srcPixels += sbpl;
+ }
+ }
+ }
+ else if (const_alpha != 0) {
+ const quint16 *src = (const quint16*) srcPixels;
+ quint16 *dst = (quint16*) destPixels;
+ for (int y = 0; y < h; ++y) {
+ qt_blend_rgb16_on_rgb16_mips_dsp_asm(dst, src, w, const_alpha);
+ dst = (quint16*) (((uchar*) dst) + dbpl);
+ src = (quint16*) (((uchar*) src) + sbpl);
+ }
+ }
+}
+#endif
+
void comp_func_Source_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha)
{
if (const_alpha == 255) {
@@ -422,5 +494,28 @@ void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int l
comp_func_SourceOut_dsp_asm_x2(dest, src, length, const_alpha);
}
+const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
+ int y, int x, int length)
+{
+ uchar *line = (uchar *)data->texture.scanLine(y) + x;
+ fetchUntransformed_888_asm_mips_dsp(buffer, line, length);
+ return buffer;
+}
+
+const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
+ int y, int x, int length)
+{
+ uchar *line = (uchar *)data->texture.scanLine(y) + x;
+ fetchUntransformed_444_asm_mips_dsp(buffer, line, length);
+ return buffer;
+}
+
+const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer, const Operator *, const QSpanData *data,
+ int y, int x, int length)
+{
+ uchar *line = (uchar *)data->texture.scanLine(y) + x;
+ fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(buffer, line, length);
+ return buffer;
+}
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_mips_dsp_asm.S b/src/gui/painting/qdrawhelper_mips_dsp_asm.S
index 64fc635970..26b48f9d62 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp_asm.S
+++ b/src/gui/painting/qdrawhelper_mips_dsp_asm.S
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 MIPS Technologies, www.mips.com, author Damir Tatalovic <dtatalovic@mips.com>
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -1601,3 +1601,479 @@ LEAF_MIPS_DSP(qt_blend_argb32_on_argb32_const_alpha_256_mips_dsp_asm)
nop
END(qt_blend_argb32_on_argb32_const_alpha_256_mips_dsp_asm)
+
+
+#if defined(__MIPSEL) && __MIPSEL
+# define PACK(r, s, t) packrl.ph r, s, t
+# define SWHI(r, o, b) swl r, o + 1 (b)
+# define SWLO(r, o, b) swr r, o + 0 (b)
+# define LDHI(r, o, b) lwl r, o + 1 (b)
+# define LDLO(r, o, b) lwr r, o + 2 (b)
+#else
+# define PACK(r, s, t) packrl.ph r, t, s
+# define SWHI(r, o, b) swr r, o + 1 (b)
+# define SWLO(r, o, b) swl r, o + 0 (b)
+# define LDHI(r, o, b) lwr r, o + 1 (b)
+# define LDLO(r, o, b) lwl r, o + 2 (b)
+#endif
+
+LEAF_MIPS_DSP(qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm)
+/*
+ * a0 - dst (*r5g6b5)
+ * a1 - src (const *r5g6b5)
+ * a2 - len (unsigned int)
+ *
+ * Register usage:
+ * t0-3 - Scratch registers
+ * t4 - Number of iterations to do in unrolled loops
+ * t5-7 - Auxiliary scratch registers.
+ *
+ * Check if base addresses of src/dst are aligned, cases:
+ * a) Both aligned.
+ * b) Both unaligned:
+ * 1. Copy a halfword
+ * 2. Use aligned case.
+ * c) dst aligned, src unaligned:
+ * 1. Read a word from dst, halfword from src.
+ * 2. Continue reading words from both.
+ * d) dst unaligned, src aligned:
+ * 1. Read a word from src, halfword from dst.
+ * 2. Continue reading words from both.
+ */
+
+ beqz a2, 0f /* if (a2:len == 0): return */
+ andi t0, a0, 0x3 /* t0 = a0:dst % 4 */
+ andi t1, a1, 0x3 /* t1 = a1:dst % 4 */
+ or t2, t0, t1 /* t1 = t0 | t1 */
+
+ beqz t2, 4f /* both aligned */
+ nop
+ beqz t0, 3f /* dst aligned, src unaligned */
+ nop
+ beqz t1, 2f /* src aligned, dst unaligned */
+ nop
+
+ /*
+ * Both src/dst are unaligned: read 1 halfword from each,
+ * the fall-off to continue with word-aligned copy.
+ */
+ lhu t0, 0 (a1) /* t0 <- ((uint16_t*) src)[0] */
+ addiu a1, a1, 2 /* src++ */
+ addiu a2, a2,-1 /* len-- */
+ sh t0, 0 (a0) /* t1 -> ((uint16_t*) dst)[0] */
+ addiu a0, a0, 2 /* dst++ */
+
+ /*
+ * Both src/dst pointers are word-aligned, process eight
+ * items at a time in an unrolled loop.
+ */
+4: beqz a2, 0f /* if (len == 0): return */
+ srl t4, a2, 3 /* t4 = len / 8 */
+
+ beqz t4, 5f /* if (t4 == 0): tail */
+ andi a2, a2, 0x07 /* len = len % 8 */
+
+1: lw t0, 0 (a1)
+ lw t1, 4 (a1)
+ lw t2, 8 (a1)
+ lw t3, 12 (a1)
+
+ addiu t4, t4, -1 /* t4-- */
+ addiu a1, a1, 16 /* src += 8 */
+
+ sw t0, 0 (a0)
+ sw t1, 4 (a0)
+ sw t2, 8 (a0)
+ sw t3, 12 (a0)
+
+ bnez t4, 1b
+ addiu a0, a0, 16 /* dst += 8 */
+
+ b 5f
+ nop
+
+
+ /*
+ * dst pointer is unaligned
+ */
+2: beqz a2, 0f /* if (len == 0): return */
+ srl t4, a2, 3 /* t4 = len / 8 */
+ beqz t4, 5f /* if (t4 == 0): tail */
+ andi a2, a2, 0x07 /* len = len % 8 */
+
+1: lw t0, 0 (a1)
+ lw t1, 4 (a1)
+ lw t2, 8 (a1)
+ lw t3, 12 (a1)
+
+ addiu t4, t4, -1 /* t4-- */
+ addiu a1, a1, 16 /* src += 8 */
+
+ SWLO (t0, 0, a0)
+ PACK (t5, t1, t0)
+ PACK (t6, t2, t1)
+ PACK (t7, t3, t2)
+ SWHI (t3, 14, a0)
+ sw t5, 2 (a0)
+ sw t6, 6 (a0)
+ sw t7, 10 (a0)
+
+ bnez t4, 1b
+ addiu a0, a0, 16 /* dst += 8 */
+
+ b 5f
+ nop
+
+ /*
+ * src pointer is unaligned
+ */
+3: beqz a2, 0f /* if (len == 0): return */
+ srl t4, a2, 3 /* t4 = len / 8 */
+ beqz t4, 5f /* if (t4 == 0): tail */
+ andi a2, a2, 0x07 /* len = len % 8 */
+
+1: LDHI (t0, 0, a1)
+ lw t1, 2 (a1)
+ lw t2, 6 (a1)
+ lw t3, 10 (a1)
+ LDLO (t5, 12, a1)
+
+ addiu t4, t4, -1 /* t4-- */
+ addiu a1, a1, 16 /* src += 8 */
+
+ PACK (t0, t1, t0)
+ PACK (t6, t2, t1)
+ PACK (t7, t3, t2)
+ sw t0, 0 (a0)
+ PACK (t0, t5, t3)
+ sw t6, 4 (a0)
+ sw t7, 8 (a0)
+ sw t0, 12 (a0)
+
+ bnez t4, 1b
+ addiu a0, a0, 16 /* dst += 8 */
+
+
+5: /* Process remaining items (a2:len < 4), one at a time */
+ beqz a2, 0f
+ nop
+
+1: lhu t0, 0 (a1) /* t0 <- ((uint16_t*) src)[0] */
+ addiu a2, a2,-1 /* len-- */
+ addiu a1, a1, 2 /* src++ */
+ sh t0, 0 (a0) /* to -> ((uint16_t*) dst)[0] */
+ bnez a2, 1b /* if (len != 0): loop */
+ addiu a0, a0, 2 /* dst++ */
+
+0: jr ra
+ nop
+
+END(qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm)
+
+
+#undef LDHI
+#undef LDLO
+#undef PACK
+#undef SWHI
+#undef SWLO
+
+
+LEAF_MIPS_DSP(qt_blend_rgb16_on_rgb16_mips_dsp_asm)
+/*
+ * a0 - dst (*r5g6b5)
+ * a1 - src (const *r5g6b5)
+ * a2 - len (unsigned int) - batch length
+ * a3 - alpha (int)
+ */
+
+ beqz a2, 2f
+ li t9, 255
+ sll t8, a3, 8
+ subu a3, t8, a3
+ srl a3, a3, 8
+ subu t9, t9, a3
+ addiu a3, a3, 1
+ srl t4, a3, 2
+ addiu t9, t9, 1
+ srl t5, t9, 2
+1:
+ lhu t0, 0(a1)
+ lhu t1, 0(a0)
+ addiu a2, a2, -1
+ andi t2, t0, 0x07e0
+ andi t0, t0, 0xf81f
+ mul t2, t2, a3
+ mul t0, t0, t4
+ andi t3, t1, 0x07e0
+ andi t1, t1, 0xf81f
+ mul t3, t3, t9
+ mul t1, t1, t5
+ addiu a1, a1, 2
+ srl t2, t2, 8
+ srl t0, t0, 6
+ andi t2, t2, 0x07e0
+ andi t0, t0, 0xf81f
+ or t0, t0, t2
+ srl t3, t3, 8
+ srl t1, t1, 6
+ andi t3, t3, 0x07e0
+ andi t1, t1, 0xf81f
+ or t1, t1, t3
+ addu t0, t0, t1
+ sh t0, 0(a0)
+ bgtz a2, 1b
+ addiu a0, a0, 2
+2:
+ jr ra
+ nop
+
+END(qt_blend_rgb16_on_rgb16_mips_dsp_asm)
+
+
+LEAF_MIPS_DSP(fetchUntransformed_888_asm_mips_dsp)
+/*
+ * a0 - dst address (address of 32-bit aRGB value)
+ * a1 - src address
+ * a2 - length
+ */
+
+ beqz a2, 4f
+ lui t8, 0xff00
+ andi t0, a2, 0x1
+ beqz t0, 1f
+ nop
+/* case for one pixel */
+ lbu t1, 0(a1)
+ lbu v1, 2(a1)
+ lbu t0, 1(a1)
+ addiu a1, a1, 3
+ addiu a2, a2, -1
+ sll t1, t1, 0x10
+ or v1, v1, t8
+ sll t0, t0, 0x8
+ or v1, v1, t1
+ or v1, v1, t0
+ sw v1, 0(a0)
+ addiu a0, a0, 4
+
+ beqz a2, 4f /* only one pixel is present (length = 1) */
+ nop
+1:
+ andi t0, a1, 0x1
+ beqz t0, 3f
+ nop
+2:
+ lbu t0, 0(a1) /* t0 = | 0 | 0 | 0 | R1 | */
+ lhu t1, 1(a1) /* t1 = | 0 | 0 | B1 | G1 | */
+ addiu a1, a1, 3
+ lhu t2, 0(a1) /* t2 = | 0 | 0 | G2 | R2 | */
+ lbu t3, 2(a1) /* t3 = | 0 | 0 | 0 | B2 | */
+
+ sll t0, t0, 16
+ or t0, t0, t8 /* t0 = | ff | R1 | 0 | 0 | */
+ shll.ph t4, t1, 8 /* t4 = | 0 | 0 | G1 | 0 | */
+ srl t5, t1, 8
+ or t4, t4, t5 /* t4 = | 0 | 0 | G1 | B1 | */
+ or t0, t0, t4 /* t0 = | ff | R1 | G1 | B1 | */
+
+ shll.ph t4, t2, 8 /* t4 = | 0 | 0 | R2 | 0 | */
+ srl t5, t2, 8 /* t5 = | 0 | 0 | 0 | G2 | */
+ or t4, t4, t5
+ sll t4, t4, 8 /* t4 = | 0 | R2 | G2 | 0 | */
+ or t5, t3, t8
+ or t2, t4, t5 /* t2 = | ff | R2 | G2 | B2 | */
+
+ sw t0, 0(a0)
+ addiu a1, a1, 3
+ sw t2, 4(a0)
+ addiu a2, a2, -2
+ bnez a2, 2b
+ addiu a0, a0, 8
+ b 4f
+ nop
+3:
+ lhu t0, 0(a1) /* t0 = | 0 | 0 | G1 | R1 | */
+ lbu t1, 2(a1) /* t1 = | 0 | 0 | 0 | B1 | */
+ addiu a1, a1, 3
+ lbu t2, 0(a1) /* t2 = | 0 | 0 | 0 | R2 | */
+ lhu t3, 1(a1) /* t3 = | 0 | 0 | B2 | G2 | */
+
+ srl t4, t0, 8 /* t4 = | 0 | 0 | 0 | G1 | */
+ shll.ph t5, t0, 8 /* t5 = | 0 | 0 | R1 | 0 | */
+ or t0, t4, t5
+ sll t6, t0, 8 /* t6 = | 0 | R1 | G1 | 0 | */
+ or t4, t1, t8 /* t4 = | ff | 0 | 0 | B1 | */
+ or t0, t6, t4
+
+ sll t2, t2, 16
+ srl t4, t3, 8
+ shll.ph t5, t3, 8
+ or t3, t4, t5
+ or t2, t2, t3
+ or t2, t2, t8
+
+ sw t0, 0(a0)
+ addiu a1, a1, 3
+ sw t2, 4(a0)
+ addiu a2, a2, -2
+ bnez a2, 3b
+ addiu a0, a0, 8
+4:
+ jr ra
+ nop
+
+END(fetchUntransformed_888_asm_mips_dsp)
+
+
+LEAF_MIPS_DSP(fetchUntransformed_444_asm_mips_dsp)
+/*
+ * a0 - dst address (address of 32-bit aRGB value)
+ * a1 - src address
+ * a2 - length
+ */
+
+ lui t8, 0xff00
+ li t4, 0x1
+
+ beqz a2, 5f
+ move v0, a0 /* just return the address of buffer
+ * for storing returning values */
+ andi t0, a2, 0x1
+ beqz t0, 2f /* there is more then one pixel
+ * (check src memory alignment (word)) */
+ nop
+1:
+ lhu v0, 0(a1)
+ addiu a1, a1, 2
+ addiu a2, a2, -1
+ andi t0, v0, 0xf00
+ andi v1, v0, 0xf
+ andi v0, v0, 0xf0
+ sra t3, t0, 0x4
+ sra t1, v0, 0x4
+ sra t0, t0, 0x8
+ sll t2, v1, 0x4
+ or t0, t0, t3
+ or v0, t1, v0
+ lui t1, 0xff00
+ or v1, t2, v1
+ sll t0, t0, 0x10
+ or v1, v1, t1
+ sll v0, v0, 0x8
+ or v1, v1, t0
+ or v0, v1, v0
+ sw v0, 0(a0)
+ addiu a0, a0, 4
+ beqz a2, 5f /* no more pixels for processing */
+ nop
+ beq a2, t4, 4f /* only one more pixel remained */
+ nop
+/* check if src memory address is word aligned */
+2:
+ andi t0, a1, 0x3
+ beqz t0, 3f /* memory is word aligned */
+ andi a3, a2, 0x1 /* set the a3 register as the comparation
+ * for ending the unrolled loop
+ * (1 if odd, 0 if even) */
+ b 1b /* not word aligned,
+ * go another turn with
+ * just one pixel processing */
+ nop
+3:
+ lw t0, 0(a1)
+ addiu a2, a2, -2
+ preceu.ph.qbr t1, t0 /* t1 = | 0 | aR1 | 0 | G1B1 | */
+ preceu.ph.qbl t2, t0 /* t1 = | 0 | aR2 | 0 | G2B2 | */
+ shll.qb t3, t1, 4 /* t3 = | 0 | R1 0 | 0 | B1 0 | */
+ srl t4, t3, 4
+ or t0, t3, t4 /* t0 = | 0 | R1R1 | 0 | B1B1 | */
+ andi t3, t1, 0xf0
+ sll t3, t3, 8
+ srl t4, t3, 4
+ or t1, t3, t4
+ or t0, t0, t1 /* t0 = | 0 | R1R1 | G1G1 | B1B1 | */
+ or t0, t0, t8 /* t0 = | ff | R1R1 | G1G1 | B1B1 | */
+
+ shll.qb t3, t2, 4 /* t3 = | 0 | R1 0 | 0 | B1 0 | */
+ srl t4, t3, 4
+ or t7, t3, t4 /* t0 = | 0 | R1R1 | 0 | B1B1 | */
+ andi t3, t2, 0xf0
+ sll t3, t3, 8
+ srl t4, t3, 4
+ or t1, t3, t4
+ or t2, t7, t1 /* t0 = | 0 | R1R1 | G1G1 | B1B1 | */
+ or t2, t2, t8 /* t0 = | ff | R1R1 | G1G1 | B1B1 | */
+
+ sw t0, 0(a0)
+ addiu a1, a1, 4
+ sw t2, 4(a0)
+ bne a2, a3, 3b
+ addiu a0, a0, 8
+ beqz a2, 5f /* no more pixels for processing */
+ nop
+4:
+/* one more pixel remained (after loop unrolling process finished) */
+ lhu v0, 0(a1)
+ addiu a1, a1, 2
+ addiu a2, a2, -1
+ andi t0, v0, 0xf00
+ andi v1, v0, 0xf
+ andi v0, v0, 0xf0
+ sra t3, t0, 0x4
+ sra t1, v0, 0x4
+ sra t0, t0, 0x8
+ sll t2, v1, 0x4
+ or t0, t0, t3
+ or v0, t1, v0
+ lui t1, 0xff00
+ or v1, t2, v1
+ sll t0, t0, 0x10
+ or v1, v1, t1
+ sll v0, v0, 0x8
+ or v1, v1, t0
+ or v0, v1, v0
+ sw v0, 0(a0)
+ addiu a0, a0, 4
+5:
+ jr ra
+ nop
+
+END(fetchUntransformed_444_asm_mips_dsp)
+
+
+LEAF_MIPS_DSP(fetchUntransformed_argb8565_premultiplied_asm_mips_dsp)
+/*
+ * a0 - dst address
+ * a1 - src address
+ * a2 - length
+ */
+
+ beqz a2, 2f
+ nop
+
+1:
+ ulh t1, 0(a1)
+ lbu t2, 2(a1)
+ addiu a2, a2, -1
+ wsbh t1, t1
+ sll t0, t1, 8 /* t0 = 00000000rrrrrggggggbbbbb00000000 */
+ ins t0, t1, 3, 16 /* t0 = 00000000rrrrrrrrrrggggggbbbbb000 */
+ ins t0, t1, 5, 11 /* t0 = 00000000rrrrrrrrggggggbbbbbbb000 */
+ srl t4, t1, 9 /* t4 = 0000000000000000000000000rrrrrgg */
+ replv.qb t3, t2
+ ins t0, t4, 8, 2 /* t0 = 00000000rrrrrrrrggggggggbbbbb000 */
+ ins t0, t1, 3, 5 /* t0 = 00000000rrrrrrrrggggggggbbbbb000 */
+ srl t4, t1, 2 /* t4 = 000000000000000000rrrrrggggggbbb */
+ ins t0, t4, 0, 3 /* t0 = 00000000rrrrrrrrggggggggbbbbbbbb */
+ ins t0, t2, 24, 8 /* t0 =aaaaaaaarrrrrrrrggggggggbbbbbbbb */
+ cmpu.lt.qb t3, t0
+ pick.qb t0, t3, t0
+ addiu a1, a1, 3
+ sw t0, 0(a0)
+ bgtz a2, 1b
+ addiu a0, a0, 4
+2:
+ jr ra
+ nop
+
+END(fetchUntransformed_argb8565_premultiplied_asm_mips_dsp)
diff --git a/src/gui/painting/qdrawhelper_mips_dsp_p.h b/src/gui/painting/qdrawhelper_mips_dsp_p.h
index 2df7d4920a..3dceb7793d 100644
--- a/src/gui/painting/qdrawhelper_mips_dsp_p.h
+++ b/src/gui/painting/qdrawhelper_mips_dsp_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 MIPS Technologies, www.mips.com, author Damir Tatalovic <dtatalovic@mips.com>
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -101,19 +101,34 @@ extern "C" void qt_blend_argb32_on_argb32_mips_dsp_asm_x2(uint *dest, const uint
extern "C" void qt_blend_argb32_on_argb32_const_alpha_256_mips_dsp_asm(uint *dest, const uint *src, int length);
+extern "C" void qt_blend_rgb16_on_rgb16_const_alpha_256_mips_dsp_asm(quint16 *dest, const quint16 *src, int length);
+
+extern "C" void qt_blend_rgb16_on_rgb16_mips_dsp_asm(quint16 *dest, const quint16 *src, int length, uint const_alpha);
+
extern "C" uint * destfetchARGB32_asm_mips_dsp(uint *buffer, const uint *data, int length);
extern "C" uint * qt_destStoreARGB32_asm_mips_dsp(uint *buffer, const uint *data, int length);
+extern "C" uint * fetchUntransformed_888_asm_mips_dsp(uint *buffer, const uchar *line, int length);
+
+extern "C" uint * fetchUntransformed_444_asm_mips_dsp(uint *buffer, const uchar *line, int length);
+
+extern "C" uint * fetchUntransformed_argb8565_premultiplied_asm_mips_dsp(uint *buffer, const uchar *line, int length);
+
void qt_blend_argb32_on_argb32_mips_dsp(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha);
void qt_blend_rgb32_on_rgb32_mips_dsp(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+void qt_blend_rgb16_on_rgb16_mips_dsp(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
void comp_func_Source_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
@@ -164,6 +179,21 @@ void QT_FASTCALL comp_func_SourceOut_mips_dsp(uint *dest, const uint *src, int l
void QT_FASTCALL comp_func_XOR_mips_dsp(uint *dest, const uint *src, int length, uint const_alpha);
+const uint * QT_FASTCALL qt_fetchUntransformed_888_mips_dsp (uint *buffer,
+ const Operator *,
+ const QSpanData *data,
+ int y, int x, int length);
+
+const uint * QT_FASTCALL qt_fetchUntransformed_444_mips_dsp (uint *buffer,
+ const Operator *,
+ const QSpanData *data,
+ int y, int x, int length);
+
+const uint * QT_FASTCALL qt_fetchUntransformed_argb8565_premultiplied_mips_dsp (uint *buffer,
+ const Operator *,
+ const QSpanData *data,
+ int y, int x, int length);
+
#endif // QT_COMPILER_SUPPORTS_MIPS_DSP
@@ -171,6 +201,13 @@ void QT_FASTCALL comp_func_XOR_mips_dsp(uint *dest, const uint *src, int length,
extern "C" void qConvertRgb16To32_asm_mips_dspr2(quint32 *dest, const quint16 *src, int length);
+extern "C" void qt_blend_rgb16_on_rgb16_mips_dspr2_asm(quint16 *dest, const quint16 *src, int length, uint const_alpha);
+
+void qt_blend_rgb16_on_rgb16_mips_dspr2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
#endif // QT_COMPILER_SUPPORTS_MIPS_DSPR2
QT_END_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_mips_dspr2_asm.S b/src/gui/painting/qdrawhelper_mips_dspr2_asm.S
index ec220732be..c7a603eebe 100644
--- a/src/gui/painting/qdrawhelper_mips_dspr2_asm.S
+++ b/src/gui/painting/qdrawhelper_mips_dspr2_asm.S
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 MIPS Technologies, www.mips.com, author Damir Tatalovic <dtatalovic@mips.com>
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -122,3 +122,551 @@ LEAF_MIPS_DSPR2(qConvertRgb16To32_asm_mips_dspr2)
nop
END(qConvertRgb16To32_asm_mips_dspr2)
+
+
+#if defined(__MIPSEL) && __MIPSEL
+# define PACK(r, s, t) packrl.ph r, s, t
+# define LDHI(r, o, b) lwl r, o + 1 (b)
+# define LDLO(r, o, b) lwr r, o + 2 (b)
+#else
+# define PACK(r, s, t) packrl.ph r, t, s
+# define LDHI(r, o, b) lwr r, o + 1 (b)
+# define LDLO(r, o, b) lwl r, o + 2 (b)
+#endif
+
+
+LEAF_MIPS_DSPR2(qt_blend_rgb16_on_rgb16_mips_dspr2_asm)
+/*
++ * a0 - dst (*r5g6b5)
+ * a1 - src (const *r5g6b5)
+ * a2 - len (unsigned int) - batch length
+ * a3 - alpha (int)
+ *
+ * Register usage:
+ * t0-3 - Scratch registers
+ * t4 - Number of iterations to do in unrolled loops
+ * t5 - Inverse alpha
+ * t6 - Alpha >> 2
+ * t7 - Inverse alpha >> 2
+ * t8 - magic1 (0x07e007e0)
+ * t9 - magic2 (0xf81ff81f)
+ *
+ * NOTE:
+ * Cannot use DSP instructions for the multiplication of two
+ * 16-bit values: overflow would be always rounded or saturated.
+ */
+
+ beqz a2, 0f
+ andi t0, a0, 0x3
+ andi t1, a1, 0x3
+ /* Adjust alpha value, and calculate inverse alpha value */
+ li t5, 255
+ or t2, t0, t1 /* t0 = (dst & 0x3) | (src & 0x3) */
+ sll t8, a3, 8
+ subu a3, t8, a3
+ li t8, 0x07e007e0 /* magic1 */
+ srl a3, a3, 8 /* alpha >>= 8 */
+ li t9, 0xf81ff81f /* magic2 */
+ subu t5, t5, a3 /* ialpha = 255 - alpha */
+ addiu a3, a3, 1 /* alpha++ */
+ addiu t5, t5, 1 /* ialpha++ */
+ srl t6, a3, 2 /* ashift = alpha >> 2 */
+
+ beqz t2, 4f /* both aligned */
+ srl t7, t5, 2 /* iashift = ialpha >> 2 */
+
+ beqz t1, 2f /* src aligned, dst unaligned */
+ nop
+
+ beqz t0, 3f /* dst aligned, src unaligned */
+ nop
+
+ /*
+ * Both src/dst are unaligned: read 1 halfword from each, then
+ * fall-off to continue with word-aligned operation.
+ */
+ lhu t1, 0 (a1)
+ lhu t0, 0 (a0)
+ addiu a2, a2, -1 /* len-- */
+ andi t2, t1, 0x07e0
+ andi t1, t1, 0xf81f
+ mul t2, t2, a3
+ mul t1, t1, t6
+ andi t3, t0, 0x07e0
+ andi t0, t0, 0xf81f
+ mul t3, t3, t5
+ mul t0, t0, t7
+ addiu a1, a1, 2 /* src++ */
+ srl t2, t2, 8
+ srl t1, t1, 6
+ andi t2, t2, 0x07e0
+ andi t1, t1, 0xf81f
+ or t1, t1, t2
+ srl t3, t3, 8
+ srl t0, t0, 6
+ andi t3, t3, 0x07e0
+ andi t0, t0, 0xf81f
+ or t0, t0, t3
+ addu t0, t0, t1 /* src * alpha + dst * ialpha */
+ sh t0, 0 (a0)
+ addiu a0, a0, 2 /* dst++ */
+
+ /*
+ * Both src/dst pointers are word-aligned, process eight
+ * items at a time in an unrolled loop.
+ */
+4: beqz a2, 0f
+ srl t4, a2, 3 /* t4 = len / 8 */
+ beqz t4, 5f
+ andi a2, a2, 0x7 /* len = len % 8 */
+ SAVE_REGS_ON_STACK 12, s0, s1, s2, s3, s4, v0, v1
+
+1: lw t1, 0 (a1) /* [s0, s1] */
+ lw v1, 4 (a1) /* [s2, s3] */
+ lw s1, 8 (a1) /* [s4, s5] */
+ lw s3, 12 (a1) /* [s6, s7] */
+
+ lw t0, 0 (a0) /* [d0, d1] */
+ lw v0, 4 (a0) /* [d2, d3] */
+ lw s0, 8 (a0) /* [d4, d5] */
+ lw s2, 12 (a0) /* [d6, d7] */
+
+ pref 4, 16 (a1)
+ pref 5, 16 (a0)
+
+ and t2, t1, t8
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, a3
+ mul t2, t2, a3
+ and t1, t1, t9
+ ext s4, t1, 0, 16
+ mul s4, s4, t6
+ srl t1, t1, 16
+ mul t1, t1, t6
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, v1, t8
+ srl t1, t1, 6
+ append t1, s4, 16
+ and t1, t1, t9
+ or t1, t1, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, a3
+ mul t3, t3, a3
+ and v1, v1, t9
+ ext s4, v1, 0, 16
+ mul s4, s4, t6
+ srl v1, v1, 16
+ mul v1, v1, t6
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ and t2, s1, t8
+ srl v1, v1, 6
+ append v1, s4, 16
+ and v1, v1, t9
+ or v1, v1, t3
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, a3
+ mul t2, t2, a3
+ and s1, s1, t9
+ ext s4, s1, 0, 16
+ mul s4, s4, t6
+ srl s1, s1, 16
+ mul s1, s1, t6
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, s3, t8
+ srl s1, s1, 6
+ append s1, s4, 16
+ and s1, s1, t9
+ or s1, s1, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, a3
+ mul t3, t3, a3
+ and s3, s3, t9
+ ext s4, s3, 0, 16
+ mul s4, s4, t6
+ srl s3, s3, 16
+ mul s3, s3, t6
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ and t2, t0, t8
+ srl s3, s3, 6
+ append s3, s4, 16
+ and s3, s3, t9
+ or s3, s3, t3
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, t5
+ mul t2, t2, t5
+ and t0, t0, t9
+ ext s4, t0, 0, 16
+ mul s4, s4, t7
+ srl t0, t0, 16
+ mul t0, t0, t7
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, v0, t8
+ srl t0, t0, 6
+ append t0, s4, 16
+ and t0, t0, t9
+ or t0, t0, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, t5
+ mul t3, t3, t5
+ and v0, v0, t9
+ ext s4, v0, 0, 16
+ mul s4, s4, t7
+ srl v0, v0, 16
+ mul v0, v0, t7
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ and t2, s0, t8
+ srl v0, v0, 6
+ append v0, s4, 16
+ and v0, v0, t9
+ or v0, v0, t3
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, t5
+ mul t2, t2, t5
+ and s0, s0, t9
+ ext s4, s0, 0, 16
+ mul s4, s4, t7
+ srl s0, s0, 16
+ mul s0, s0, t7
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, s2, t8
+ srl s0, s0, 6
+ append s0, s4, 16
+ and s0, s0, t9
+ or s0, s0, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, t5
+ mul t3, t3, t5
+ and s2, s2, t9
+ ext s4, s2, 0, 16
+ mul s4, s4, t7
+ srl s2, s2, 16
+ mul s2, s2, t7
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ addu.ph t0, t0, t1
+ srl s2, s2, 6
+ append s2, s4, 16
+ and s2, s2, t9
+ or s2, s2, t3
+ addu.ph v0, v0, v1 /* v0 = [S2 + D2, S3 + D3] */
+ addu.ph s0, s0, s1 /* s0 = [S4 + D4, S5 + D5] */
+ addu.ph s2, s2, s3 /* s2 = [S6 + D6, S7 + D7] */
+
+ sw t0, 0 (a0) /* [SS0, SS1] */
+ sw v0, 4 (a0) /* [SS2, SS3] */
+ sw s0, 8 (a0) /* [SS4, SS5] */
+ sw s2, 12 (a0) /* [SS6, SS7] */
+
+ addiu t4, t4, -1 /* t4-- */
+ addiu a1, a1, 16 /* src += 8 */
+
+ bnez t4, 1b
+ addiu a0, a0, 16 /* dst += 8 */
+
+ RESTORE_REGS_FROM_STACK 12, s0, s1, s2, s3, s4, v0, v1
+ b 5f
+ nop
+
+
+ /* dst unaligned: do one item and fall down to the src unaligned case */
+2: lhu t1, 0 (a1)
+ lhu t0, 0 (a0)
+ addiu a2, a2, -1 /* len-- */
+ andi t2, t1, 0x07e0
+ andi t1, t1, 0xf81f
+ mul t2, t2, a3
+ mul t1, t1, t6
+ andi t3, t0, 0x07e0
+ andi t0, t0, 0xf81f
+ mul t3, t3, t5
+ mul t0, t0, t7
+ addiu a1, a1, 2 /* src++ */
+ srl t2, t2, 8
+ srl t1, t1, 6
+ andi t2, t2, 0x07e0
+ andi t1, t1, 0xf81f
+ or t1, t1, t2
+ srl t3, t3, 8
+ srl t0, t0, 6
+ andi t3, t3, 0x07e0
+ andi t0, t0, 0xf81f
+ or t0, t0, t3
+ addu t0, t0, t1 /* src * alpha + dst * ialpha */
+ sh t0, 0 (a0)
+ addiu a0, a0, 2 /* dst++ */
+
+ /* src unaligned */
+3: beqz a2, 0f
+ srl t4, a2, 3 /* t4 = len / 8 */
+ beqz t4, 5f
+ andi a2, a2, 0x7 /* len = len % 8 */
+ SAVE_REGS_ON_STACK 12, s0, s1, s2, s3, s4, v0, v1
+
+1: lw t0, 0 (a0) /* [d0, d1] */
+ lw v0, 4 (a0) /* [d2, d3] */
+ lw s0, 8 (a0) /* [d4, d5] */
+ lw s2, 12 (a0) /* [d6, d7] */
+
+ LDHI (t1, 0, a1) /* [s0, __] */
+ lw v1, 2 (a1) /* [s1, s2] */
+ lw s1, 6 (a1) /* [s3, s4] */
+ lw s3, 10 (a1) /* [s5, s6] */
+ LDLO (s4, 12, a1) /* [__, s7] */
+
+ pref 4, 14 (a1)
+ pref 5, 16 (a0)
+
+ PACK (t1, v1, t1) /* [s0, s1] */
+ PACK (v1, s1, v1) /* [s2, s3] */
+ PACK (s1, s3, s1) /* [s4, s5] */
+ PACK (s3, s4, s3) /* [s6, s7] */
+
+ and t2, t1, t8
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, a3
+ mul t2, t2, a3
+ and t1, t1, t9
+ ext s4, t1, 0, 16
+ mul s4, s4, t6
+ srl t1, t1, 16
+ mul t1, t1, t6
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, v1, t8
+ srl t1, t1, 6
+ append t1, s4, 16
+ and t1, t1, t9
+ or t1, t1, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, a3
+ mul t3, t3, a3
+ and v1, v1, t9
+ ext s4, v1, 0, 16
+ mul s4, s4, t6
+ srl v1, v1, 16
+ mul v1, v1, t6
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ and t2, s1, t8
+ srl v1, v1, 6
+ append v1, s4, 16
+ and v1, v1, t9
+ or v1, v1, t3
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, a3
+ mul t2, t2, a3
+ and s1, s1, t9
+ ext s4, s1, 0, 16
+ mul s4, s4, t6
+ srl s1, s1, 16
+ mul s1, s1, t6
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, s3, t8
+ srl s1, s1, 6
+ append s1, s4, 16
+ and s1, s1, t9
+ or s1, s1, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, a3
+ mul t3, t3, a3
+ and s3, s3, t9
+ ext s4, s3, 0, 16
+ mul s4, s4, t6
+ srl s3, s3, 16
+ mul s3, s3, t6
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ and t2, t0, t8
+ srl s3, s3, 6
+ append s3, s4, 16
+ and s3, s3, t9
+ or s3, s3, t3
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, t5
+ mul t2, t2, t5
+ and t0, t0, t9
+ ext s4, t0, 0, 16
+ mul s4, s4, t7
+ srl t0, t0, 16
+ mul t0, t0, t7
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, v0, t8
+ srl t0, t0, 6
+ append t0, s4, 16
+ and t0, t0, t9
+ or t0, t0, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, t5
+ mul t3, t3, t5
+ and v0, v0, t9
+ ext s4, v0, 0, 16
+ mul s4, s4, t7
+ srl v0, v0, 16
+ mul v0, v0, t7
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ and t2, s0, t8
+ srl v0, v0, 6
+ append v0, s4, 16
+ and v0, v0, t9
+ or v0, v0, t3
+ ext t3, t2, 0, 16
+ srl t2, t2, 16
+ mul t3, t3, t5
+ mul t2, t2, t5
+ and s0, s0, t9
+ ext s4, s0, 0, 16
+ mul s4, s4, t7
+ srl s0, s0, 16
+ mul s0, s0, t7
+ srl t3, t3, 8
+ srl t2, t2, 8
+ append t2, t3, 16
+ and t2, t2, t8
+ srl s4, s4, 6
+ and t3, s2, t8
+ srl s0, s0, 6
+ append s0, s4, 16
+ and s0, s0, t9
+ or s0, s0, t2
+ ext t2, t3, 0, 16
+ srl t3, t3, 16
+ mul t2, t2, t5
+ mul t3, t3, t5
+ and s2, s2, t9
+ ext s4, s2, 0, 16
+ mul s4, s4, t7
+ srl s2, s2, 16
+ mul s2, s2, t7
+ srl t2, t2, 8
+ srl t3, t3, 8
+ append t3, t2, 16
+ and t3, t3, t8
+ srl s4, s4, 6
+ addu.ph t0, t0, t1
+ srl s2, s2, 6
+ append s2, s4, 16
+ and s2, s2, t9
+ or s2, s2, t3
+ addu.ph v0, v0, v1 /* v0 = [S2 + D2, S3 + D3] */
+ addu.ph s0, s0, s1 /* s0 = [S4 + D4, S5 + D5] */
+ addu.ph s2, s2, s3 /* s2 = [S6 + D6, S7 + D7] */
+
+ sw t0, 0 (a0) /* [SS0, SS1] */
+ sw v0, 4 (a0) /* [SS2, SS3] */
+ sw s0, 8 (a0) /* [SS4, SS5] */
+ sw s2, 12 (a0) /* [SS6, SS7] */
+
+ addiu t4, t4, -1 /* t4-- */
+ addiu a1, a1, 16 /* src += 8 */
+
+ bnez t4, 1b
+ addiu a0, a0, 16 /* dst += 8 */
+
+ RESTORE_REGS_FROM_STACK 12, s0, s1, s2, s3, s4, v0, v1
+
+5: /* Process remaining items (len < 8), one at a time */
+ beqz a2, 0f
+ nop
+
+1: lhu t1, 0 (a1)
+ lhu t0, 0 (a0)
+ addiu a1, a1, 2 /* src++ */
+ andi t2, t1, 0x07e0
+ andi t1, t1, 0xf81f
+ mul t2, t2, a3
+ mul t1, t1, t6
+ andi t3, t0, 0x07e0
+ andi t0, t0, 0xf81f
+ mul t3, t3, t5
+ mul t0, t0, t7
+ addiu a2, a2, -1 /* len-- */
+ srl t2, t2, 8
+ srl t1, t1, 6
+ andi t2, t2, 0x07e0
+ andi t1, t1, 0xf81f
+ or t1, t1, t2
+ srl t3, t3, 8
+ srl t0, t0, 6
+ andi t3, t3, 0x07e0
+ andi t0, t0, 0xf81f
+ or t0, t0, t3
+
+ addu t0, t0, t1 /* src*alpha + dst*ialpha */
+ sh t0, 0 (a0)
+ bnez a2, 1b
+ addiu a0, a0, 2 /* dst++ */
+
+0: jr ra
+ nop
+
+END(qt_blend_rgb16_on_rgb16_mips_dspr2_asm)
+
+#undef PACK
+#undef LDHI
+#undef LDLO
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index 424ed554a2..41a2e39fc9 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -62,6 +62,7 @@
#include "qglyphrun.h"
#include <qpa/qplatformtheme.h>
+#include <qpa/qplatformintegration.h>
#include <private/qfontengine_p.h>
#include <private/qpaintengine_p.h>
@@ -155,7 +156,9 @@ static bool qt_painter_thread_test(int devType, const char *what)
// can be drawn onto these devices safely from any thread
break;
default:
- if (QThread::currentThread() != qApp->thread()) {
+ if (QThread::currentThread() != qApp->thread()
+ && (devType!=QInternal::Pixmap || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps))
+ && (devType!=QInternal::OpenGL || !QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedOpenGL))) {
qWarning("QPainter: It is not safe to use %s outside the GUI thread", what);
return false;
}
diff --git a/src/gui/painting/qt_mips_asm_dsp_p.h b/src/gui/painting/qt_mips_asm_dsp_p.h
index 1b78eaf52c..54fcfab206 100644
--- a/src/gui/painting/qt_mips_asm_dsp_p.h
+++ b/src/gui/painting/qt_mips_asm_dsp_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2012 MIPS Technologies, www.mips.com, author Damir Tatalovic <dtatalovic@mips.com>
+** Copyright (C) 2013 Imagination Technologies Limited, www.imgtec.com
** Contact: http://www.qt-project.org/legal
**
** This file is part of the QtGui module of the Qt Toolkit.
@@ -261,4 +261,168 @@ LEAF_MIPS32R2(symbol) \
or \out_1, \scratch1, \scratch3
.endm
+/*
+ * Checks if stack offset is big enough for storing/restoring regs_num
+ * number of register to/from stack. Stack offset must be greater than
+ * or equal to the number of bytes needed for storing registers (regs_num*4).
+ * Since MIPS ABI allows usage of first 16 bytes of stack frame (this is
+ * preserved for input arguments of the functions, already stored in a0-a3),
+ * stack size can be further optimized by utilizing this space.
+ */
+.macro CHECK_STACK_OFFSET regs_num, stack_offset
+.if \stack_offset < \regs_num * 4 - 16
+.error "Stack offset too small."
+.endif
+.endm
+
+/*
+ * Saves set of registers on stack. Maximum number of registers that
+ * can be saved on stack is limitted to 14 (a0-a3, v0-v1 and s0-s7).
+ * Stack offset is number of bytes that are added to stack pointer (sp)
+ * before registers are pushed in order to provide enough space on stack
+ * (offset must be multiple of 4, and must be big enough, as described by
+ * CHECK_STACK_OFFSET macro). This macro is intended to be used in
+ * combination with RESTORE_REGS_FROM_STACK macro. Example:
+ * SAVE_REGS_ON_STACK 4, v0, v1, s0, s1
+ * RESTORE_REGS_FROM_STACK 4, v0, v1, s0, s1
+ */
+.macro SAVE_REGS_ON_STACK stack_offset = 0, r1, \
+ r2 = 0, r3 = 0, r4 = 0, \
+ r5 = 0, r6 = 0, r7 = 0, \
+ r8 = 0, r9 = 0, r10 = 0, \
+ r11 = 0, r12 = 0, r13 = 0, \
+ r14 = 0
+ .if (\stack_offset < 0) || (\stack_offset - (\stack_offset / 4) * 4)
+ .error "Stack offset must be positive and multiple of 4."
+ .endif
+ .if \stack_offset != 0
+ addiu sp, sp, -\stack_offset
+ .endif
+ sw \r1, 0(sp)
+ .if \r2 != 0
+ sw \r2, 4(sp)
+ .endif
+ .if \r3 != 0
+ sw \r3, 8(sp)
+ .endif
+ .if \r4 != 0
+ sw \r4, 12(sp)
+ .endif
+ .if \r5 != 0
+ CHECK_STACK_OFFSET 5, \stack_offset
+ sw \r5, 16(sp)
+ .endif
+ .if \r6 != 0
+ CHECK_STACK_OFFSET 6, \stack_offset
+ sw \r6, 20(sp)
+ .endif
+ .if \r7 != 0
+ CHECK_STACK_OFFSET 7, \stack_offset
+ sw \r7, 24(sp)
+ .endif
+ .if \r8 != 0
+ CHECK_STACK_OFFSET 8, \stack_offset
+ sw \r8, 28(sp)
+ .endif
+ .if \r9 != 0
+ CHECK_STACK_OFFSET 9, \stack_offset
+ sw \r9, 32(sp)
+ .endif
+ .if \r10 != 0
+ CHECK_STACK_OFFSET 10, \stack_offset
+ sw \r10, 36(sp)
+ .endif
+ .if \r11 != 0
+ CHECK_STACK_OFFSET 11, \stack_offset
+ sw \r11, 40(sp)
+ .endif
+ .if \r12 != 0
+ CHECK_STACK_OFFSET 12, \stack_offset
+ sw \r12, 44(sp)
+ .endif
+ .if \r13 != 0
+ CHECK_STACK_OFFSET 13, \stack_offset
+ sw \r13, 48(sp)
+ .endif
+ .if \r14 != 0
+ CHECK_STACK_OFFSET 14, \stack_offset
+ sw \r14, 52(sp)
+ .endif
+.endm
+
+/*
+ * Restores set of registers from stack. Maximum number of registers that
+ * can be restored from stack is limitted to 14 (a0-a3, v0-v1 and s0-s7).
+ * Stack offset is number of bytes that are added to stack pointer (sp)
+ * after registers are restored (offset must be multiple of 4, and must
+ * be big enough, as described by CHECK_STACK_OFFSET macro). This macro is
+ * intended to be used in combination with RESTORE_REGS_FROM_STACK macro.
+ * Example:
+ * SAVE_REGS_ON_STACK 4, v0, v1, s0, s1
+ * RESTORE_REGS_FROM_STACK 4, v0, v1, s0, s1
+ */
+.macro RESTORE_REGS_FROM_STACK stack_offset = 0, r1, \
+ r2 = 0, r3 = 0, r4 = 0, \
+ r5 = 0, r6 = 0, r7 = 0, \
+ r8 = 0, r9 = 0, r10 = 0, \
+ r11 = 0, r12 = 0, r13 = 0, \
+ r14 = 0
+ .if (\stack_offset < 0) || (\stack_offset - (\stack_offset/4)*4)
+ .error "Stack offset must be pozitive and multiple of 4."
+ .endif
+ lw \r1, 0(sp)
+ .if \r2 != 0
+ lw \r2, 4(sp)
+ .endif
+ .if \r3 != 0
+ lw \r3, 8(sp)
+ .endif
+ .if \r4 != 0
+ lw \r4, 12(sp)
+ .endif
+ .if \r5 != 0
+ CHECK_STACK_OFFSET 5, \stack_offset
+ lw \r5, 16(sp)
+ .endif
+ .if \r6 != 0
+ CHECK_STACK_OFFSET 6, \stack_offset
+ lw \r6, 20(sp)
+ .endif
+ .if \r7 != 0
+ CHECK_STACK_OFFSET 7, \stack_offset
+ lw \r7, 24(sp)
+ .endif
+ .if \r8 != 0
+ CHECK_STACK_OFFSET 8, \stack_offset
+ lw \r8, 28(sp)
+ .endif
+ .if \r9 != 0
+ CHECK_STACK_OFFSET 9, \stack_offset
+ lw \r9, 32(sp)
+ .endif
+ .if \r10 != 0
+ CHECK_STACK_OFFSET 10, \stack_offset
+ lw \r10, 36(sp)
+ .endif
+ .if \r11 != 0
+ CHECK_STACK_OFFSET 11, \stack_offset
+ lw \r11, 40(sp)
+ .endif
+ .if \r12 != 0
+ CHECK_STACK_OFFSET 12, \stack_offset
+ lw \r12, 44(sp)
+ .endif
+ .if \r13 != 0
+ CHECK_STACK_OFFSET 13, \stack_offset
+ lw \r13, 48(sp)
+ .endif
+ .if \r14 != 0
+ CHECK_STACK_OFFSET 14, \stack_offset
+ lw \r14, 52(sp)
+ .endif
+ .if \stack_offset != 0
+ addiu sp, sp, \stack_offset
+ .endif
+.endm
+
#endif // QT_MIPS_ASM_DSP_H
diff --git a/src/network/socket/qabstractsocket.cpp b/src/network/socket/qabstractsocket.cpp
index 47fec38283..e0e13205fd 100644
--- a/src/network/socket/qabstractsocket.cpp
+++ b/src/network/socket/qabstractsocket.cpp
@@ -578,8 +578,7 @@ QAbstractSocketPrivate::~QAbstractSocketPrivate()
/*! \internal
- Resets the socket layer, clears the read and write buffers and
- deletes any socket notifiers.
+ Resets the socket layer and deletes any socket notifiers.
*/
void QAbstractSocketPrivate::resetSocketLayer()
{
@@ -1821,6 +1820,7 @@ qintptr QAbstractSocket::socketDescriptor() const
as a valid socket descriptor; otherwise returns \c false.
The socket is opened in the mode specified by \a openMode, and
enters the socket state specified by \a socketState.
+ Read and write buffers are cleared, discarding any pending data.
\b{Note:} It is not possible to initialize two abstract sockets
with the same native socket descriptor.
@@ -1833,6 +1833,8 @@ bool QAbstractSocket::setSocketDescriptor(qintptr socketDescriptor, SocketState
Q_D(QAbstractSocket);
d->resetSocketLayer();
+ d->writeBuffer.clear();
+ d->buffer.clear();
d->socketEngine = QAbstractSocketEngine::createSocketEngine(socketDescriptor, this);
if (!d->socketEngine) {
d->socketError = UnsupportedSocketOperationError;
@@ -2281,6 +2283,7 @@ void QAbstractSocket::abort()
#if defined (QABSTRACTSOCKET_DEBUG)
qDebug("QAbstractSocket::abort()");
#endif
+ d->writeBuffer.clear();
if (d->state == UnconnectedState)
return;
#ifndef QT_NO_SSL
@@ -2295,7 +2298,6 @@ void QAbstractSocket::abort()
d->connectTimer = 0;
}
- d->writeBuffer.clear();
d->abortCalled = true;
close();
}
diff --git a/src/network/ssl/qsslcontext.cpp b/src/network/ssl/qsslcontext.cpp
index 037ee8c672..adf42fb79a 100644
--- a/src/network/ssl/qsslcontext.cpp
+++ b/src/network/ssl/qsslcontext.cpp
@@ -189,9 +189,6 @@ init_context:
q_SSL_CTX_load_verify_locations(sslContext->ctx, 0, unixDirs.at(a).constData());
}
- // Register a custom callback to get all verification errors.
- X509_STORE_set_verify_cb_func(sslContext->ctx->cert_store, q_X509Callback);
-
if (!sslContext->sslConfiguration.localCertificate().isNull()) {
// Require a private key as well.
if (sslContext->sslConfiguration.privateKey().isNull()) {
diff --git a/src/plugins/platforms/cocoa/qcocoatheme.mm b/src/plugins/platforms/cocoa/qcocoatheme.mm
index 1484ae2ba3..d863861288 100644
--- a/src/plugins/platforms/cocoa/qcocoatheme.mm
+++ b/src/plugins/platforms/cocoa/qcocoatheme.mm
@@ -258,13 +258,17 @@ QPixmap QCocoaTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &siz
NSImage *iconImage = [[NSWorkspace sharedWorkspace] iconForFile:QCFString::toNSString(fileInfo.canonicalFilePath())];
if (!iconImage)
return QPixmap();
-
- NSRect iconRect = NSMakeRect(0, 0, size.width(), size.height());
- NSGraphicsContext *gc = [NSGraphicsContext currentContext];
- CGImageRef cgImage = [iconImage CGImageForProposedRect:&iconRect
- context:([gc graphicsPort] ? gc : nil)
- hints:nil];
- QPixmap pixmap = QPixmap::fromImage(qt_mac_toQImage(cgImage));
+ NSSize pixmapSize = NSMakeSize(size.width(), size.height());
+ QPixmap pixmap(pixmapSize.width, pixmapSize.height);
+ pixmap.fill(Qt::transparent);
+ [iconImage setSize:pixmapSize];
+ NSRect iconRect = NSMakeRect(0, 0, pixmapSize.width, pixmapSize.height);
+ CGContextRef ctx = qt_mac_cg_context(&pixmap);
+ NSGraphicsContext *gc = [NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:YES];
+ [NSGraphicsContext saveGraphicsState];
+ [NSGraphicsContext setCurrentContext:gc];
+ [iconImage drawInRect:iconRect fromRect:iconRect operation:NSCompositeSourceOver fraction:1.0 respectFlipped:YES hints:nil];
+ [NSGraphicsContext restoreGraphicsState];
return pixmap;
}
@@ -280,8 +284,12 @@ QVariant QCocoaTheme::themeHint(ThemeHint hint) const
case TabAllWidgets:
return QVariant(bool([[NSApplication sharedApplication] isFullKeyboardAccessEnabled]));
case IconPixmapSizes: {
+ qreal devicePixelRatio = qGuiApp->devicePixelRatio();
QList<int> sizes;
- sizes << 16 << 32 << 64 << 128;
+ sizes << 16 * devicePixelRatio
+ << 32 * devicePixelRatio
+ << 64 * devicePixelRatio
+ << 128 * devicePixelRatio;
return QVariant::fromValue(sizes);
}
case QPlatformTheme::PasswordMaskCharacter:
diff --git a/src/plugins/platforms/eglfs/qeglfshooks.h b/src/plugins/platforms/eglfs/qeglfshooks.h
index 1cd1380994..0251e27f96 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks.h
+++ b/src/plugins/platforms/eglfs/qeglfshooks.h
@@ -77,7 +77,8 @@ public:
virtual bool filterConfig(EGLDisplay display, EGLConfig config) const;
virtual void waitForVSync() const;
- virtual const char *fbDeviceName() const;
+ virtual QByteArray fbDeviceName() const;
+ virtual int framebufferIndex() const;
static QEglFSHooks *hooks()
{
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
index 4dc0783d43..4368f37e50 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -41,6 +41,7 @@
#include "qeglfshooks.h"
#include "qeglfscursor.h"
+#include <QtCore/QRegularExpression>
#include <fcntl.h>
#include <unistd.h>
@@ -56,17 +57,34 @@ QT_BEGIN_NAMESPACE
// this is a global static to keep the QEglFSHooks interface as clean as possible
static int framebuffer = -1;
-const char *QEglFSHooks::fbDeviceName() const
+QByteArray QEglFSHooks::fbDeviceName() const
{
- return "/dev/fb0";
+ QByteArray fbDev = qgetenv("QT_QPA_EGLFS_FB");
+ if (fbDev.isEmpty())
+ fbDev = QByteArrayLiteral("/dev/fb0");
+
+ return fbDev;
+}
+
+int QEglFSHooks::framebufferIndex() const
+{
+ int fbIndex = 0;
+ QRegularExpression fbIndexRx(QLatin1String("fb(\\d+)"));
+ QRegularExpressionMatch match = fbIndexRx.match(fbDeviceName());
+ if (match.hasMatch())
+ fbIndex = match.captured(1).toInt();
+
+ return fbIndex;
}
void QEglFSHooks::platformInit()
{
- framebuffer = qt_safe_open(fbDeviceName(), O_RDONLY);
+ QByteArray fbDev = fbDeviceName();
+
+ framebuffer = qt_safe_open(fbDev, O_RDONLY);
if (framebuffer == -1)
- qWarning("EGLFS: Failed to open %s", fbDeviceName());
+ qWarning("EGLFS: Failed to open %s", qPrintable(fbDev));
}
void QEglFSHooks::platformDestroy()
diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
index 497d0975af..8ebfd018d0 100644
--- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
+++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp
@@ -572,6 +572,8 @@ bool QWindowsDialogHelperBase<BaseClass>::show(Qt::WindowFlags,
QWindow *parent)
{
const bool modal = (windowModality != Qt::NonModal);
+ if (!parent)
+ parent = QGuiApplication::focusWindow(); // Need a parent window, else the application loses activation when closed.
if (parent) {
m_ownerWindow = QWindowsWindow::handleOf(parent);
} else {
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 530ebc38b7..1fc1be53c7 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -306,6 +306,8 @@ QList<QPlatformScreen *> QWindowsScreen::virtualSiblings() const
void QWindowsScreen::handleChanges(const QWindowsScreenData &newData)
{
+ m_data.physicalSizeMM = newData.physicalSizeMM;
+
if (m_data.geometry != newData.geometry) {
m_data.geometry = newData.geometry;
QWindowSystemInterface::handleScreenGeometryChange(screen(),
diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp
index f46bed77d6..3d8f91649a 100644
--- a/src/plugins/platforms/xcb/qxcbwindow.cpp
+++ b/src/plugins/platforms/xcb/qxcbwindow.cpp
@@ -1550,7 +1550,7 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even
handleXEmbedMessage(event);
} else if (event->type == atom(QXcbAtom::_NET_ACTIVE_WINDOW)) {
connection()->setFocusWindow(this);
- QWindowSystemInterface::handleWindowActivated(window());
+ QWindowSystemInterface::handleWindowActivated(window(), Qt::ActiveWindowFocusReason);
} else if (event->type == atom(QXcbAtom::MANAGER)
|| event->type == atom(QXcbAtom::_NET_WM_STATE)
|| event->type == atom(QXcbAtom::WM_CHANGE_STATE)) {
@@ -1855,14 +1855,14 @@ void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *)
QWindow *w = window();
w = static_cast<QWindowPrivate *>(QObjectPrivate::get(w))->eventReceiver();
connection()->setFocusWindow(static_cast<QXcbWindow *>(w->handle()));
- QWindowSystemInterface::handleWindowActivated(w);
+ QWindowSystemInterface::handleWindowActivated(w, Qt::ActiveWindowFocusReason);
}
static bool focusInPeeker(QXcbConnection *connection, xcb_generic_event_t *event)
{
if (!event) {
// FocusIn event is not in the queue, proceed with FocusOut normally.
- QWindowSystemInterface::handleWindowActivated(0);
+ QWindowSystemInterface::handleWindowActivated(0, Qt::ActiveWindowFocusReason);
return true;
}
uint response_type = event->response_type & ~0x80;
diff --git a/src/sql/drivers/sqlite/qsql_sqlite.cpp b/src/sql/drivers/sqlite/qsql_sqlite.cpp
index c98d6438fc..0b0731399e 100644
--- a/src/sql/drivers/sqlite/qsql_sqlite.cpp
+++ b/src/sql/drivers/sqlite/qsql_sqlite.cpp
@@ -609,7 +609,7 @@ bool QSQLiteDriver::open(const QString & db, const QString &, const QString &, c
foreach (const QString &option, opts) {
if (option.startsWith(QLatin1String("QSQLITE_BUSY_TIMEOUT="))) {
bool ok;
- const int nt = option.mid(21).toInt(&ok);
+ const int nt = option.midRef(21).toInt(&ok);
if (ok)
timeOut = nt;
} else if (option == QLatin1String("QSQLITE_OPEN_READONLY")) {
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index e170d2a044..2c8b7b20b7 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -1893,7 +1893,7 @@ char *toHexRepresentation(const char *ba, int length)
if (length > maxLen) {
const int size = len * 3 + 4;
- result = new char[size];
+ result = static_cast<char *>(malloc(size));
char *const forElipsis = result + size - 5;
forElipsis[0] = ' ';
@@ -1901,10 +1901,9 @@ char *toHexRepresentation(const char *ba, int length)
forElipsis[2] = '.';
forElipsis[3] = '.';
result[size - 1] = '\0';
- }
- else {
+ } else {
const int size = len * 3;
- result = new char[size];
+ result = static_cast<char *>(malloc(size));
result[size - 1] = '\0';
}
diff --git a/src/testlib/qtestkeyboard.h b/src/testlib/qtestkeyboard.h
index 878806737e..d693d66db4 100644
--- a/src/testlib/qtestkeyboard.h
+++ b/src/testlib/qtestkeyboard.h
@@ -151,17 +151,17 @@ namespace QTest
Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
{ sendKeyEvent(action, window, key, keyToAscii(key), modifier, delay); }
- inline static void keyClick(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ Q_DECL_UNUSED inline static void keyClick(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
{ keyEvent(Click, window, key, modifier, delay); }
- inline static void keyClick(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ Q_DECL_UNUSED inline static void keyClick(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
{ keyEvent(Click, window, key, modifier, delay); }
- inline static void keyRelease(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ Q_DECL_UNUSED inline static void keyRelease(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
{ keyEvent(Release, window, key, modifier, delay); }
- inline static void keyRelease(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ Q_DECL_UNUSED inline static void keyRelease(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
{ keyEvent(Release, window, key, modifier, delay); }
- inline static void keyPress(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ Q_DECL_UNUSED inline static void keyPress(QWindow *window, char key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
{ keyEvent(Press, window, key, modifier, delay); }
- inline static void keyPress(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
+ Q_DECL_UNUSED inline static void keyPress(QWindow *window, Qt::Key key, Qt::KeyboardModifiers modifier = Qt::NoModifier, int delay=-1)
{ keyEvent(Press, window, key, modifier, delay); }
#ifdef QT_WIDGETS_LIB
diff --git a/src/testlib/qtestresult.cpp b/src/testlib/qtestresult.cpp
index d94b2bf85c..a9abca0ef8 100644
--- a/src/testlib/qtestresult.cpp
+++ b/src/testlib/qtestresult.cpp
@@ -46,8 +46,10 @@
#include <QtTest/qtestdata.h>
#include <QtTest/qtestassert.h>
+#include <stdlib.h>
#include <stdio.h>
#include <string.h>
+#include <wchar.h>
QT_BEGIN_NAMESPACE
@@ -268,8 +270,8 @@ bool QTestResult::compare(bool success, const char *failureMsg,
if (success && QTest::expectFailMode) {
qsnprintf(msg, 1024, "QCOMPARE(%s, %s) returned TRUE unexpectedly.", actual, expected);
} else if (val1 || val2) {
- size_t len1 = strlen(actual);
- size_t len2 = strlen(expected);
+ size_t len1 = mbstowcs(NULL, actual, 0);
+ size_t len2 = mbstowcs(NULL, expected, 0);
qsnprintf(msg, 1024, "%s\n Actual (%s)%*s %s\n Expected (%s)%*s %s",
failureMsg,
actual, qMax(len1, len2) - len1 + 1, ":", val1 ? val1 : "<null>",
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index 2a719e96f1..f859ff164d 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -56,7 +56,7 @@ QT_BEGIN_NAMESPACE
namespace QTest
{
- inline static void qWait(int ms)
+ Q_DECL_UNUSED inline static void qWait(int ms)
{
Q_ASSERT(QCoreApplication::instance());
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index 3ae6445093..0a5f6ec241 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -343,7 +343,8 @@ int runMoc(int argc, char **argv)
parser.showHelp(1);
}
Macro macro;
- macro.symbols += Symbol(0, PP_IDENTIFIER, value);
+ macro.symbols = Preprocessor::tokenize(value, 1, Preprocessor::TokenizeDefine);
+ macro.symbols.removeLast(); // remove the EOF symbol
pp.macros.insert(name, macro);
}
foreach (const QString &arg, parser.values(undefineOption)) {
diff --git a/src/tools/moc/preprocessor.cpp b/src/tools/moc/preprocessor.cpp
index 3615262b67..2de495f010 100644
--- a/src/tools/moc/preprocessor.cpp
+++ b/src/tools/moc/preprocessor.cpp
@@ -158,8 +158,7 @@ bool Preprocessor::skipBranch()
}
-enum TokenizeMode { TokenizeCpp, TokenizePreprocessor, PreparePreprocessorStatement, TokenizePreprocessorStatement, TokenizeInclude, PrepareDefine, TokenizeDefine };
-static Symbols tokenize(const QByteArray &input, int lineNum = 1, TokenizeMode mode = TokenizeCpp)
+Symbols Preprocessor::tokenize(const QByteArray& input, int lineNum, Preprocessor::TokenizeMode mode)
{
Symbols symbols;
const char *begin = input.constData();
diff --git a/src/tools/moc/preprocessor.h b/src/tools/moc/preprocessor.h
index dc7c98de85..6403955c1b 100644
--- a/src/tools/moc/preprocessor.h
+++ b/src/tools/moc/preprocessor.h
@@ -89,6 +89,8 @@ public:
int evaluateCondition();
+ enum TokenizeMode { TokenizeCpp, TokenizePreprocessor, PreparePreprocessorStatement, TokenizePreprocessorStatement, TokenizeInclude, PrepareDefine, TokenizeDefine };
+ static Symbols tokenize(const QByteArray &input, int lineNum = 1, TokenizeMode mode = TokenizeCpp);
private:
void until(Token);
diff --git a/src/tools/qdoc/doc/config/qdoc.qdocconf b/src/tools/qdoc/doc/config/qdoc.qdocconf
index 992cec65dc..0f4ad07711 100644
--- a/src/tools/qdoc/doc/config/qdoc.qdocconf
+++ b/src/tools/qdoc/doc/config/qdoc.qdocconf
@@ -62,7 +62,6 @@ depends += \
qtsql \
qtsvg \
qttestlib \
- qttools \
qtuitools \
qtversit \
qtwidgets \
diff --git a/src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp b/src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp
index 338817ea74..70e3090cde 100644
--- a/src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp
+++ b/src/widgets/doc/snippets/code/src_gui_kernel_qwidget.cpp
@@ -44,7 +44,7 @@ w->setWindowState(w->windowState() ^ Qt::WindowFullScreen);
//! [1]
-w->setWindowState(w->windowState() & ~Qt::WindowMinimized | Qt::WindowActive);
+w->setWindowState((w->windowState() & ~Qt::WindowMinimized) | Qt::WindowActive);
//! [1]
diff --git a/src/widgets/graphicsview/qgraphicswidget.cpp b/src/widgets/graphicsview/qgraphicswidget.cpp
index ccc51120a9..40d32ea1d5 100644
--- a/src/widgets/graphicsview/qgraphicswidget.cpp
+++ b/src/widgets/graphicsview/qgraphicswidget.cpp
@@ -2274,7 +2274,7 @@ void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGrap
const QPointF styleOrigin = this->windowFrameRect().topLeft();
painter->translate(styleOrigin);
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
const QSize pixmapSize = windowFrameRect.size();
if (pixmapSize.width() <= 0 || pixmapSize.height() <= 0)
return;
@@ -2342,7 +2342,7 @@ void QGraphicsWidget::paintWindowFrame(QPainter *painter, const QStyleOptionGrap
frameOptions.midLineWidth = 1;
style()->drawPrimitive(QStyle::PE_FrameWindow, &frameOptions, painter, widget);
-#ifdef Q_WS_MAC
+#ifdef Q_OS_MAC
realPainter->drawPixmap(QPoint(), pm);
delete painter;
#endif
diff --git a/src/widgets/itemviews/qlistview.cpp b/src/widgets/itemviews/qlistview.cpp
index 7f7c60b10e..135f89d4ac 100644
--- a/src/widgets/itemviews/qlistview.cpp
+++ b/src/widgets/itemviews/qlistview.cpp
@@ -915,6 +915,11 @@ QStyleOptionViewItem QListView::viewOptions() const
} else {
option.decorationPosition = QStyleOptionViewItem::Left;
}
+
+ if (d->gridSize().isValid()) {
+ option.rect.setSize(d->gridSize());
+ }
+
return option;
}
diff --git a/src/widgets/styles/qcommonstyle.cpp b/src/widgets/styles/qcommonstyle.cpp
index a9f1c3bbbc..2d7107598f 100644
--- a/src/widgets/styles/qcommonstyle.cpp
+++ b/src/widgets/styles/qcommonstyle.cpp
@@ -838,7 +838,10 @@ QSize QCommonStylePrivate::viewItemSize(const QStyleOptionViewItem *option, int
break;
case QStyleOptionViewItem::Top:
case QStyleOptionViewItem::Bottom:
- bounds.setWidth(wrapText ? option->decorationSize.width() : QFIXED_MAX);
+ if (wrapText)
+ bounds.setWidth(bounds.isValid() ? bounds.width() - 2 * textMargin : option->decorationSize.width());
+ else
+ bounds.setWidth(QFIXED_MAX);
break;
default:
break;
diff --git a/src/widgets/styles/qstylesheetstyle.cpp b/src/widgets/styles/qstylesheetstyle.cpp
index 2f36e0e53c..6bd0ba37c8 100644
--- a/src/widgets/styles/qstylesheetstyle.cpp
+++ b/src/widgets/styles/qstylesheetstyle.cpp
@@ -4710,7 +4710,9 @@ int QStyleSheetStyle::pixelMetric(PixelMetric m, const QStyleOption *opt, const
break;
case PM_TabBarBaseOverlap: {
- const QWidget *tabWidget = qobject_cast<const QTabWidget *>(w) ? w : w->parentWidget();
+ const QWidget *tabWidget = qobject_cast<const QTabWidget *>(w);
+ if (!tabWidget && w)
+ tabWidget = w->parentWidget();
if (hasStyleRule(tabWidget, PseudoElement_TabWidgetPane)) {
return 0;
}
diff --git a/src/widgets/styles/qwindowsvistastyle.cpp b/src/widgets/styles/qwindowsvistastyle.cpp
index 2f36944b5e..af379b756e 100644
--- a/src/widgets/styles/qwindowsvistastyle.cpp
+++ b/src/widgets/styles/qwindowsvistastyle.cpp
@@ -1879,7 +1879,11 @@ void QWindowsVistaStyle::drawComplexControl(ComplexControl control, const QStyle
XPThemeData ftheme(widget, painter,
QWindowsXPStylePrivate::EditTheme,
partId, stateId, r);
- ftheme.noContent = true;
+ // The spinbox in Windows QStyle is drawn with frameless QLineEdit inside it
+ // That however breaks with QtQuickControls where this results in transparent
+ // spinbox background, so if there's no "widget" passed (QtQuickControls case),
+ // let ftheme.noContent be false, which fixes the spinbox rendering in QQC
+ ftheme.noContent = (widget != NULL);
d->drawBackground(ftheme);
}
if (sub & SC_SpinBoxUp) {
diff --git a/src/widgets/widgets/qtextedit.cpp b/src/widgets/widgets/qtextedit.cpp
index 49e05e8e14..e47abace4d 100644
--- a/src/widgets/widgets/qtextedit.cpp
+++ b/src/widgets/widgets/qtextedit.cpp
@@ -2042,7 +2042,7 @@ QList<QTextEdit::ExtraSelection> QTextEdit::extraSelections() const
This function returns a new MIME data object to represent the contents
of the text edit's current selection. It is called when the selection needs
to be encapsulated into a new QMimeData object; for example, when a drag
- and drop operation is started, or when data is copyied to the clipboard.
+ and drop operation is started, or when data is copied to the clipboard.
If you reimplement this function, note that the ownership of the returned
QMimeData object is passed to the caller. The selection can be retrieved