summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@nokia.com>2010-09-13 12:13:28 +0200
committerPaul Olav Tvete <paul.tvete@nokia.com>2010-09-13 12:13:28 +0200
commit8f9d38ed63a2c568596febe5ea59a55fe03d7ba9 (patch)
treeaed0951fc53191a24c3f64862554976c57a708c9 /src/gui
parent0bf1b83cd7d972a69388cdbd759dbba8b1baffd2 (diff)
parent72cc21e597f2d77ea1be3c1a3f7df36d8909d2fc (diff)
Merge branch 'qt-4.7' into lighthouse-4.7
Conflicts: configure src/corelib/tools/qsimd.cpp
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/accessible/qaccessible_win.cpp4
-rw-r--r--src/gui/dialogs/qfiledialog_win.cpp12
-rw-r--r--src/gui/dialogs/qwizard_win.cpp6
-rw-r--r--src/gui/graphicsview/qgraphicsitem.cpp40
-rw-r--r--src/gui/graphicsview/qgraphicsscene.cpp19
-rw-r--r--src/gui/graphicsview/qgraphicstransform.cpp32
-rw-r--r--src/gui/graphicsview/qgraphicswidget.cpp4
-rw-r--r--src/gui/graphicsview/qgraphicswidget_p.cpp3
-rw-r--r--src/gui/gui.pro2
-rw-r--r--src/gui/image/qpixmap_s60.cpp47
-rw-r--r--src/gui/image/qpixmap_s60_p.h7
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_p.h12
-rw-r--r--src/gui/inputmethod/qcoefepinputcontext_s60.cpp67
-rw-r--r--src/gui/kernel/qapplication.cpp6
-rw-r--r--src/gui/kernel/qapplication_mac.mm3
-rw-r--r--src/gui/kernel/qapplication_s60.cpp42
-rw-r--r--src/gui/kernel/qapplication_win.cpp38
-rw-r--r--src/gui/kernel/qapplication_x11.cpp7
-rw-r--r--src/gui/kernel/qcocoasharedwindowmethods_mac_p.h15
-rw-r--r--src/gui/kernel/qdesktopwidget_win.cpp6
-rw-r--r--src/gui/kernel/qeventdispatcher_mac.mm6
-rw-r--r--src/gui/kernel/qgesturemanager.cpp8
-rw-r--r--src/gui/kernel/qgesturemanager_p.h4
-rw-r--r--src/gui/kernel/qsoftkeymanager_s60.cpp2
-rw-r--r--src/gui/kernel/qt_s60_p.h6
-rw-r--r--src/gui/kernel/qwidget.cpp2
-rw-r--r--src/gui/kernel/qwidget_s60.cpp15
-rw-r--r--src/gui/kernel/qwidget_win.cpp6
-rw-r--r--src/gui/painting/qblendfunctions.cpp8
-rw-r--r--src/gui/painting/qdrawhelper.cpp917
-rw-r--r--src/gui/painting/qdrawhelper_neon.cpp191
-rw-r--r--src/gui/painting/qdrawhelper_neon_p.h7
-rw-r--r--src/gui/painting/qdrawhelper_p.h67
-rw-r--r--src/gui/painting/qdrawhelper_sse2.cpp89
-rw-r--r--src/gui/painting/qdrawhelper_ssse3.cpp3
-rw-r--r--src/gui/painting/qdrawhelper_x86_p.h3
-rw-r--r--src/gui/painting/qpainter.cpp13
-rw-r--r--src/gui/painting/qtransform.h1
-rw-r--r--src/gui/styles/qcleanlooksstyle.cpp10
-rw-r--r--src/gui/styles/qgtkstyle.cpp5
-rw-r--r--src/gui/styles/qs60style.cpp26
-rw-r--r--src/gui/styles/qs60style_p.h1
-rw-r--r--src/gui/styles/qs60style_s60.cpp6
-rw-r--r--src/gui/styles/qwindowsstyle.cpp8
-rw-r--r--src/gui/styles/qwindowsvistastyle.cpp3
-rw-r--r--src/gui/styles/qwindowsxpstyle.cpp4
-rw-r--r--src/gui/text/qfont_s60.cpp31
-rw-r--r--src/gui/text/qfontdatabase_s60.cpp136
-rw-r--r--src/gui/text/qfontdatabase_win.cpp10
-rw-r--r--src/gui/text/qfontengine.cpp16
-rw-r--r--src/gui/text/qfontengine_ft.cpp13
-rw-r--r--src/gui/text/qfontengine_mac.mm17
-rw-r--r--src/gui/text/qfontengine_p.h1
-rw-r--r--src/gui/text/qfontengine_qpf.cpp2
-rw-r--r--src/gui/text/qfontengine_qws.cpp2
-rw-r--r--src/gui/text/qfontengine_s60.cpp9
-rw-r--r--src/gui/text/qfontengine_s60_p.h1
-rw-r--r--src/gui/text/qfontengine_win.cpp6
-rw-r--r--src/gui/text/qstatictext.cpp6
-rw-r--r--src/gui/text/qtextengine.cpp18
-rw-r--r--src/gui/util/qdesktopservices_s60.cpp1
-rw-r--r--src/gui/util/qdesktopservices_win.cpp6
-rw-r--r--src/gui/util/qsystemtrayicon_win.cpp8
-rw-r--r--src/gui/widgets/qcombobox.cpp3
-rw-r--r--src/gui/widgets/qdatetimeedit.cpp18
-rw-r--r--src/gui/widgets/qlinecontrol.cpp4
-rw-r--r--src/gui/widgets/qlineedit.cpp4
67 files changed, 1307 insertions, 788 deletions
diff --git a/src/gui/accessible/qaccessible_win.cpp b/src/gui/accessible/qaccessible_win.cpp
index fc8575f8f3..132d01fa97 100644
--- a/src/gui/accessible/qaccessible_win.cpp
+++ b/src/gui/accessible/qaccessible_win.cpp
@@ -42,7 +42,7 @@
#ifndef QT_NO_ACCESSIBILITY
#include "qapplication.h"
-#include "qlibrary.h"
+#include <private/qsystemlibrary_p.h>
#include "qmessagebox.h" // ### dependency
#include "qt_windows.h"
#include "qwidget.h"
@@ -243,7 +243,7 @@ void QAccessible::updateAccessibility(QObject *o, int who, Event reason)
static bool resolvedNWE = false;
if (!resolvedNWE) {
resolvedNWE = true;
- ptrNotifyWinEvent = (PtrNotifyWinEvent)QLibrary::resolve(QLatin1String("user32"), "NotifyWinEvent");
+ ptrNotifyWinEvent = (PtrNotifyWinEvent)QSystemLibrary::resolve(QLatin1String("user32"), "NotifyWinEvent");
}
if (!ptrNotifyWinEvent)
return;
diff --git a/src/gui/dialogs/qfiledialog_win.cpp b/src/gui/dialogs/qfiledialog_win.cpp
index 258707c2db..5b192b4e34 100644
--- a/src/gui/dialogs/qfiledialog_win.cpp
+++ b/src/gui/dialogs/qfiledialog_win.cpp
@@ -52,7 +52,7 @@
#include <qbuffer.h>
#include <qdir.h>
#include <qstringlist.h>
-#include <qlibrary.h>
+#include <private/qsystemlibrary_p.h>
#include "qfiledialog_win_p.h"
#ifndef QT_NO_THREAD
@@ -100,10 +100,10 @@ static void qt_win_resolve_libs()
triedResolve = true;
#if !defined(Q_WS_WINCE)
- QLibrary lib(QLatin1String("shell32"));
- ptrSHBrowseForFolder = (PtrSHBrowseForFolder) lib.resolve("SHBrowseForFolderW");
- ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList) lib.resolve("SHGetPathFromIDListW");
- ptrSHGetMalloc = (PtrSHGetMalloc) lib.resolve("SHGetMalloc");
+ QSystemLibrary lib(L"shell32");
+ ptrSHBrowseForFolder = (PtrSHBrowseForFolder)lib.resolve("SHBrowseForFolderW");
+ ptrSHGetPathFromIDList = (PtrSHGetPathFromIDList)lib.resolve("SHGetPathFromIDListW");
+ ptrSHGetMalloc = (PtrSHGetMalloc)lib.resolve("SHGetMalloc");
#else
// CE stores them in a different lib and does not use unicode version
HINSTANCE handle = LoadLibrary(L"Ceshell");
@@ -409,7 +409,7 @@ static bool qt_win_set_IFileDialogOptions(IFileDialog *pfd,
{
if (!pSHCreateItemFromParsingName) {
// This function is available only in Vista & above.
- QLibrary shellLib(QLatin1String("Shell32"));
+ QSystemLibrary shellLib(QLatin1String("Shell32"));
pSHCreateItemFromParsingName = (PtrSHCreateItemFromParsingName)
shellLib.resolve("SHCreateItemFromParsingName");
if (!pSHCreateItemFromParsingName)
diff --git a/src/gui/dialogs/qwizard_win.cpp b/src/gui/dialogs/qwizard_win.cpp
index ad8801a094..5fca8f2272 100644
--- a/src/gui/dialogs/qwizard_win.cpp
+++ b/src/gui/dialogs/qwizard_win.cpp
@@ -43,7 +43,7 @@
#ifndef QT_NO_STYLE_WINDOWSVISTA
#include "qwizard_win_p.h"
-#include "qlibrary.h"
+#include <private/qsystemlibrary_p.h>
#include "qwizard.h"
#include "qpaintengine.h"
#include "qapplication.h"
@@ -706,7 +706,7 @@ bool QVistaHelper::resolveSymbols()
static bool tried = false;
if (!tried) {
tried = true;
- QLibrary dwmLib(QString::fromAscii("dwmapi"));
+ QSystemLibrary dwmLib(L"dwmapi");
pDwmIsCompositionEnabled =
(PtrDwmIsCompositionEnabled)dwmLib.resolve("DwmIsCompositionEnabled");
if (pDwmIsCompositionEnabled) {
@@ -714,7 +714,7 @@ bool QVistaHelper::resolveSymbols()
pDwmExtendFrameIntoClientArea =
(PtrDwmExtendFrameIntoClientArea)dwmLib.resolve("DwmExtendFrameIntoClientArea");
}
- QLibrary themeLib(QString::fromAscii("uxtheme"));
+ QSystemLibrary themeLib(L"uxtheme");
pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
if (pIsAppThemed) {
pDrawThemeBackground = (PtrDrawThemeBackground)themeLib.resolve("DrawThemeBackground");
diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp
index 0b3b1647e0..7a5b8de8e2 100644
--- a/src/gui/graphicsview/qgraphicsitem.cpp
+++ b/src/gui/graphicsview/qgraphicsitem.cpp
@@ -5666,9 +5666,6 @@ void QGraphicsItem::update(const QRectF &rect)
return;
}
- if (d_ptr->discardUpdateRequest())
- return;
-
if (d_ptr->scene)
d_ptr->scene->d_func()->markDirty(this, rect);
}
@@ -7758,18 +7755,21 @@ void QGraphicsItemPrivate::resetHeight()
}
/*!
- \property QGraphicsObject::children
- \internal
+ \property QGraphicsObject::children
+ \since 4.7
+ \internal
*/
/*!
- \property QGraphicsObject::width
- \internal
+ \property QGraphicsObject::width
+ \since 4.7
+ \internal
*/
/*!
- \property QGraphicsObject::height
- \internal
+ \property QGraphicsObject::height
+ \since 4.7
+ \internal
*/
/*!
@@ -7985,24 +7985,6 @@ void QGraphicsItemPrivate::resetHeight()
*/
/*!
- \property QGraphicsObject::children
- \since 4.7
- \internal
-*/
-
-/*!
- \property QGraphicsObject::width
- \since 4.7
- \internal
-*/
-
-/*!
- \property QGraphicsObject::height
- \since 4.7
- \internal
-*/
-
-/*!
\class QAbstractGraphicsShapeItem
\brief The QAbstractGraphicsShapeItem class provides a common base for
all path items.
@@ -10918,8 +10900,8 @@ QVariant QGraphicsSimpleTextItem::extension(const QVariant &variant) const
/*!
\class QGraphicsItemGroup
- \brief The QGraphicsItemGroup class provides treating a group of items as
- one.
+ \brief The QGraphicsItemGroup class provides a container that treats
+ a group of items as a single item.
\since 4.2
\ingroup graphicsview-api
diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp
index 3c23884b7a..539685ad42 100644
--- a/src/gui/graphicsview/qgraphicsscene.cpp
+++ b/src/gui/graphicsview/qgraphicsscene.cpp
@@ -1074,7 +1074,7 @@ void QGraphicsScenePrivate::enableMouseTrackingOnViews()
/*!
Returns all items for the screen position in \a event.
*/
-QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &screenPos,
+QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &/*screenPos*/,
const QPointF &scenePos,
QWidget *widget) const
{
@@ -1083,16 +1083,12 @@ QList<QGraphicsItem *> QGraphicsScenePrivate::itemsAtPosition(const QPoint &scre
if (!view)
return q->items(scenePos, Qt::IntersectsItemShape, Qt::DescendingOrder, QTransform());
- const QRectF pointRect(QPointF(widget->mapFromGlobal(screenPos)), QSizeF(1, 1));
+ const QRectF pointRect(scenePos, QSizeF(1, 1));
if (!view->isTransformed())
return q->items(pointRect, Qt::IntersectsItemShape, Qt::DescendingOrder);
const QTransform viewTransform = view->viewportTransform();
- if (viewTransform.type() <= QTransform::TxScale) {
- return q->items(viewTransform.inverted().mapRect(pointRect), Qt::IntersectsItemShape,
- Qt::DescendingOrder, viewTransform);
- }
- return q->items(viewTransform.inverted().map(pointRect), Qt::IntersectsItemShape,
+ return q->items(pointRect, Qt::IntersectsItemShape,
Qt::DescendingOrder, viewTransform);
}
@@ -5742,16 +5738,11 @@ void QGraphicsScenePrivate::touchEventHandler(QTouchEvent *sceneTouchEvent)
}
if (sceneTouchEvent->deviceType() == QTouchEvent::TouchScreen) {
- // on touch-screens, combine this touch point with the closest one we find if it
- // is a a direct descendent or ancestor (
+ // on touch-screens, combine this touch point with the closest one we find
int closestTouchPointId = findClosestTouchPointId(touchPoint.scenePos());
QGraphicsItem *closestItem = itemForTouchPointId.value(closestTouchPointId);
- if (!item
- || (closestItem
- && (item->isAncestorOf(closestItem)
- || closestItem->isAncestorOf(item)))) {
+ if (!item || (closestItem && cachedItemsUnderMouse.contains(closestItem)))
item = closestItem;
- }
}
if (!item)
continue;
diff --git a/src/gui/graphicsview/qgraphicstransform.cpp b/src/gui/graphicsview/qgraphicstransform.cpp
index bd3f2efd32..1f155c6e9d 100644
--- a/src/gui/graphicsview/qgraphicstransform.cpp
+++ b/src/gui/graphicsview/qgraphicstransform.cpp
@@ -346,21 +346,24 @@ void QGraphicsScale::applyTo(QMatrix4x4 *matrix) const
/*!
\fn QGraphicsScale::xScaleChanged()
+ \since 4.7
- QGraphicsScale emits this signal when its xScale changes.
+ This signal is emitted whenever the \l xScale property changes.
*/
/*!
\fn QGraphicsScale::yScaleChanged()
+ \since 4.7
- QGraphicsScale emits this signal when its yScale changes.
+ This signal is emitted whenever the \l yScale property changes.
*/
/*!
\fn QGraphicsScale::zScaleChanged()
+ \since 4.7
- QGraphicsScale emits this signal when its zScale changes.
-*/
+ This signal is emitted whenever the \l zScale property changes.
+*/
/*!
\fn QGraphicsScale::scaleChanged()
@@ -583,27 +586,6 @@ void QGraphicsRotation::applyTo(QMatrix4x4 *matrix) const
\sa QGraphicsRotation::axis
*/
-/*!
- \fn QGraphicsScale::xScaleChanged()
- \since 4.7
-
- This signal is emitted whenever the \l xScale property changes.
-*/
-
-/*!
- \fn QGraphicsScale::yScaleChanged()
- \since 4.7
-
- This signal is emitted whenever the \l yScale property changes.
-*/
-
-/*!
- \fn QGraphicsScale::zScaleChanged()
- \since 4.7
-
- This signal is emitted whenever the \l zScale property changes.
-*/
-
#include "moc_qgraphicstransform.cpp"
QT_END_NAMESPACE
diff --git a/src/gui/graphicsview/qgraphicswidget.cpp b/src/gui/graphicsview/qgraphicswidget.cpp
index 0fabd18bda..1bfe266f69 100644
--- a/src/gui/graphicsview/qgraphicswidget.cpp
+++ b/src/gui/graphicsview/qgraphicswidget.cpp
@@ -937,7 +937,9 @@ void QGraphicsWidget::setStyle(QStyle *style)
QFont QGraphicsWidget::font() const
{
Q_D(const QGraphicsWidget);
- return d->font;
+ QFont fnt = d->font;
+ fnt.resolve(fnt.resolve() | d->inheritedFontResolveMask);
+ return fnt;
}
void QGraphicsWidget::setFont(const QFont &font)
{
diff --git a/src/gui/graphicsview/qgraphicswidget_p.cpp b/src/gui/graphicsview/qgraphicswidget_p.cpp
index f7850cad80..34667337b5 100644
--- a/src/gui/graphicsview/qgraphicswidget_p.cpp
+++ b/src/gui/graphicsview/qgraphicswidget_p.cpp
@@ -254,7 +254,10 @@ void QGraphicsWidgetPrivate::setFont_helper(const QFont &font)
void QGraphicsWidgetPrivate::resolveFont(uint inheritedMask)
{
+ Q_Q(QGraphicsWidget);
inheritedFontResolveMask = inheritedMask;
+ if (QGraphicsWidget *p = q->parentWidget())
+ inheritedFontResolveMask |= p->d_func()->inheritedFontResolveMask;
QFont naturalFont = naturalWidgetFont();
QFont resolvedFont = font.resolve(naturalFont);
updateFont(resolvedFont);
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index ad791309ca..0527ccec48 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -99,7 +99,7 @@ neon:*-g++* {
contains(QMAKE_MAC_XARCH, no) {
DEFINES += QT_NO_MAC_XARCH
} else {
- win32-g++*|!win32:!*-icc* {
+ win32-g++*|!win32:!win32-icc*:!macx-icc* {
mmx {
mmx_compiler.commands = $$QMAKE_CXX -c -Winline
diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp
index 9d571b518d..47249d9873 100644
--- a/src/gui/image/qpixmap_s60.cpp
+++ b/src/gui/image/qpixmap_s60.cpp
@@ -63,6 +63,45 @@ QT_BEGIN_NAMESPACE
const uchar qt_pixmap_bit_mask[] = { 0x01, 0x02, 0x04, 0x08,
0x10, 0x20, 0x40, 0x80 };
+static bool cleanup_function_registered = false;
+static QS60PixmapData *firstPixmap = 0;
+
+// static
+void QS60PixmapData::qt_symbian_register_pixmap(QS60PixmapData *pd)
+{
+ if (!cleanup_function_registered) {
+ qAddPostRoutine(qt_symbian_release_pixmaps);
+ cleanup_function_registered = true;
+ }
+
+ pd->next = firstPixmap;
+ pd->prev = 0;
+ if (firstPixmap)
+ firstPixmap->prev = pd;
+ firstPixmap = pd;
+}
+
+// static
+void QS60PixmapData::qt_symbian_unregister_pixmap(QS60PixmapData *pd)
+{
+ if (pd->next)
+ pd->next->prev = pd->prev;
+ if (pd->prev)
+ pd->prev->next = pd->next;
+ else
+ firstPixmap = pd->next;
+}
+
+// static
+void QS60PixmapData::qt_symbian_release_pixmaps()
+{
+ // Scan all QS60PixmapData objects in the system and destroy them.
+ QS60PixmapData *pd = firstPixmap;
+ while (pd != 0) {
+ pd->release();
+ pd = pd->next;
+ }
+}
/*
\class QSymbianFbsClient
@@ -356,15 +395,18 @@ QS60PixmapData::QS60PixmapData(PixelType type) : QRasterPixmapData(type),
cfbsBitmap(0),
pengine(0),
bytes(0),
- formatLocked(false)
+ formatLocked(false),
+ next(0),
+ prev(0)
{
-
+ qt_symbian_register_pixmap(this);
}
QS60PixmapData::~QS60PixmapData()
{
release();
delete symbianBitmapDataAccess;
+ qt_symbian_unregister_pixmap(this);
}
void QS60PixmapData::resize(int width, int height)
@@ -789,7 +831,6 @@ void* QS60PixmapData::toNativeType(NativeType type)
bool convertToArgb32 = false;
bool needsCopy = false;
- QSysInfo::SymbianVersion symbianVersion = QSysInfo::symbianVersion();
if (!(S60->supportsPremultipliedAlpha)) {
// Convert argb32_premultiplied to argb32 since Symbian 9.2 does
// not support premultipied format.
diff --git a/src/gui/image/qpixmap_s60_p.h b/src/gui/image/qpixmap_s60_p.h
index 85c9ebe751..42cc830c37 100644
--- a/src/gui/image/qpixmap_s60_p.h
+++ b/src/gui/image/qpixmap_s60_p.h
@@ -120,6 +120,13 @@ private:
bool formatLocked;
+ QS60PixmapData *next;
+ QS60PixmapData *prev;
+
+ static void qt_symbian_register_pixmap(QS60PixmapData *pd);
+ static void qt_symbian_unregister_pixmap(QS60PixmapData *pd);
+ static void qt_symbian_release_pixmaps();
+
friend class QPixmap;
friend class QS60WindowSurface;
friend class QS60PaintEngine;
diff --git a/src/gui/inputmethod/qcoefepinputcontext_p.h b/src/gui/inputmethod/qcoefepinputcontext_p.h
index d5243c3f07..ac40bba0a3 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_p.h
+++ b/src/gui/inputmethod/qcoefepinputcontext_p.h
@@ -66,10 +66,10 @@
QT_BEGIN_NAMESPACE
-class QCoeFepInputContext : public QInputContext,
- public MCoeFepAwareTextEditor,
- public MCoeFepAwareTextEditor_Extension1,
- public MObjectProvider
+class Q_AUTOTEST_EXPORT QCoeFepInputContext : public QInputContext,
+ public MCoeFepAwareTextEditor,
+ public MCoeFepAwareTextEditor_Extension1,
+ public MObjectProvider
{
Q_OBJECT
@@ -84,6 +84,7 @@ public:
void update();
bool filterEvent(const QEvent *event);
+ bool symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event);
void mouseHandler( int x, QMouseEvent *event);
bool isComposing() const { return !m_preeditString.isEmpty(); }
@@ -151,9 +152,10 @@ private:
int m_inlinePosition;
MFepInlineTextFormatRetriever *m_formatRetriever;
MFepPointerEventHandlerDuringInlineEdit *m_pointerHandler;
- int m_cursorPos;
QBasicTimer m_tempPreeditStringTimeout;
bool m_hasTempPreeditString;
+
+ friend class tst_QInputContext;
};
QT_END_NAMESPACE
diff --git a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
index c4d60a526b..af86d77530 100644
--- a/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
+++ b/src/gui/inputmethod/qcoefepinputcontext_s60.cpp
@@ -47,6 +47,7 @@
#include <qgraphicsview.h>
#include <qgraphicsscene.h>
#include <qgraphicswidget.h>
+#include <qsymbianevent.h>
#include <private/qcore_symbian_p.h>
#include <fepitfr.h>
@@ -79,7 +80,6 @@ QCoeFepInputContext::QCoeFepInputContext(QObject *parent)
m_inlinePosition(0),
m_formatRetriever(0),
m_pointerHandler(0),
- m_cursorPos(0),
m_hasTempPreeditString(false)
{
m_fepState->SetObjectProvider(this);
@@ -237,11 +237,17 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
break;
}
+ QString widgetText = focusWidget()->inputMethodQuery(Qt::ImSurroundingText).toString();
+ int maxLength = focusWidget()->inputMethodQuery(Qt::ImMaximumTextLength).toInt();
+ if (!keyEvent->text().isEmpty() && widgetText.size() + m_preeditString.size() >= maxLength) {
+ // Don't send key events with string content if the widget is "full".
+ return true;
+ }
+
if (keyEvent->type() == QEvent::KeyPress
&& focusWidget()->inputMethodHints() & Qt::ImhHiddenText
&& !keyEvent->text().isEmpty()) {
// Send some temporary preedit text in order to make text visible for a moment.
- m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
m_preeditString = keyEvent->text();
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent imEvent(m_preeditString, attributes);
@@ -282,6 +288,18 @@ bool QCoeFepInputContext::filterEvent(const QEvent *event)
return false;
}
+bool QCoeFepInputContext::symbianFilterEvent(QWidget *keyWidget, const QSymbianEvent *event)
+{
+ Q_UNUSED(keyWidget);
+ if (event->type() == QSymbianEvent::CommandEvent)
+ // A command basically means the same as a button being pushed. With Qt buttons
+ // that would normally result in a reset of the input method due to the focus change.
+ // This should also happen for commands.
+ reset();
+
+ return false;
+}
+
void QCoeFepInputContext::timerEvent(QTimerEvent *timerEvent)
{
if (timerEvent->timerId() == m_tempPreeditStringTimeout.timerId())
@@ -297,10 +315,6 @@ void QCoeFepInputContext::commitTemporaryPreeditString()
return;
commitCurrentString(false);
-
- //update cursor position, now this pre-edit text has been committed.
- //this prevents next keypress overwriting it (QTBUG-11673)
- m_cursorPos = focusWidget()->inputMethodQuery(Qt::ImCursorPosition).toInt();
}
void QCoeFepInputContext::mouseHandler( int x, QMouseEvent *event)
@@ -368,6 +382,9 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
const bool anytextmodes = hints & (ImhUppercaseOnly | ImhLowercaseOnly | ImhEmailCharactersOnly | ImhUrlCharactersOnly);
const bool numbersOnly = anynumbermodes && !anytextmodes;
const bool noOnlys = !(hints & ImhExclusiveInputMask);
+ // if alphanumeric input, or if multiple incompatible number modes are selected;
+ // then make all symbols available in numeric mode too.
+ const bool needsCharMap= !numbersOnly || ((hints & ImhFormattedNumbersOnly) && (hints & ImhDialableCharactersOnly));
TInt flags;
Qt::InputMethodHints oldHints = hints;
@@ -467,9 +484,7 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
if (hints & ImhNoPredictiveText || hints & ImhHiddenText) {
flags |= EAknEditorFlagNoT9;
}
- // if alphanumeric input, or if multiple incompatible number modes are selected;
- // then make all symbols available in numeric mode too.
- if (!numbersOnly || ((hints & ImhFormattedNumbersOnly) && (hints & ImhDialableCharactersOnly)))
+ if (needsCharMap)
flags |= EAknEditorFlagUseSCTNumericCharmap;
m_fepState->SetFlags(flags);
ReportAknEdStateEvent(MAknEdStateObserver::EAknEdwinStateFlagsUpdate);
@@ -494,8 +509,10 @@ void QCoeFepInputContext::applyHints(Qt::InputMethodHints hints)
m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_URL_SPECIAL_CHARACTER_TABLE_DIALOG);
} else if (hints & ImhEmailCharactersOnly) {
m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_EMAIL_ADDR_SPECIAL_CHARACTER_TABLE_DIALOG);
- } else {
+ } else if (needsCharMap) {
m_fepState->SetSpecialCharacterTableResourceId(R_AVKON_SPECIAL_CHARACTER_TABLE_DIALOG);
+ } else {
+ m_fepState->SetSpecialCharacterTableResourceId(0);
}
if (hints & ImhHiddenText) {
@@ -596,8 +613,6 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText,
commitTemporaryPreeditString();
- m_cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
-
QList<QInputMethodEvent::Attribute> attributes;
m_cursorVisibility = aCursorVisibility ? 1 : 0;
@@ -612,9 +627,10 @@ void QCoeFepInputContext::StartFepInlineEditL(const TDesC& aInitialInlineText,
// Let's remove the selected text if aInitialInlineText is empty and there is selected text
if (m_preeditString.isEmpty()) {
int anchor = w->inputMethodQuery(Qt::ImAnchorPosition).toInt();
- int replacementLength = qAbs(m_cursorPos-anchor);
+ int cursorPos = w->inputMethodQuery(Qt::ImCursorPosition).toInt();
+ int replacementLength = qAbs(cursorPos-anchor);
if (replacementLength > 0) {
- int replacementStart = m_cursorPos < anchor ? 0 : -replacementLength;
+ int replacementStart = cursorPos < anchor ? 0 : -replacementLength;
QList<QInputMethodEvent::Attribute> clearSelectionAttributes;
QInputMethodEvent clearSelectionEvent(QLatin1String(""), clearSelectionAttributes);
clearSelectionEvent.setCommitString(QLatin1String(""), replacementStart, replacementLength);
@@ -647,8 +663,13 @@ void QCoeFepInputContext::UpdateFepInlineTextL(const TDesC& aNewInlineText,
m_inlinePosition,
m_cursorVisibility,
QVariant()));
- m_preeditString = qt_TDesC2QString(aNewInlineText);
- QInputMethodEvent event(m_preeditString, attributes);
+ QString newPreeditString = qt_TDesC2QString(aNewInlineText);
+ QInputMethodEvent event(newPreeditString, attributes);
+ if (newPreeditString.isEmpty() && m_preeditString.isEmpty()) {
+ // In Symbian world this means "erase last character".
+ event.setCommitString(QLatin1String(""), -1, 1);
+ }
+ m_preeditString = newPreeditString;
sendEvent(event);
}
@@ -818,25 +839,13 @@ void QCoeFepInputContext::DoCommitFepInlineEditL()
void QCoeFepInputContext::commitCurrentString(bool cancelFepTransaction)
{
- int longPress = 0;
-
- if (m_preeditString.size() == 0) {
- QWidget *w = focusWidget();
- if (!cancelFepTransaction && w) {
- // We must replace the last character only if the input box has already accepted one
- if (w->inputMethodQuery(Qt::ImCursorPosition).toInt() != m_cursorPos)
- longPress = 1;
- }
- }
-
QList<QInputMethodEvent::Attribute> attributes;
QInputMethodEvent event(QLatin1String(""), attributes);
- event.setCommitString(m_preeditString, 0-longPress, longPress);
+ event.setCommitString(m_preeditString, 0, 0);
m_preeditString.clear();
sendEvent(event);
m_hasTempPreeditString = false;
- longPress = 0;
if (cancelFepTransaction) {
CCoeFep* fep = CCoeEnv::Static()->Fep();
diff --git a/src/gui/kernel/qapplication.cpp b/src/gui/kernel/qapplication.cpp
index b5af8b6ddd..ce5c2c6155 100644
--- a/src/gui/kernel/qapplication.cpp
+++ b/src/gui/kernel/qapplication.cpp
@@ -813,6 +813,12 @@ void QApplicationPrivate::construct(
if (testLib.load()) {
typedef void (*TasInitialize)(void);
TasInitialize initFunction = (TasInitialize)testLib.resolve("qt_testability_init");
+#ifdef Q_OS_SYMBIAN
+ // resolving method by name does not work on Symbian OS so need to use ordinal
+ if(!initFunction) {
+ initFunction = (TasInitialize)testLib.resolve("1");
+ }
+#endif
if (initFunction) {
initFunction();
} else {
diff --git a/src/gui/kernel/qapplication_mac.mm b/src/gui/kernel/qapplication_mac.mm
index 321492dfde..dd819e5ce3 100644
--- a/src/gui/kernel/qapplication_mac.mm
+++ b/src/gui/kernel/qapplication_mac.mm
@@ -737,9 +737,6 @@ static void qt_post_window_change_event(QWidget *widget)
*/
static void qt_mac_update_child_gl_widgets(QWidget *widget)
{
- if (widget->isWindow())
- return;
-
// Update all OpenGL child widgets for the given widget.
QList<QWidgetPrivate::GlWidgetInfo> &glWidgets = qt_widget_private(widget)->glWidgets;
QList<QWidgetPrivate::GlWidgetInfo>::iterator end = glWidgets.end();
diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp
index 7c5e7909b6..e9379180c7 100644
--- a/src/gui/kernel/qapplication_s60.cpp
+++ b/src/gui/kernel/qapplication_s60.cpp
@@ -129,7 +129,13 @@ void QS60Data::setStatusPaneAndButtonGroupVisibility(bool statusPaneVisible, boo
statusPaneVisibilityChanged = (s->IsVisible() != statusPaneVisible);
s->MakeVisible(statusPaneVisible);
}
- if (buttonGroupVisibilityChanged && !statusPaneVisibilityChanged)
+ if (buttonGroupVisibilityChanged || statusPaneVisibilityChanged) {
+ const QSize size = qt_TRect2QRect(static_cast<CEikAppUi*>(S60->appUi())->ClientRect()).size();
+ const QSize oldSize; // note that QDesktopWidget::resizeEvent ignores the QResizeEvent contents
+ QResizeEvent event(size, oldSize);
+ QApplication::instance()->sendEvent(QApplication::desktop(), &event);
+ }
+ if (buttonGroupVisibilityChanged && !statusPaneVisibilityChanged && QApplication::activeWindow())
// Ensure that control rectangle is updated
static_cast<QSymbianControl *>(QApplication::activeWindow()->winId())->handleClientAreaChange();
}
@@ -1242,17 +1248,28 @@ void QSymbianControl::FocusChanged(TDrawNow /* aDrawNow */)
S60->setStatusPaneAndButtonGroupVisibility(statusPaneVisibility, buttonGroupVisibility);
#endif
} else if (QApplication::activeWindow() == qwidget->window()) {
- if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
- QWidget *fw = QApplication::focusWidget();
- if (fw) {
- QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
- QCoreApplication::sendEvent(fw, &event);
- }
- m_symbianPopupIsOpen = true;
- return;
+ bool focusedControlFound = false;
+ WId winId = 0;
+ for (QWidget *w = qwidget->parentWidget(); w && (winId = w->internalWinId()); w = w->parentWidget()) {
+ if (winId->IsFocused() && winId->IsVisible()) {
+ focusedControlFound = true;
+ break;
+ } else if (w->isWindow())
+ break;
}
+ if (!focusedControlFound) {
+ if (CCoeEnv::Static()->AppUi()->IsDisplayingMenuOrDialog() || S60->menuBeingConstructed) {
+ QWidget *fw = QApplication::focusWidget();
+ if (fw) {
+ QFocusEvent event(QEvent::FocusOut, Qt::PopupFocusReason);
+ QCoreApplication::sendEvent(fw, &event);
+ }
+ m_symbianPopupIsOpen = true;
+ return;
+ }
- QApplication::setActiveWindow(0);
+ QApplication::setActiveWindow(0);
+ }
}
// else { We don't touch the active window unless we were explicitly activated or deactivated }
}
@@ -1344,6 +1361,11 @@ void QSymbianControl::setFocusSafely(bool focus)
}
}
+bool QSymbianControl::isControlActive()
+{
+ return IsActivated() ? true : false;
+}
+
/*!
\typedef QApplication::QS60MainApplicationFactory
\since 4.6
diff --git a/src/gui/kernel/qapplication_win.cpp b/src/gui/kernel/qapplication_win.cpp
index 0c48bfdc30..78028eb1f4 100644
--- a/src/gui/kernel/qapplication_win.cpp
+++ b/src/gui/kernel/qapplication_win.cpp
@@ -68,7 +68,6 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include "qdatetime.h"
#include "qpointer.h"
#include "qhash.h"
-#include "qlibrary.h"
#include "qmetaobject.h"
#include "qmime.h"
#include "qpainter.h"
@@ -94,6 +93,7 @@ extern void qt_wince_hide_taskbar(HWND hwnd); //defined in qguifunctions_wince.c
#include "qdebug.h"
#include <private/qkeymapper_p.h>
#include <private/qlocale_p.h>
+#include <private/qsystemlibrary_p.h>
#include "qevent_p.h"
//#define ALIEN_DEBUG
@@ -206,7 +206,7 @@ static void resolveAygLibs()
{
if (!aygResolved) {
aygResolved = true;
- QLibrary ayglib(QLatin1String("aygshell"));
+ QSystemLibrary ayglib(QLatin1String("aygshell"));
if (!ayglib.load())
return;
ptrRecognizeGesture = (AygRecognizeGesture) ayglib.resolve("SHRecognizeGesture");
@@ -833,10 +833,10 @@ void qt_init(QApplicationPrivate *priv, int)
#ifndef Q_OS_WINCE
ptrUpdateLayeredWindowIndirect =
- (PtrUpdateLayeredWindowIndirect) QLibrary::resolve(QLatin1String("user32"),
+ (PtrUpdateLayeredWindowIndirect) QSystemLibrary::resolve(QLatin1String("user32"),
"UpdateLayeredWindowIndirect");
ptrUpdateLayeredWindow =
- (PtrUpdateLayeredWindow) QLibrary::resolve(QLatin1String("user32"),
+ (PtrUpdateLayeredWindow) QSystemLibrary::resolve(QLatin1String("user32"),
"UpdateLayeredWindow");
if (ptrUpdateLayeredWindow && !ptrUpdateLayeredWindowIndirect)
@@ -844,7 +844,7 @@ void qt_init(QApplicationPrivate *priv, int)
// Notify Vista and Windows 7 that we support highter DPI settings
ptrSetProcessDPIAware = (PtrSetProcessDPIAware)
- QLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware");
+ QSystemLibrary::resolve(QLatin1String("user32"), "SetProcessDPIAware");
if (ptrSetProcessDPIAware)
ptrSetProcessDPIAware();
#endif
@@ -865,30 +865,28 @@ void qt_init(QApplicationPrivate *priv, int)
#elif !defined(Q_WS_WINCE)
#if !defined(QT_NO_NATIVE_GESTURES)
priv->GetGestureInfo =
- (PtrGetGestureInfo)QLibrary::resolve(QLatin1String("user32"),
+ (PtrGetGestureInfo)QSystemLibrary::resolve(QLatin1String("user32"),
"GetGestureInfo");
priv->GetGestureExtraArgs =
- (PtrGetGestureExtraArgs)QLibrary::resolve(QLatin1String("user32"),
+ (PtrGetGestureExtraArgs)QSystemLibrary::resolve(QLatin1String("user32"),
"GetGestureExtraArgs");
priv->CloseGestureInfoHandle =
- (PtrCloseGestureInfoHandle)QLibrary::resolve(QLatin1String("user32"),
+ (PtrCloseGestureInfoHandle)QSystemLibrary::resolve(QLatin1String("user32"),
"CloseGestureInfoHandle");
priv->SetGestureConfig =
- (PtrSetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
+ (PtrSetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"),
"SetGestureConfig");
priv->GetGestureConfig =
- (PtrGetGestureConfig)QLibrary::resolve(QLatin1String("user32"),
+ (PtrGetGestureConfig)QSystemLibrary::resolve(QLatin1String("user32"),
"GetGestureConfig");
#endif // QT_NO_NATIVE_GESTURES
+ QSystemLibrary libTheme(QLatin1String("uxtheme"));
priv->BeginPanningFeedback =
- (PtrBeginPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
- "BeginPanningFeedback");
+ (PtrBeginPanningFeedback)libTheme.resolve("BeginPanningFeedback");
priv->UpdatePanningFeedback =
- (PtrUpdatePanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
- "UpdatePanningFeedback");
+ (PtrUpdatePanningFeedback)libTheme.resolve("UpdatePanningFeedback");
priv->EndPanningFeedback =
- (PtrEndPanningFeedback)QLibrary::resolve(QLatin1String("uxtheme"),
- "EndPanningFeedback");
+ (PtrEndPanningFeedback)libTheme.resolve("EndPanningFeedback");
#endif
#endif // QT_NO_GESTURES
}
@@ -2338,7 +2336,7 @@ extern "C" LRESULT QT_WIN_CALLBACK QtWndProc(HWND hwnd, UINT message, WPARAM wPa
if (!oleaccChecked) {
oleaccChecked = true;
#if !defined(Q_OS_WINCE)
- ptrLresultFromObject = (PtrLresultFromObject)QLibrary::resolve(QLatin1String("oleacc.dll"), "LresultFromObject");
+ ptrLresultFromObject = (PtrLresultFromObject)QSystemLibrary::resolve(QLatin1String("oleacc"), "LresultFromObject");
#endif
}
if (ptrLresultFromObject) {
@@ -3142,7 +3140,7 @@ bool QETWidget::translateMouseEvent(const MSG &msg)
if (curWin != 0) {
if (!trackMouseEventLookup) {
trackMouseEventLookup = true;
- ptrTrackMouseEvent = (PtrTrackMouseEvent)QLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent");
+ ptrTrackMouseEvent = (PtrTrackMouseEvent)QSystemLibrary::resolve(QLatin1String("comctl32"), "_TrackMouseEvent");
}
if (ptrTrackMouseEvent && !qApp->d_func()->inPopupMode()) {
// We always have to set the tracking, since
@@ -3677,7 +3675,7 @@ static void initWinTabFunctions()
if (!qt_is_gui_used)
return;
- QLibrary library(QLatin1String("wintab32"));
+ QSystemLibrary library(QLatin1String("wintab32"));
if (library.load()) {
ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW");
ptrWTGet = (PtrWTGet)library.resolve("WTGetW");
@@ -4100,7 +4098,7 @@ void QApplicationPrivate::initializeMultitouch_sys()
value & (QT_NID_INTEGRATED_TOUCH | QT_NID_EXTERNAL_TOUCH | QT_NID_MULTI_INPUT);
}
- QLibrary library(QLatin1String("user32"));
+ QSystemLibrary library(QLatin1String("user32"));
// MinGW (g++ 3.4.5) accepts only C casts.
RegisterTouchWindow = (PtrRegisterTouchWindow)(library.resolve("RegisterTouchWindow"));
GetTouchInputInfo = (PtrGetTouchInputInfo)(library.resolve("GetTouchInputInfo"));
diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp
index e4d984818f..7495f6d9b6 100644
--- a/src/gui/kernel/qapplication_x11.cpp
+++ b/src/gui/kernel/qapplication_x11.cpp
@@ -3642,6 +3642,11 @@ int QApplication::x11ProcessEvent(XEvent* event)
case MapNotify: // window shown
if (widget->isWindow()) {
+ // if we got a MapNotify when we were not waiting for it, it most
+ // likely means the user has already asked to hide the window before
+ // it ever being shown, so we try to withdraw a window after sending
+ // the QShowEvent.
+ bool pendingHide = widget->testAttribute(Qt::WA_WState_ExplicitShowHide) && widget->testAttribute(Qt::WA_WState_Hidden);
widget->d_func()->topData()->waitingForMapNotify = 0;
if (widget->windowType() != Qt::Popup) {
@@ -3661,6 +3666,8 @@ int QApplication::x11ProcessEvent(XEvent* event)
widget->setAttribute(Qt::WA_WState_Visible, true);
}
}
+ if (pendingHide) // hide the window
+ XWithdrawWindow(X11->display, widget->internalWinId(), widget->x11Info().screen());
}
break;
diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
index 679514946c..ddf1a2738f 100644
--- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
@@ -58,6 +58,8 @@ QT_BEGIN_NAMESPACE
extern Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum); // qcocoaview.mm
extern QPointer<QWidget> qt_button_down; //qapplication_mac.cpp
extern const QStringList& qEnabledDraggedTypes(); // qmime_mac.cpp
+extern void qt_event_request_window_change(QWidget *); // qapplication_mac.mm
+extern void qt_mac_send_posted_gl_updates(QWidget *widget); // qapplication_mac.mm
Q_GLOBAL_STATIC(QPointer<QWidget>, currentDragTarget);
@@ -227,6 +229,19 @@ QT_END_NAMESPACE
[self release];
}
+- (void)setInitialFirstResponder:(NSView *)view
+{
+ // This method is called the first time the window is placed on screen and
+ // is the earliest point in time we can connect OpenGL contexts to NSViews.
+ QWidget *qwidget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self];
+ if (qwidget) {
+ qt_event_request_window_change(qwidget);
+ qt_mac_send_posted_gl_updates(qwidget);
+ }
+
+ [super setInitialFirstResponder:view];
+}
+
- (BOOL)makeFirstResponder:(NSResponder *)responder
{
// For some reason Cocoa wants to flip the first responder
diff --git a/src/gui/kernel/qdesktopwidget_win.cpp b/src/gui/kernel/qdesktopwidget_win.cpp
index 07dbc24b91..1b2dfe7a82 100644
--- a/src/gui/kernel/qdesktopwidget_win.cpp
+++ b/src/gui/kernel/qdesktopwidget_win.cpp
@@ -42,7 +42,7 @@
#include "qdesktopwidget.h"
#include "qt_windows.h"
#include "qapplication_p.h"
-#include "qlibrary.h"
+#include <private/qsystemlibrary_p.h>
#include <qvector.h>
#include <limits.h>
#ifdef Q_WS_WINCE
@@ -155,7 +155,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that)
screenCount = 0;
#ifndef Q_OS_WINCE
- QLibrary user32Lib(QLatin1String("user32"));
+ QSystemLibrary user32Lib(QLatin1String("user32"));
if (user32Lib.load()) {
enumDisplayMonitors = (EnumFunc)user32Lib.resolve("EnumDisplayMonitors");
getMonitorInfo = (InfoFunc)user32Lib.resolve("GetMonitorInfoW");
@@ -173,7 +173,7 @@ void QDesktopWidgetPrivate::init(QDesktopWidget *that)
enumDisplayMonitors = 0;
getMonitorInfo = 0;
#else
- QLibrary coreLib(QLatin1String("coredll"));
+ QSystemLibrary coreLib(QLatin1String("coredll"));
if (coreLib.load()) {
// CE >= 4.0 case
enumDisplayMonitors = (EnumFunc)coreLib.resolve("EnumDisplayMonitors");
diff --git a/src/gui/kernel/qeventdispatcher_mac.mm b/src/gui/kernel/qeventdispatcher_mac.mm
index 89f01d8ea9..515c6d3b9a 100644
--- a/src/gui/kernel/qeventdispatcher_mac.mm
+++ b/src/gui/kernel/qeventdispatcher_mac.mm
@@ -830,6 +830,7 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
[window setLevel:levelBeforeEnterModal];
}
currentModalSessionCached = info.session;
+ cleanupModalSessionsNeeded = false;
}
return currentModalSessionCached;
}
@@ -881,6 +882,10 @@ void QEventDispatcherMacPrivate::cleanupModalSessions()
for (int i=stackSize-1; i>=0; --i) {
QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
if (info.widget) {
+ // This session has a widget, and is therefore not marked
+ // as stopped. So just make it current. There might still be other
+ // stopped sessions on the stack, but those will be stopped on
+ // a later "cleanup" call.
currentModalSessionCached = info.session;
break;
}
@@ -926,6 +931,7 @@ void QEventDispatcherMacPrivate::endModalSession(QWidget *widget)
if (i == stackSize-1) {
// The top sessions ended. Interrupt the event dispatcher
// to start spinning the correct session immidiatly:
+ currentModalSessionCached = 0;
cleanupModalSessionsNeeded = true;
QEventDispatcherMac::instance()->interrupt();
}
diff --git a/src/gui/kernel/qgesturemanager.cpp b/src/gui/kernel/qgesturemanager.cpp
index e768a21f30..5c8034082e 100644
--- a/src/gui/kernel/qgesturemanager.cpp
+++ b/src/gui/kernel/qgesturemanager.cpp
@@ -162,7 +162,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
QMap<ObjectGesture, QList<QGesture *> >::Iterator iter = m_objectGestures.begin();
while (iter != m_objectGestures.end()) {
ObjectGesture objectGesture = iter.key();
- if (objectGesture.gesture == type && target == objectGesture.object.data()) {
+ if (objectGesture.gesture == type && target == objectGesture.object) {
QSet<QGesture *> gestures = iter.value().toSet();
for (QHash<QGestureRecognizer *, QSet<QGesture *> >::iterator
it = m_obsoleteGestures.begin(), e = m_obsoleteGestures.end(); it != e; ++it) {
@@ -172,6 +172,7 @@ void QGestureManager::cleanupCachedGestures(QObject *target, Qt::GestureType typ
m_deletedRecognizers.remove(g);
m_gestureToRecognizer.remove(g);
}
+
qDeleteAll(gestures);
iter = m_objectGestures.erase(iter);
} else {
@@ -595,8 +596,9 @@ void QGestureManager::deliverEvents(const QSet<QGesture *> &gestures,
if (gesture->hasHotSpot()) {
// guess the target widget using the hotspot of the gesture
QPoint pt = gesture->hotSpot().toPoint();
- if (QWidget *w = qApp->topLevelAt(pt)) {
- target = w->childAt(w->mapFromGlobal(pt));
+ if (QWidget *topLevel = qApp->topLevelAt(pt)) {
+ QWidget *child = topLevel->childAt(topLevel->mapFromGlobal(pt));
+ target = child ? child : topLevel;
}
} else {
// or use the context of the gesture
diff --git a/src/gui/kernel/qgesturemanager_p.h b/src/gui/kernel/qgesturemanager_p.h
index 747cb1ae52..0d84b67434 100644
--- a/src/gui/kernel/qgesturemanager_p.h
+++ b/src/gui/kernel/qgesturemanager_p.h
@@ -106,13 +106,13 @@ private:
struct ObjectGesture
{
- QWeakPointer<QObject> object;
+ QObject* object;
Qt::GestureType gesture;
ObjectGesture(QObject *o, const Qt::GestureType &g) : object(o), gesture(g) { }
inline bool operator<(const ObjectGesture &rhs) const
{
- if (object.data() < rhs.object.data())
+ if (object < rhs.object)
return true;
if (object == rhs.object)
return gesture < rhs.gesture;
diff --git a/src/gui/kernel/qsoftkeymanager_s60.cpp b/src/gui/kernel/qsoftkeymanager_s60.cpp
index 6325d9502c..fee1580082 100644
--- a/src/gui/kernel/qsoftkeymanager_s60.cpp
+++ b/src/gui/kernel/qsoftkeymanager_s60.cpp
@@ -401,7 +401,7 @@ bool QSoftKeyManagerPrivateS60::handleCommand(int command)
foreach(QAction *menuAction, action->menu()->actions()) {
QMenu *menu = menuAction->menu();
if(menu)
- menuBar->addMenu(action->menu());
+ menuBar->addMenu(menu);
else
menuBar->addAction(menuAction);
}
diff --git a/src/gui/kernel/qt_s60_p.h b/src/gui/kernel/qt_s60_p.h
index ad6a99a3c1..7fd2baa5d8 100644
--- a/src/gui/kernel/qt_s60_p.h
+++ b/src/gui/kernel/qt_s60_p.h
@@ -87,7 +87,7 @@ const TInt KInternalStatusPaneChange = 0x50000000;
//this macro exists because EColor16MAP enum value doesn't exist in Symbian OS 9.2
#define Q_SYMBIAN_ECOLOR16MAP TDisplayMode(13)
-class QS60ThreadLocalData
+class Q_AUTOTEST_EXPORT QS60ThreadLocalData
{
public:
QS60ThreadLocalData();
@@ -171,7 +171,7 @@ public:
#endif
};
-QS60Data* qGlobalS60Data();
+Q_AUTOTEST_EXPORT QS60Data* qGlobalS60Data();
#define S60 qGlobalS60Data()
class QAbstractLongTapObserver
@@ -211,6 +211,8 @@ public:
void setFocusSafely(bool focus);
+ bool isControlActive();
+
#ifdef Q_WS_S60
void FadeBehindPopup(bool fade){ popupFader.FadeBehindPopup( this, this, fade); }
void HandleStatusPaneSizeChange();
diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp
index 3ebe9c31b3..819e555569 100644
--- a/src/gui/kernel/qwidget.cpp
+++ b/src/gui/kernel/qwidget.cpp
@@ -4889,6 +4889,8 @@ void QWidgetPrivate::resolveLayoutDirection()
has been called for the parent do not inherit the parent's layout
direction.
+ This method no longer affects text layout direction since Qt 4.7.
+
\sa QApplication::layoutDirection
*/
void QWidget::setLayoutDirection(Qt::LayoutDirection direction)
diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp
index 7494f92983..c98c05aa43 100644
--- a/src/gui/kernel/qwidget_s60.cpp
+++ b/src/gui/kernel/qwidget_s60.cpp
@@ -366,7 +366,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
// Symbian windows are always created in an inactive state
// We perform this assignment for the case where the window is being re-created
- // as aa result of a call to setParent_sys, on either this widget or one of its
+ // as a result of a call to setParent_sys, on either this widget or one of its
// ancestors.
extra->activated = 0;
@@ -410,7 +410,7 @@ void QWidgetPrivate::create_sys(WId window, bool /* initializeWindow */, bool de
// Symbian windows are always created in an inactive state
// We perform this assignment for the case where the window is being re-created
- // as aa result of a call to setParent_sys, on either this widget or one of its
+ // as a result of a call to setParent_sys, on either this widget or one of its
// ancestors.
extra->activated = 0;
@@ -503,8 +503,10 @@ void QWidgetPrivate::show_sys()
// Can't use AppUi directly because it privately inherits from MEikStatusPaneObserver.
QSymbianControl *desktopControl = static_cast<QSymbianControl *>(QApplication::desktop()->winId());
S60->statusPane()->SetObserver(desktopControl);
- if (isFullscreen)
- S60->statusPane()->MakeVisible(false);
+ if (isFullscreen) {
+ const bool cbaVisible = S60->buttonGroupContainer() && S60->buttonGroupContainer()->IsVisible();
+ S60->setStatusPaneAndButtonGroupVisibility(false, cbaVisible);
+ }
}
}
}
@@ -954,7 +956,10 @@ void QWidgetPrivate::registerTouchWindow()
Q_Q(QWidget);
if (q->testAttribute(Qt::WA_WState_Created) && q->windowType() != Qt::Desktop) {
RWindow *rwindow = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow());
- rwindow->EnableAdvancedPointers();
+ QSymbianControl *window = static_cast<QSymbianControl *>(q->effectiveWinId());
+ //Enabling advanced pointer events for controls that already have active windows causes a panic.
+ if (!window->isControlActive())
+ rwindow->EnableAdvancedPointers();
}
#endif
}
diff --git a/src/gui/kernel/qwidget_win.cpp b/src/gui/kernel/qwidget_win.cpp
index 59035b16a0..3d206fdefc 100644
--- a/src/gui/kernel/qwidget_win.cpp
+++ b/src/gui/kernel/qwidget_win.cpp
@@ -47,7 +47,6 @@
#include "qevent.h"
#include "qimage.h"
#include "qlayout.h"
-#include "qlibrary.h"
#include "qpainter.h"
#include "qstack.h"
#include "qt_windows.h"
@@ -65,6 +64,7 @@
#include <private/qapplication_p.h>
#include <private/qwininputcontext_p.h>
#include <private/qpaintengine_raster_p.h>
+#include <private/qsystemlibrary_p.h>
#if defined(Q_WS_WINCE)
#include "qguifunctions_wince.h"
@@ -148,7 +148,7 @@ static void init_wintab_functions()
#else
if (!qt_is_gui_used)
return;
- QLibrary library(QLatin1String("wintab32"));
+ QSystemLibrary library(QLatin1String("wintab32"));
ptrWTOpen = (PtrWTOpen)library.resolve("WTOpenW");
ptrWTInfo = (PtrWTInfo)library.resolve("WTInfoW");
ptrWTClose = (PtrWTClose)library.resolve("WTClose");
@@ -1890,7 +1890,7 @@ void QWidgetPrivate::setWindowOpacity_sys(qreal level)
static bool function_resolved = false;
if (!function_resolved) {
ptrSetLayeredWindowAttributes =
- (PtrSetLayeredWindowAttributes) QLibrary::resolve(QLatin1String("user32"),
+ (PtrSetLayeredWindowAttributes) QSystemLibrary::resolve(QLatin1String("user32"),
"SetLayeredWindowAttributes");
function_resolved = true;
}
diff --git a/src/gui/painting/qblendfunctions.cpp b/src/gui/painting/qblendfunctions.cpp
index 24908cec0d..0edf256315 100644
--- a/src/gui/painting/qblendfunctions.cpp
+++ b/src/gui/painting/qblendfunctions.cpp
@@ -254,10 +254,10 @@ void qt_scale_image_argb32_on_rgb16(uchar *destPixels, int dbpl,
}
}
-static void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
- const uchar *src, int sbpl,
- int w, int h,
- int const_alpha)
+void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
+ const uchar *src, int sbpl,
+ int w, int h,
+ int const_alpha)
{
#ifdef QT_DEBUG_DRAW
printf("qt_blend_rgb16_on_rgb16: dst=(%p, %d), src=(%p, %d), dim=(%d, %d) alpha=%d\n",
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 276da9362e..bd5b0bdf09 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -46,7 +46,6 @@
#include <private/qdrawhelper_armv6_p.h>
#include <private/qdrawhelper_neon_p.h>
#include <private/qmath_p.h>
-#include <private/qsimd_p.h>
#include <qmath.h>
QT_BEGIN_NAMESPACE
@@ -656,6 +655,86 @@ const uint * QT_FASTCALL fetchTransformed(uint *buffer, const Operator *, const
return buffer;
}
+/** \internal
+ interpolate 4 argb pixels with the distx and disty factor.
+ distx and disty bust be between 0 and 16
+ */
+static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, int distx, int disty)
+{
+ uint distxy = distx * disty;
+ //idistx * disty = (16-distx) * disty = 16*disty - distxy
+ //idistx * idisty = (16-distx) * (16-disty) = 16*16 - 16*distx -16*dity + distxy
+ uint tlrb = (tl & 0x00ff00ff) * (16*16 - 16*distx - 16*disty + distxy);
+ uint tlag = ((tl & 0xff00ff00) >> 8) * (16*16 - 16*distx - 16*disty + distxy);
+ uint trrb = ((tr & 0x00ff00ff) * (distx*16 - distxy));
+ uint trag = (((tr & 0xff00ff00) >> 8) * (distx*16 - distxy));
+ uint blrb = ((bl & 0x00ff00ff) * (disty*16 - distxy));
+ uint blag = (((bl & 0xff00ff00) >> 8) * (disty*16 - distxy));
+ uint brrb = ((br & 0x00ff00ff) * (distxy));
+ uint brag = (((br & 0xff00ff00) >> 8) * (distxy));
+ return (((tlrb + trrb + blrb + brrb) >> 8) & 0x00ff00ff) | ((tlag + trag + blag + brag) & 0xff00ff00);
+}
+
+#if defined(QT_ALWAYS_HAVE_SSE2)
+#define interpolate_4_pixels_16_sse2(tl, tr, bl, br, distx, disty, colorMask, v_256, b) \
+{ \
+ const __m128i dxdy = _mm_mullo_epi16 (distx, disty); \
+ const __m128i distx_ = _mm_slli_epi16(distx, 4); \
+ const __m128i disty_ = _mm_slli_epi16(disty, 4); \
+ const __m128i idxidy = _mm_add_epi16(dxdy, _mm_sub_epi16(v_256, _mm_add_epi16(distx_, disty_))); \
+ const __m128i dxidy = _mm_sub_epi16(distx_, dxdy); \
+ const __m128i idxdy = _mm_sub_epi16(disty_, dxdy); \
+ \
+ __m128i tlAG = _mm_srli_epi16(tl, 8); \
+ __m128i tlRB = _mm_and_si128(tl, colorMask); \
+ __m128i trAG = _mm_srli_epi16(tr, 8); \
+ __m128i trRB = _mm_and_si128(tr, colorMask); \
+ __m128i blAG = _mm_srli_epi16(bl, 8); \
+ __m128i blRB = _mm_and_si128(bl, colorMask); \
+ __m128i brAG = _mm_srli_epi16(br, 8); \
+ __m128i brRB = _mm_and_si128(br, colorMask); \
+ \
+ tlAG = _mm_mullo_epi16(tlAG, idxidy); \
+ tlRB = _mm_mullo_epi16(tlRB, idxidy); \
+ trAG = _mm_mullo_epi16(trAG, dxidy); \
+ trRB = _mm_mullo_epi16(trRB, dxidy); \
+ blAG = _mm_mullo_epi16(blAG, idxdy); \
+ blRB = _mm_mullo_epi16(blRB, idxdy); \
+ brAG = _mm_mullo_epi16(brAG, dxdy); \
+ brRB = _mm_mullo_epi16(brRB, dxdy); \
+ \
+ /* Add the values, and shift to only keep 8 significant bits per colors */ \
+ __m128i rAG =_mm_add_epi16(_mm_add_epi16(tlAG, trAG), _mm_add_epi16(blAG, brAG)); \
+ __m128i rRB =_mm_add_epi16(_mm_add_epi16(tlRB, trRB), _mm_add_epi16(blRB, brRB)); \
+ rAG = _mm_andnot_si128(colorMask, rAG); \
+ rRB = _mm_srli_epi16(rRB, 8); \
+ _mm_storeu_si128((__m128i*)(b), _mm_or_si128(rAG, rRB)); \
+}
+#endif
+
+
+template<TextureBlendType blendType>
+Q_STATIC_TEMPLATE_FUNCTION inline void fetchTransformedBilinear_pixelBounds(int max, int l1, int l2, int &v1, int &v2)
+{
+ if (blendType == BlendTransformedBilinearTiled) {
+ v1 %= max;
+ if (v1 < 0) v1 += max;
+ v2 = v1 + 1;
+ v2 %= max;
+ } else {
+ if (v1 < l1) {
+ v2 = v1 = l1;
+ } else if (v1 >= l2) {
+ v2 = v1 = l2;
+ } else {
+ v2 = v1 + 1;
+ }
+ }
+
+ Q_ASSERT(v1 >= 0 && v1 < max);
+ Q_ASSERT(v2 >= 0 && v2 < max);
+}
+
template<TextureBlendType blendType, QImage::Format format> /* blendType = BlendTransformedBilinear or BlendTransformedBilinearTiled */
Q_STATIC_TEMPLATE_FUNCTION
const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *, const QSpanData *data,
@@ -676,13 +755,13 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
int image_x1 = data->texture.x1;
int image_y1 = data->texture.y1;
- int image_x2 = data->texture.x2;
- int image_y2 = data->texture.y2;
+ int image_x2 = data->texture.x2 - 1;
+ int image_y2 = data->texture.y2 - 1;
const qreal cx = x + 0.5;
const qreal cy = y + 0.5;
- const uint *end = buffer + length;
+ uint *end = buffer + length;
uint *b = buffer;
if (data->fast_matrix) {
// The increment pr x in the scanline
@@ -696,64 +775,295 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
fx -= half_point;
fy -= half_point;
- while (b < end) {
- int x1 = (fx >> 16);
- int x2;
+
+ if (fdy == 0) { //simple scale, no rotation
int y1 = (fy >> 16);
int y2;
+ fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
+ const uchar *s1 = data->texture.scanLine(y1);
+ const uchar *s2 = data->texture.scanLine(y2);
- if (blendType == BlendTransformedBilinearTiled) {
- x1 %= image_width;
- if (x1 < 0) x1 += image_width;
- x2 = x1 + 1;
- x2 %= image_width;
-
- y1 %= image_height;
- if (y1 < 0) y1 += image_height;
- y2 = y1 + 1;
- y2 %= image_height;
- } else {
- if (x1 < image_x1) {
- x2 = x1 = image_x1;
- } else if (x1 >= image_x2 - 1) {
- x2 = x1 = image_x2 - 1;
+ if (fdx <= fixed_scale && fdx > 0) { // scale up on X
+ int disty = (fy & 0x0000ffff) >> 8;
+ int idisty = 256 - disty;
+ int x = fx >> 16;
+
+ // The idea is first to do the interpolation between the row s1 and the row s2
+ // into an intermediate buffer, then we interpolate between two pixel of this buffer.
+
+ // intermediate_buffer[0] is a buffer of red-blue component of the pixel, in the form 0x00RR00BB
+ // intermediate_buffer[1] is the alpha-green component of the pixel, in the form 0x00AA00GG
+ quint32 intermediate_buffer[2][buffer_size + 2];
+ // count is the size used in the intermediate_buffer.
+ int count = qCeil(length * data->m11) + 2; //+1 for the last pixel to interpolate with, and +1 for rounding errors.
+ Q_ASSERT(count <= buffer_size + 2); //length is supposed to be <= buffer_size and data->m11 < 1 in this case
+ int f = 0;
+ int lim = count;
+ if (blendType == BlendTransformedBilinearTiled) {
+ x %= image_width;
+ if (x < 0) x += image_width;
} else {
- x2 = x1 + 1;
+ lim = qMin(count, image_x2-x+1);
+ if (x < image_x1) {
+ Q_ASSERT(x <= image_x2);
+ uint t = fetch(s1, image_x1, data->texture.colorTable);
+ uint b = fetch(s2, image_x1, data->texture.colorTable);
+ quint32 rb = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ quint32 ag = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ do {
+ intermediate_buffer[0][f] = rb;
+ intermediate_buffer[1][f] = ag;
+ f++;
+ x++;
+ } while (x < image_x1 && f < lim);
+ }
}
- if (y1 < image_y1) {
- y2 = y1 = image_y1;
- } else if (y1 >= image_y2 - 1) {
- y2 = y1 = image_y2 - 1;
- } else {
- y2 = y1 + 1;
+
+#if defined(QT_ALWAYS_HAVE_SSE2)
+ if (blendType != BlendTransformedBilinearTiled &&
+ (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)) {
+
+ const __m128i disty_ = _mm_set1_epi16(disty);
+ const __m128i idisty_ = _mm_set1_epi16(idisty);
+ const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+
+ lim -= 3;
+ for (; f < lim; x += 4, f += 4) {
+ // Load 4 pixels from s1, and split the alpha-green and red-blue component
+ __m128i top = _mm_loadu_si128((__m128i*)((const uint *)(s1)+x));
+ __m128i topAG = _mm_srli_epi16(top, 8);
+ __m128i topRB = _mm_and_si128(top, colorMask);
+ // Multiplies each colour component by idisty
+ topAG = _mm_mullo_epi16 (topAG, idisty_);
+ topRB = _mm_mullo_epi16 (topRB, idisty_);
+
+ // Same for the s2 vector
+ __m128i bottom = _mm_loadu_si128((__m128i*)((const uint *)(s2)+x));
+ __m128i bottomAG = _mm_srli_epi16(bottom, 8);
+ __m128i bottomRB = _mm_and_si128(bottom, colorMask);
+ bottomAG = _mm_mullo_epi16 (bottomAG, disty_);
+ bottomRB = _mm_mullo_epi16 (bottomRB, disty_);
+
+ // Add the values, and shift to only keep 8 significant bits per colors
+ __m128i rAG =_mm_add_epi16(topAG, bottomAG);
+ rAG = _mm_srli_epi16(rAG, 8);
+ _mm_storeu_si128((__m128i*)(&intermediate_buffer[1][f]), rAG);
+ __m128i rRB =_mm_add_epi16(topRB, bottomRB);
+ rRB = _mm_srli_epi16(rRB, 8);
+ _mm_storeu_si128((__m128i*)(&intermediate_buffer[0][f]), rRB);
+ }
+ }
+#endif
+ for (; f < count; f++) { // Same as above but without sse2
+ if (blendType == BlendTransformedBilinearTiled) {
+ if (x >= image_width) x -= image_width;
+ } else {
+ x = qMin(x, image_x2);
+ }
+
+ uint t = fetch(s1, x, data->texture.colorTable);
+ uint b = fetch(s2, x, data->texture.colorTable);
+
+ intermediate_buffer[0][f] = (((t & 0xff00ff) * idisty + (b & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ intermediate_buffer[1][f] = ((((t>>8) & 0xff00ff) * idisty + ((b>>8) & 0xff00ff) * disty) >> 8) & 0xff00ff;
+ x++;
+ }
+ // Now interpolate the values from the intermediate_buffer to get the final result.
+ fx &= fixed_scale - 1;
+ Q_ASSERT((fx >> 16) == 0);
+ while (b < end) {
+ register int x1 = (fx >> 16);
+ register int x2 = x1 + 1;
+ Q_ASSERT(x1 >= 0);
+ Q_ASSERT(x2 < count);
+
+ register int distx = (fx & 0x0000ffff) >> 8;
+ register int idistx = 256 - distx;
+ int rb = ((intermediate_buffer[0][x1] * idistx + intermediate_buffer[0][x2] * distx) >> 8) & 0xff00ff;
+ int ag = (intermediate_buffer[1][x1] * idistx + intermediate_buffer[1][x2] * distx) & 0xff00ff00;
+ *b = rb | ag;
+ b++;
+ fx += fdx;
+ }
+ } else if ((fdx < 0 && fdx > -(fixed_scale / 8)) || fabs(data->m22) < (1./8.)) { // scale up more than 8x
+ int y1 = (fy >> 16);
+ int y2;
+ fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
+ const uchar *s1 = data->texture.scanLine(y1);
+ const uchar *s2 = data->texture.scanLine(y2);
+ int disty = (fy & 0x0000ffff) >> 8;
+ int idisty = 256 - disty;
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
+ uint tl = fetch(s1, x1, data->texture.colorTable);
+ uint tr = fetch(s1, x2, data->texture.colorTable);
+ uint bl = fetch(s2, x1, data->texture.colorTable);
+ uint br = fetch(s2, x2, data->texture.colorTable);
+
+ int distx = (fx & 0x0000ffff) >> 8;
+ int idistx = 256 - distx;
+
+ uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
+ uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
+ *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
+
+ fx += fdx;
+ ++b;
+ }
+ } else { //scale down
+ int y1 = (fy >> 16);
+ int y2;
+ fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
+ const uchar *s1 = data->texture.scanLine(y1);
+ const uchar *s2 = data->texture.scanLine(y2);
+ int disty = (fy & 0x0000ffff) >> 12;
+
+#if defined(QT_ALWAYS_HAVE_SSE2)
+ if (blendType != BlendTransformedBilinearTiled &&
+ (format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)) {
+
+ //prolog to get into the bounds
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
+ if (x1 != x2) //break if we are insided the bounds.
+ break;
+ uint tl = fetch(s1, x1, data->texture.colorTable);
+ uint tr = fetch(s1, x2, data->texture.colorTable);
+ uint bl = fetch(s2, x1, data->texture.colorTable);
+ uint br = fetch(s2, x2, data->texture.colorTable);
+ int distx = (fx & 0x0000ffff) >> 12;
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
+ fx += fdx;
+ ++b;
+ }
+ uint *boundedEnd;
+ if (fdx > 0)
+ boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11));
+ else
+ boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11));
+ boundedEnd -= 3;
+
+ const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
+ //const __m128i distShuffleMask = _mm_set_epi8(13, 12, 13, 12, 9, 8, 9, 8, 5, 4, 5, 4, 1, 0, 1, 0);
+ const __m128i v_256 = _mm_set1_epi16(256);
+ const __m128i v_disty = _mm_set1_epi16(disty);
+ __m128i v_fdx = _mm_set1_epi32(fdx*4);
+
+ ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1);
+
+ union Vect_buffer { __m128i vect; quint32 i[4]; };
+ Vect_buffer v_fx;
+
+ for (int i = 0; i < 4; i++) {
+ v_fx.i[i] = fx;
+ fx += fdx;
+ }
+
+ while (b < boundedEnd) {
+
+ Vect_buffer tl, tr, bl, br;
+
+ for (int i = 0; i < 4; i++) {
+ int x1 = v_fx.i[i] >> 16;
+ const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1;
+ const uint *addr_tr = addr_tl + 1;
+ tl.i[i] = *addr_tl;
+ tr.i[i] = *addr_tr;
+ bl.i[i] = *(addr_tl+secondLine);
+ br.i[i] = *(addr_tr+secondLine);
+ }
+ __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12); //distx = (fx & 0x0000ffff) >> 12;
+ //v_distx = _mm_shuffle_epi8(v_disty, distShuffleMask); //distx |= distx << 16;
+ v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
+ v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
+
+ interpolate_4_pixels_16_sse2(tl.vect, tr.vect, bl.vect, br.vect, v_distx, v_disty, colorMask, v_256, b);
+ b+=4;
+ v_fx.vect = _mm_add_epi32(v_fx.vect, v_fdx);
+ }
+ fx = v_fx.i[0];
+ }
+#endif
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
+ uint tl = fetch(s1, x1, data->texture.colorTable);
+ uint tr = fetch(s1, x2, data->texture.colorTable);
+ uint bl = fetch(s2, x1, data->texture.colorTable);
+ uint br = fetch(s2, x2, data->texture.colorTable);
+ int distx = (fx & 0x0000ffff) >> 12;
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
+ fx += fdx;
+ ++b;
}
}
+ } else { //rotation
+ if (fabs(data->m11) > 8 || fabs(data->m22) > 8) {
+ //if we are zooming more than 8 times, we use 8bit precision for the position.
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ int y1 = (fy >> 16);
+ int y2;
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
+ fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
- const uchar *s1 = data->texture.scanLine(y1);
- const uchar *s2 = data->texture.scanLine(y2);
+ const uchar *s1 = data->texture.scanLine(y1);
+ const uchar *s2 = data->texture.scanLine(y2);
- uint tl = fetch(s1, x1, data->texture.colorTable);
- uint tr = fetch(s1, x2, data->texture.colorTable);
- uint bl = fetch(s2, x1, data->texture.colorTable);
- uint br = fetch(s2, x2, data->texture.colorTable);
+ uint tl = fetch(s1, x1, data->texture.colorTable);
+ uint tr = fetch(s1, x2, data->texture.colorTable);
+ uint bl = fetch(s2, x1, data->texture.colorTable);
+ uint br = fetch(s2, x2, data->texture.colorTable);
- int distx = (fx & 0x0000ffff) >> 8;
- int disty = (fy & 0x0000ffff) >> 8;
- int idistx = 256 - distx;
- int idisty = 256 - disty;
+ int distx = (fx & 0x0000ffff) >> 8;
+ int disty = (fy & 0x0000ffff) >> 8;
+ int idistx = 256 - distx;
+ int idisty = 256 - disty;
- uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
- uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
- *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
+ uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
+ uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
+ *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
- fx += fdx;
- fy += fdy;
- ++b;
+ fx += fdx;
+ fy += fdy;
+ ++b;
+ }
+ } else {
+ //we are zooming less than 8x, use 4bit precision
+ while (b < end) {
+ int x1 = (fx >> 16);
+ int x2;
+ int y1 = (fy >> 16);
+ int y2;
+
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
+ fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
+
+ const uchar *s1 = data->texture.scanLine(y1);
+ const uchar *s2 = data->texture.scanLine(y2);
+
+ uint tl = fetch(s1, x1, data->texture.colorTable);
+ uint tr = fetch(s1, x2, data->texture.colorTable);
+ uint bl = fetch(s2, x1, data->texture.colorTable);
+ uint br = fetch(s2, x2, data->texture.colorTable);
+
+ int distx = (fx & 0x0000ffff) >> 12;
+ int disty = (fy & 0x0000ffff) >> 12;
+
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
+
+ fx += fdx;
+ fy += fdy;
+ ++b;
+ }
+ }
}
} else {
const qreal fdx = data->m11;
@@ -779,37 +1089,8 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
int idistx = 256 - distx;
int idisty = 256 - disty;
- if (blendType == BlendTransformedBilinearTiled) {
- x1 %= image_width;
- if (x1 < 0) x1 += image_width;
- x2 = x1 + 1;
- x2 %= image_width;
-
- y1 %= image_height;
- if (y1 < 0) y1 += image_height;
- y2 = y1 + 1;
- y2 %= image_height;
- } else {
- if (x1 < 0) {
- x2 = x1 = 0;
- } else if (x1 >= image_width - 1) {
- x2 = x1 = image_width - 1;
- } else {
- x2 = x1 + 1;
- }
- if (y1 < 0) {
- y2 = y1 = 0;
- } else if (y1 >= image_height - 1) {
- y2 = y1 = image_height - 1;
- } else {
- y2 = y1 + 1;
- }
- }
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
+ fetchTransformedBilinear_pixelBounds<blendType>(image_height, image_y1, image_y2, y1, y2);
const uchar *s1 = data->texture.scanLine(y1);
const uchar *s2 = data->texture.scanLine(y2);
@@ -1309,7 +1590,7 @@ static const uint L2CacheLineLengthInInts = L2CacheLineLength/sizeof(uint);
}\
}
-static void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint, uint const_alpha)
{
comp_func_Clear_impl(dest, length, const_alpha);
}
@@ -1323,7 +1604,7 @@ void QT_FASTCALL comp_func_Clear(uint *dest, const uint *, int length, uint cons
result = s
dest = s * ca + d * cia
*/
-static void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255) {
QT_MEMFILL_UINT(dest, length, color);
@@ -1352,7 +1633,7 @@ void QT_FASTCALL comp_func_Source(uint *dest, const uint *src, int length, uint
}
}
-static void QT_FASTCALL comp_func_solid_Destination(uint *, int, uint, uint)
+void QT_FASTCALL comp_func_solid_Destination(uint *, int, uint, uint)
{
}
@@ -1366,7 +1647,7 @@ void QT_FASTCALL comp_func_Destination(uint *, const uint *, int, uint)
= s * ca + d * (sia * ca + cia)
= s * ca + d * (1 - sa*ca)
*/
-static void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha)
{
if ((const_alpha & qAlpha(color)) == 255) {
QT_MEMFILL_UINT(dest, length, color);
@@ -1407,7 +1688,7 @@ void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, u
dest = (d + s * dia) * ca + d * cia
= d + s * dia * ca
*/
-static void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
@@ -1442,7 +1723,7 @@ void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int leng
result = s * da
dest = s * da * ca + d * cia
*/
-static void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha)
{
PRELOAD_INIT(dest)
if (const_alpha == 255) {
@@ -1485,7 +1766,7 @@ void QT_FASTCALL comp_func_SourceIn(uint *dest, const uint *src, int length, uin
dest = d * sa * ca + d * cia
= d * (sa * ca + cia)
*/
-static void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint color, uint const_alpha)
{
uint a = qAlpha(color);
if (const_alpha != 255) {
@@ -1521,7 +1802,7 @@ void QT_FASTCALL comp_func_DestinationIn(uint *dest, const uint *src, int length
dest = s * dia * ca + d * cia
*/
-static void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha)
{
PRELOAD_INIT(dest)
if (const_alpha == 255) {
@@ -1564,7 +1845,7 @@ void QT_FASTCALL comp_func_SourceOut(uint *dest, const uint *src, int length, ui
dest = d * sia * ca + d * cia
= d * (sia * ca + cia)
*/
-static void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint color, uint const_alpha)
{
uint a = qAlpha(~color);
if (const_alpha != 255)
@@ -1600,7 +1881,7 @@ void QT_FASTCALL comp_func_DestinationOut(uint *dest, const uint *src, int lengt
= s*ca * da + d * (sia*ca + cia)
= s*ca * da + d * (1 - sa*ca)
*/
-static void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha != 255) {
color = BYTE_MUL(color, const_alpha);
@@ -1638,7 +1919,7 @@ void QT_FASTCALL comp_func_SourceAtop(uint *dest, const uint *src, int length, u
dest = d*sa*ca + s*dia*ca + d *cia
= s*ca * dia + d * (sa*ca + cia)
*/
-static void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint color, uint const_alpha)
{
uint a = qAlpha(color);
if (const_alpha != 255) {
@@ -1681,7 +1962,7 @@ void QT_FASTCALL comp_func_DestinationAtop(uint *dest, const uint *src, int leng
= s*ca * dia + d * (sia*ca + cia)
= s*ca * dia + d * (1 - sa*ca)
*/
-static void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha != 255)
color = BYTE_MUL(color, const_alpha);
@@ -1757,14 +2038,12 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Plus_impl(uint *dest, int
for (int i = 0; i < length; ++i) {
PRELOAD_COND(dest)
uint d = dest[i];
-#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
- d = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
-#undef MIX
+ d = comp_func_Plus_one_pixel(d, s);
coverage.store(&dest[i], d);
}
}
-static void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Plus_impl(dest, length, color, QFullCoverage());
@@ -1781,9 +2060,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_Plus_impl(uint *dest, const uin
uint d = dest[i];
uint s = src[i];
-#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
- d = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
-#undef MIX
+ d = comp_func_Plus_one_pixel(d, s);
coverage.store(&dest[i], d);
}
@@ -1830,7 +2107,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Multiply_impl(uint *dest,
}
}
-static void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Multiply_impl(dest, length, color, QFullCoverage());
@@ -1898,7 +2175,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Screen_impl(uint *dest, i
}
}
-static void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Screen_impl(dest, length, color, QFullCoverage());
@@ -1977,7 +2254,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Overlay_impl(uint *dest,
}
}
-static void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Overlay_impl(dest, length, color, QFullCoverage());
@@ -2050,7 +2327,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Darken_impl(uint *dest, i
}
}
-static void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Darken_impl(dest, length, color, QFullCoverage());
@@ -2123,7 +2400,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Lighten_impl(uint *dest,
}
}
-static void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Lighten_impl(dest, length, color, QFullCoverage());
@@ -2206,7 +2483,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorDodge_impl(uint *des
}
}
-static void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_ColorDodge_impl(dest, length, color, QFullCoverage());
@@ -2289,7 +2566,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_ColorBurn_impl(uint *dest
}
}
-static void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_ColorBurn_impl(dest, length, color, QFullCoverage());
@@ -2369,7 +2646,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_HardLight_impl(uint *dest
}
}
-static void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_HardLight_impl(dest, length, color, QFullCoverage());
@@ -2460,7 +2737,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_SoftLight_impl(uint *dest
}
}
-static void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_SoftLight_impl(dest, length, color, QFullCoverage());
@@ -2533,7 +2810,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void comp_func_solid_Difference_impl(uint *des
}
}
-static void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Difference_impl(dest, length, color, QFullCoverage());
@@ -2600,7 +2877,7 @@ Q_STATIC_TEMPLATE_FUNCTION inline void QT_FASTCALL comp_func_solid_Exclusion_imp
}
}
-static void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, uint const_alpha)
+void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, uint const_alpha)
{
if (const_alpha == 255)
comp_func_solid_Exclusion_impl(dest, length, color, QFullCoverage());
@@ -2644,10 +2921,10 @@ void QT_FASTCALL comp_func_Exclusion(uint *dest, const uint *src, int length, ui
# pragma pop
#endif
-static void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--)
@@ -2664,10 +2941,10 @@ void QT_FASTCALL rasterop_SourceOrDestination(uint *dest,
*dest++ |= *src++;
}
-static void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
color |= 0xff000000;
@@ -2687,10 +2964,10 @@ void QT_FASTCALL rasterop_SourceAndDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
color &= 0x00ffffff;
@@ -2710,10 +2987,10 @@ void QT_FASTCALL rasterop_SourceXorDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
color = ~color;
@@ -2735,10 +3012,10 @@ void QT_FASTCALL rasterop_NotSourceAndNotDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
color = ~color | 0xff000000;
@@ -2760,10 +3037,10 @@ void QT_FASTCALL rasterop_NotSourceOrNotDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
color = ~color & 0x00ffffff;
@@ -2785,8 +3062,8 @@ void QT_FASTCALL rasterop_NotSourceXorDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length,
- uint color, uint const_alpha)
+void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length,
+ uint color, uint const_alpha)
{
Q_UNUSED(const_alpha);
qt_memfill(dest, ~color | 0xff000000, length);
@@ -2800,10 +3077,10 @@ void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src,
*dest++ = ~(*src++) | 0xff000000;
}
-static void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
color = ~color | 0xff000000;
@@ -2825,10 +3102,10 @@ void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest,
}
}
-static void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest,
- int length,
- uint color,
- uint const_alpha)
+void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest,
+ int length,
+ uint color,
+ uint const_alpha)
{
Q_UNUSED(const_alpha);
while (length--) {
@@ -5163,239 +5440,6 @@ static void blend_tiled_rgb444(int count, const QSpan *spans, void *userData)
blend_tiled_generic<RegularSpans>(count, spans, userData);
}
-
-template <SpanMethod spanMethod, TextureBlendType blendType> /* blendType must be either BlendTransformedBilinear or BlendTransformedBilinearTiled */
-Q_STATIC_TEMPLATE_FUNCTION void blend_transformed_bilinear_argb(int count, const QSpan *spans, void *userData)
-{
- QSpanData *data = reinterpret_cast<QSpanData *>(userData);
- if (data->texture.format != QImage::Format_ARGB32_Premultiplied
- && data->texture.format != QImage::Format_RGB32) {
- blend_src_generic<spanMethod>(count, spans, userData);
- return;
- }
-
- CompositionFunction func = functionForMode[data->rasterBuffer->compositionMode];
- uint buffer[buffer_size];
-
- const int image_x1 = data->texture.x1;
- const int image_y1 = data->texture.y1;
- const int image_x2 = data->texture.x2;
- const int image_y2 = data->texture.y2;
- const int image_width = data->texture.width;
- const int image_height = data->texture.height;
- const int scanline_offset = data->texture.bytesPerLine / 4;
-
- if (data->fast_matrix) {
- // The increment pr x in the scanline
- int fdx = (int)(data->m11 * fixed_scale);
- int fdy = (int)(data->m12 * fixed_scale);
-
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + 0.5;
- const qreal cy = spans->y + 0.5;
-
- int x = int((data->m21 * cy
- + data->m11 * cx + data->dx) * fixed_scale) - half_point;
- int y = int((data->m22 * cy
- + data->m12 * cx + data->dy) * fixed_scale) - half_point;
-
- int length = spans->len;
- const int coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- int x1 = (x >> 16);
- int x2;
- int y1 = (y >> 16);
- int y2;
-
- if (blendType == BlendTransformedBilinearTiled) {
- x1 %= image_width;
- if (x1 < 0) x1 += image_width;
- x2 = x1 + 1;
- x2 %= image_width;
-
- y1 %= image_height;
- if (y1 < 0) y1 += image_height;
- y2 = y1 + 1;
- y2 %= image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
- } else {
- if (x1 < image_x1) {
- x2 = x1 = image_x1;
- } else if (x1 >= image_x2 - 1) {
- x2 = x1 = image_x2 - 1;
- } else {
- x2 = x1 + 1;
- }
- if (y1 < image_y1) {
- y2 = y1 = image_y1;
- } else if (y1 >= image_y2 - 1) {
- y2 = y1 = image_y2 - 1;
- } else {
- y2 = y1 + 1;
- }
- }
-
- int y1_offset = y1 * scanline_offset;
- int y2_offset = y2 * scanline_offset;
-
-#if defined(Q_IRIX_GCC3_3_WORKAROUND)
- uint tl = gccBug(image_bits[y1_offset + x1]);
- uint tr = gccBug(image_bits[y1_offset + x2]);
- uint bl = gccBug(image_bits[y2_offset + x1]);
- uint br = gccBug(image_bits[y2_offset + x2]);
-#else
- uint tl = image_bits[y1_offset + x1];
- uint tr = image_bits[y1_offset + x2];
- uint bl = image_bits[y2_offset + x1];
- uint br = image_bits[y2_offset + x2];
-#endif
-
- int distx = (x & 0x0000ffff) >> 8;
- int disty = (y & 0x0000ffff) >> 8;
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
- uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
- *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
- ++b;
-
- x += fdx;
- y += fdy;
- }
- if (spanMethod == RegularSpans)
- func(target, buffer, l, coverage);
- else
- drawBufferSpan(data, buffer, buffer_size,
- spans->x + spans->len - length,
- spans->y, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
- } else {
- const qreal fdx = data->m11;
- const qreal fdy = data->m12;
- const qreal fdw = data->m13;
-
- while (count--) {
- void *t = data->rasterBuffer->scanLine(spans->y);
-
- uint *target = ((uint *)t) + spans->x;
- uint *image_bits = (uint *)data->texture.imageData;
-
- const qreal cx = spans->x + 0.5;
- const qreal cy = spans->y + 0.5;
-
- qreal x = data->m21 * cy + data->m11 * cx + data->dx;
- qreal y = data->m22 * cy + data->m12 * cx + data->dy;
- qreal w = data->m23 * cy + data->m13 * cx + data->m33;
-
- int length = spans->len;
- const int coverage = (data->texture.const_alpha * spans->coverage) >> 8;
- while (length) {
- int l = qMin(length, buffer_size);
- const uint *end = buffer + l;
- uint *b = buffer;
- while (b < end) {
- const qreal iw = w == 0 ? 1 : 1 / w;
- const qreal px = x * iw - 0.5;
- const qreal py = y * iw - 0.5;
-
- int x1 = int(px) - (px < 0);
- int x2;
- int y1 = int(py) - (py < 0);
- int y2;
-
- int distx = int((px - x1) * 256);
- int disty = int((py - y1) * 256);
- int idistx = 256 - distx;
- int idisty = 256 - disty;
-
- if (blendType == BlendTransformedBilinearTiled) {
- x1 %= image_width;
- if (x1 < 0) x1 += image_width;
- x2 = x1 + 1;
- x2 %= image_width;
-
- y1 %= image_height;
- if (y1 < 0) y1 += image_height;
- y2 = y1 + 1;
- y2 %= image_height;
-
- Q_ASSERT(x1 >= 0 && x1 < image_width);
- Q_ASSERT(x2 >= 0 && x2 < image_width);
- Q_ASSERT(y1 >= 0 && y1 < image_height);
- Q_ASSERT(y2 >= 0 && y2 < image_height);
- } else {
- if (x1 < image_x1) {
- x2 = x1 = image_x1;
- } else if (x1 >= image_x2 - 1) {
- x2 = x1 = image_x2 - 1;
- } else {
- x2 = x1 + 1;
- }
- if (y1 < image_y1) {
- y2 = y1 = image_y1;
- } else if (y1 >= image_y2 - 1) {
- y2 = y1 = image_y2 - 1;
- } else {
- y2 = y1 + 1;
- }
- }
-
- int y1_offset = y1 * scanline_offset;
- int y2_offset = y2 * scanline_offset;
-
-#if defined(Q_IRIX_GCC3_3_WORKAROUND)
- uint tl = gccBug(image_bits[y1_offset + x1]);
- uint tr = gccBug(image_bits[y1_offset + x2]);
- uint bl = gccBug(image_bits[y2_offset + x1]);
- uint br = gccBug(image_bits[y2_offset + x2]);
-#else
- uint tl = image_bits[y1_offset + x1];
- uint tr = image_bits[y1_offset + x2];
- uint bl = image_bits[y2_offset + x1];
- uint br = image_bits[y2_offset + x2];
-#endif
-
- uint xtop = INTERPOLATE_PIXEL_256(tl, idistx, tr, distx);
- uint xbot = INTERPOLATE_PIXEL_256(bl, idistx, br, distx);
- *b = INTERPOLATE_PIXEL_256(xtop, idisty, xbot, disty);
- ++b;
-
- x += fdx;
- y += fdy;
- w += fdw;
- }
- if (spanMethod == RegularSpans)
- func(target, buffer, l, coverage);
- else
- drawBufferSpan(data, buffer, buffer_size,
- spans->x + spans->len - length,
- spans->y, l, coverage);
- target += l;
- length -= l;
- }
- ++spans;
- }
- }
-}
-
template <class DST, class SRC>
Q_STATIC_TEMPLATE_FUNCTION void blendTransformedBilinear(int count, const QSpan *spans,
void *userData)
@@ -6646,7 +6690,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32
- blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied
+ SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32_Premultiplied
blend_transformed_bilinear_rgb565,
blend_transformed_bilinear_argb8565,
blend_transformed_bilinear_rgb666,
@@ -6665,7 +6709,7 @@ static const ProcessSpans processTextureSpans[NBlendTypes][QImage::NImageFormats
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // Indexed8
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB32
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32
- blend_transformed_bilinear_argb<RegularSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
+ SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB32_Premultiplied
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB16
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // ARGB8565_Premultiplied
SPANFUNC_POINTER(blend_src_generic, RegularSpans), // RGB666
@@ -6764,7 +6808,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag
blend_src_generic<CallbackSpans>, // Indexed8
blend_src_generic<CallbackSpans>, // RGB32
blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinear>, // ARGB32_Premultiplied
+ blend_src_generic<CallbackSpans>, // ARGB32_Premultiplied
blend_src_generic<CallbackSpans>, // RGB16
blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
blend_src_generic<CallbackSpans>, // RGB666
@@ -6783,7 +6827,7 @@ static const ProcessSpans processTextureSpansCallback[NBlendTypes][QImage::NImag
blend_src_generic<CallbackSpans>, // Indexed8
blend_src_generic<CallbackSpans>, // RGB32
blend_src_generic<CallbackSpans>, // ARGB32
- blend_transformed_bilinear_argb<CallbackSpans, BlendTransformedBilinearTiled>, // ARGB32_Premultiplied
+ blend_src_generic<CallbackSpans>, // ARGB32_Premultiplied
blend_src_generic<CallbackSpans>, // RGB16
blend_src_generic<CallbackSpans>, // ARGB8565_Premultiplied
blend_src_generic<CallbackSpans>, // RGB666
@@ -7800,6 +7844,55 @@ void qInitDrawhelperAsm()
#ifdef QT_HAVE_SSE
if (features & SSE) {
+ extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+ extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse;
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse;
+ }
+#endif // SSE
+
+#ifdef QT_HAVE_SSE2
+ if (features & SSE2) {
+ extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+ extern void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
+ }
+
+#ifdef QT_HAVE_SSSE3
+ if (features & SSSE3) {
+ extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+ qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
+ qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
+ }
+#endif // SSSE3
+
+#endif // SSE2
+
+#ifdef QT_HAVE_SSE
+ if (features & SSE) {
functionForModeAsm = qt_functionForMode_SSE;
functionForModeSolidAsm = qt_functionForModeSolid_SSE;
qDrawHelper[QImage::Format_ARGB32_Premultiplied].blendColor = qt_blend_color_argb_sse;
@@ -7815,9 +7908,9 @@ void qInitDrawhelperAsm()
#ifdef QT_HAVE_SSE2
if (features & SSE2) {
extern void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels,
- const uint *srcPixels,
- int length,
- uint const_alpha);
+ const uint *srcPixels,
+ int length,
+ uint const_alpha);
extern void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, uint color, uint const_alpha);
extern void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha);
extern void QT_FASTCALL comp_func_Source_sse2(uint *dst, const uint *src, int length, uint const_alpha);
@@ -7826,51 +7919,16 @@ void qInitDrawhelperAsm()
functionForModeAsm[QPainter::CompositionMode_Source] = comp_func_Source_sse2;
functionForModeAsm[QPainter::CompositionMode_Plus] = comp_func_Plus_sse2;
functionForModeSolidAsm[0] = comp_func_solid_SourceOver_sse2;
-
- extern void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
- extern void qt_blend_argb32_on_argb32_sse2(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
-
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse2;
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse2;
-
-#if defined(QT_HAVE_SSSE3)
- if (features & SSSE3) {
- extern void qt_blend_argb32_on_argb32_ssse3(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_ssse3;
- }
-#endif // QT_HAVE_SSSE3
- } else
-#endif
- {
- extern void qt_blend_rgb32_on_rgb32_sse(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
- extern void qt_blend_argb32_on_argb32_sse(uchar *destPixels, int dbpl,
- const uchar *srcPixels, int sbpl,
- int w, int h,
- int const_alpha);
-
-
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB32] = qt_blend_rgb32_on_rgb32_sse;
- qBlendFunctions[QImage::Format_RGB32][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse;
- qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_sse;
}
-}
-#endif // SSE
+#endif
+ }
+#elif defined(QT_HAVE_SSE2)
+ // this is the special case when SSE2 is usable but MMX/SSE is not usable (e.g.: Windows x64 + visual studio)
+ if (features & SSE2) {
+ functionForModeAsm = qt_functionForMode_onlySSE2;
+ functionForModeSolidAsm = qt_functionForModeSolid_onlySSE2;
+ }
+#endif
#ifdef QT_HAVE_IWMMXT
if (features & IWMMXT) {
@@ -7900,6 +7958,7 @@ void qInitDrawhelperAsm()
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_argb32_neon;
qBlendFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_blend_argb32_on_rgb16_neon;
qBlendFunctions[QImage::Format_ARGB32_Premultiplied][QImage::Format_RGB16] = qt_blend_rgb16_on_argb32_neon;
+ qBlendFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_blend_rgb16_on_rgb16_neon;
qScaleFunctions[QImage::Format_RGB16][QImage::Format_ARGB32_Premultiplied] = qt_scale_image_argb32_on_rgb16_neon;
qScaleFunctions[QImage::Format_RGB16][QImage::Format_RGB16] = qt_scale_image_rgb16_on_rgb16_neon;
@@ -7911,11 +7970,13 @@ void qInitDrawhelperAsm()
functionForMode_C[QPainter::CompositionMode_SourceOver] = qt_blend_argb32_on_argb32_scanline_neon;
functionForModeSolid_C[QPainter::CompositionMode_SourceOver] = comp_func_solid_SourceOver_neon;
+ functionForMode_C[QPainter::CompositionMode_Plus] = comp_func_Plus_neon;
destFetchProc[QImage::Format_RGB16] = qt_destFetchRGB16_neon;
destStoreProc[QImage::Format_RGB16] = qt_destStoreRGB16_neon;
qMemRotateFunctions[QImage::Format_RGB16][0] = qt_memrotate90_16_neon;
qMemRotateFunctions[QImage::Format_RGB16][2] = qt_memrotate270_16_neon;
+ qt_memfill32 = qt_memfill32_neon;
}
#endif
diff --git a/src/gui/painting/qdrawhelper_neon.cpp b/src/gui/painting/qdrawhelper_neon.cpp
index 03fe0755f9..0afd07769a 100644
--- a/src/gui/painting/qdrawhelper_neon.cpp
+++ b/src/gui/painting/qdrawhelper_neon.cpp
@@ -51,6 +51,44 @@
QT_BEGIN_NAMESPACE
+void qt_memfill32_neon(quint32 *dest, quint32 value, int count)
+{
+ const int epilogueSize = count % 16;
+ if (count >= 16) {
+ quint32 *const neonEnd = dest + count - epilogueSize;
+ register uint32x4_t valueVector1 asm ("q0") = vdupq_n_u32(value);
+ register uint32x4_t valueVector2 asm ("q1") = valueVector1;
+ while (dest != neonEnd) {
+ asm volatile (
+ "vst2.32 { d0, d1, d2, d3 }, [%[DST]] !\n\t"
+ "vst2.32 { d0, d1, d2, d3 }, [%[DST]] !\n\t"
+ : [DST]"+r" (dest)
+ : [VALUE1]"w"(valueVector1), [VALUE2]"w"(valueVector2)
+ : "memory"
+ );
+ }
+ }
+
+ switch (epilogueSize)
+ {
+ case 15: *dest++ = value;
+ case 14: *dest++ = value;
+ case 13: *dest++ = value;
+ case 12: *dest++ = value;
+ case 11: *dest++ = value;
+ case 10: *dest++ = value;
+ case 9: *dest++ = value;
+ case 8: *dest++ = value;
+ case 7: *dest++ = value;
+ case 6: *dest++ = value;
+ case 5: *dest++ = value;
+ case 4: *dest++ = value;
+ case 3: *dest++ = value;
+ case 2: *dest++ = value;
+ case 1: *dest++ = value;
+ }
+}
+
static inline uint16x8_t qvdiv_255_u16(uint16x8_t x, uint16x8_t half)
{
// result = (x + (x >> 8) + 0x80) >> 8
@@ -129,6 +167,14 @@ pixman_composite_scanline_over_asm_neon (int32_t w,
const uint32_t *dst,
const uint32_t *src);
+extern "C" void
+pixman_composite_src_0565_0565_asm_neon (int32_t w,
+ int32_t h,
+ uint16_t *dst,
+ int32_t dst_stride,
+ uint16_t *src,
+ int32_t src_stride);
+
// qblendfunctions.cpp
void qt_blend_argb32_on_rgb16_const_alpha(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
@@ -162,6 +208,96 @@ void qt_blend_rgb16_on_argb32_neon(uchar *destPixels, int dbpl,
pixman_composite_src_0565_8888_asm_neon(w, h, dst, dbpl, src, sbpl);
}
+// qblendfunctions.cpp
+void qt_blend_rgb16_on_rgb16(uchar *dst, int dbpl,
+ const uchar *src, int sbpl,
+ int w, int h,
+ int const_alpha);
+
+template <int N>
+static inline void scanLineBlit16(quint16 *dst, quint16 *src, int dstride)
+{
+ if (N >= 2) {
+ ((quint32 *)dst)[0] = ((quint32 *)src)[0];
+ __builtin_prefetch(dst + dstride, 1, 0);
+ }
+ for (int i = 1; i < N/2; ++i)
+ ((quint32 *)dst)[i] = ((quint32 *)src)[i];
+ if (N & 1)
+ dst[N-1] = src[N-1];
+}
+
+template <int Width>
+static inline void blockBlit16(quint16 *dst, quint16 *src, int dstride, int sstride, int h)
+{
+ union {
+ quintptr address;
+ quint16 *pointer;
+ } u;
+
+ u.pointer = dst;
+
+ if (u.address & 2) {
+ while (h--) {
+ // align dst
+ dst[0] = src[0];
+ if (Width > 1)
+ scanLineBlit16<Width-1>(dst + 1, src + 1, dstride);
+ dst += dstride;
+ src += sstride;
+ }
+ } else {
+ while (h--) {
+ scanLineBlit16<Width>(dst, src, dstride);
+
+ dst += dstride;
+ src += sstride;
+ }
+ }
+}
+
+void qt_blend_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha)
+{
+ // testing show that the default memcpy is faster for widths 150 and up
+ if (const_alpha != 256 || w >= 150) {
+ qt_blend_rgb16_on_rgb16(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha);
+ return;
+ }
+
+ int dstride = dbpl / 2;
+ int sstride = sbpl / 2;
+
+ quint16 *dst = (quint16 *) destPixels;
+ quint16 *src = (quint16 *) srcPixels;
+
+ switch (w) {
+#define BLOCKBLIT(n) case n: blockBlit16<n>(dst, src, dstride, sstride, h); return;
+ BLOCKBLIT(1);
+ BLOCKBLIT(2);
+ BLOCKBLIT(3);
+ BLOCKBLIT(4);
+ BLOCKBLIT(5);
+ BLOCKBLIT(6);
+ BLOCKBLIT(7);
+ BLOCKBLIT(8);
+ BLOCKBLIT(9);
+ BLOCKBLIT(10);
+ BLOCKBLIT(11);
+ BLOCKBLIT(12);
+ BLOCKBLIT(13);
+ BLOCKBLIT(14);
+ BLOCKBLIT(15);
+#undef BLOCKBLIT
+ default:
+ break;
+ }
+
+ pixman_composite_src_0565_0565_asm_neon (w, h, dst, dstride, src, sstride);
+}
+
extern "C" void blend_8_pixels_argb32_on_rgb16_neon(quint16 *dst, const quint32 *src, int const_alpha);
void qt_blend_argb32_on_rgb16_neon(uchar *destPixels, int dbpl,
@@ -622,6 +758,61 @@ void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, u
}
}
+void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uint const_alpha)
+{
+ if (const_alpha == 255) {
+ uint *const end = dst + length;
+ uint *const neonEnd = end - 3;
+
+ while (dst < neonEnd) {
+ asm volatile (
+ "vld2.8 { d0, d1 }, [%[SRC]] !\n\t"
+ "vld2.8 { d2, d3 }, [%[DST]]\n\t"
+ "vqadd.u8 q0, q0, q1\n\t"
+ "vst2.8 { d0, d1 }, [%[DST]] !\n\t"
+ : [DST]"+r" (dst), [SRC]"+r" (src)
+ :
+ : "memory", "d0", "d1", "d2", "d3", "q0", "q1"
+ );
+ }
+
+ while (dst != end) {
+ *dst = comp_func_Plus_one_pixel(*dst, *src);
+ ++dst;
+ ++src;
+ }
+ } else {
+ int x = 0;
+ const int one_minus_const_alpha = 255 - const_alpha;
+ const uint16x8_t constAlphaVector = vdupq_n_u16(const_alpha);
+ const uint16x8_t oneMinusconstAlphaVector = vdupq_n_u16(one_minus_const_alpha);
+
+ const uint16x8_t half = vdupq_n_u16(0x80);
+ for (; x < length - 3; x += 4) {
+ const uint32x4_t src32 = vld1q_u32((uint32_t *)&src[x]);
+ const uint8x16_t src8 = vreinterpretq_u8_u32(src32);
+ uint8x16_t dst8 = vld1q_u8((uint8_t *)&dst[x]);
+ uint8x16_t result = vqaddq_u8(dst8, src8);
+
+ uint16x8_t result_low = vmovl_u8(vget_low_u8(result));
+ uint16x8_t result_high = vmovl_u8(vget_high_u8(result));
+
+ uint16x8_t dst_low = vmovl_u8(vget_low_u8(dst8));
+ uint16x8_t dst_high = vmovl_u8(vget_high_u8(dst8));
+
+ result_low = qvinterpolate_pixel_255(result_low, constAlphaVector, dst_low, oneMinusconstAlphaVector, half);
+ result_high = qvinterpolate_pixel_255(result_high, constAlphaVector, dst_high, oneMinusconstAlphaVector, half);
+
+ const uint32x2_t result32_low = vreinterpret_u32_u8(vmovn_u16(result_low));
+ const uint32x2_t result32_high = vreinterpret_u32_u8(vmovn_u16(result_high));
+ vst1q_u32((uint32_t *)&dst[x], vcombine_u32(result32_low, result32_high));
+ }
+
+ for (; x < length; ++x)
+ dst[x] = comp_func_Plus_one_pixel_const_alpha(dst[x], src[x], const_alpha, one_minus_const_alpha);
+ }
+}
+
static const int tileSize = 32;
extern "C" void qt_rotate90_16_neon(quint16 *dst, const quint16 *src, int sstride, int dstride, int count);
diff --git a/src/gui/painting/qdrawhelper_neon_p.h b/src/gui/painting/qdrawhelper_neon_p.h
index cd2dbfcb0d..d25b7ec37d 100644
--- a/src/gui/painting/qdrawhelper_neon_p.h
+++ b/src/gui/painting/qdrawhelper_neon_p.h
@@ -84,6 +84,11 @@ void qt_blend_rgb16_on_argb32_neon(uchar *destPixels, int dbpl,
int w, int h,
int const_alpha);
+void qt_blend_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl,
+ const uchar *srcPixels, int sbpl,
+ int w, int h,
+ int const_alpha);
+
void qt_alphamapblit_quint16_neon(QRasterBuffer *rasterBuffer,
int x, int y, quint32 color,
const uchar *bitmap,
@@ -120,6 +125,7 @@ void qt_transform_image_rgb16_on_rgb16_neon(uchar *destPixels, int dbpl,
const QTransform &targetRectTransform,
int const_alpha);
+void qt_memfill32_neon(quint32 *dest, quint32 value, int count);
void qt_memrotate90_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);
void qt_memrotate270_16_neon(const uchar *srcPixels, int w, int h, int sbpl, uchar *destPixels, int dbpl);
@@ -131,6 +137,7 @@ void QT_FASTCALL qt_destStoreRGB16_neon(QRasterBuffer *rasterBuffer,
int x, int y, const uint *buffer, int length);
void QT_FASTCALL comp_func_solid_SourceOver_neon(uint *destPixels, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_Plus_neon(uint *dst, const uint *src, int length, uint const_alpha);
#endif // QT_HAVE_NEON
diff --git a/src/gui/painting/qdrawhelper_p.h b/src/gui/painting/qdrawhelper_p.h
index d04c70d451..0cc2e409e1 100644
--- a/src/gui/painting/qdrawhelper_p.h
+++ b/src/gui/painting/qdrawhelper_p.h
@@ -62,6 +62,7 @@
#define QT_FT_END_HEADER
#endif
#include "private/qrasterdefs_p.h"
+#include <private/qsimd_p.h>
#ifdef Q_WS_QWS
#include "QtGui/qscreen_qws.h"
@@ -69,13 +70,6 @@
QT_BEGIN_NAMESPACE
-#if defined(Q_OS_MAC) && (defined(__ppc__) || defined(__ppc64__))
-#undef QT_HAVE_MMX
-#undef QT_HAVE_SSE
-#undef QT_HAVE_SSE2
-#undef QT_HAVE_3DNOW
-#endif
-
#if defined(Q_CC_MSVC) && _MSCVER <= 1300 && !defined(Q_CC_INTEL)
#define Q_STATIC_TEMPLATE_SPECIALIZATION static
#else
@@ -1944,6 +1938,30 @@ const uint qt_bayer_matrix[16][16] = {
((((argb >> 24) * alpha) >> 8) << 24) | (argb & 0x00ffffff)
+#if QT_POINTER_SIZE == 8 // 64-bit versions
+#define AMIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#else // 32 bits
+// The mask for alpha can overflow over 32 bits
+#define AMIX(mask) quint32(qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
+#define MIX(mask) (qMin(((quint32(s)&mask) + (quint32(d)&mask)), quint32(mask)))
+#endif
+
+inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
+{
+ const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
+}
+
+inline int comp_func_Plus_one_pixel(uint d, const uint s)
+{
+ const int result = (AMIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
+ return result;
+}
+
+#undef MIX
+#undef AMIX
+
// prototypes of all the composition functions
void QT_FASTCALL comp_func_SourceOver(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL comp_func_DestinationOver(uint *dest, const uint *src, int length, uint const_alpha);
@@ -1979,6 +1997,41 @@ void QT_FASTCALL rasterop_NotSource(uint *dest, const uint *src, int length, uin
void QT_FASTCALL rasterop_NotSourceAndDestination(uint *dest, const uint *src, int length, uint const_alpha);
void QT_FASTCALL rasterop_SourceAndNotDestination(uint *dest, const uint *src, int length, uint const_alpha);
+// prototypes of all the solid composition functions
+void QT_FASTCALL comp_func_solid_SourceOver(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_DestinationOver(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Clear(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Source(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Destination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_SourceIn(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_DestinationIn(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_SourceOut(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_DestinationOut(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_SourceAtop(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_DestinationAtop(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_XOR(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Plus(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Multiply(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Screen(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Overlay(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Darken(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Lighten(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_ColorDodge(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_ColorBurn(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_HardLight(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_SoftLight(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Difference(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL comp_func_solid_Exclusion(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_SourceOrDestination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_SourceAndDestination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_SourceXorDestination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_NotSourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_NotSourceOrNotDestination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_NotSourceXorDestination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_NotSource(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_NotSourceAndDestination(uint *dest, int length, uint color, uint const_alpha);
+void QT_FASTCALL rasterop_solid_SourceAndNotDestination(uint *dest, int length, uint color, uint const_alpha);
+
QT_END_NAMESPACE
#endif // QDRAWHELPER_P_H
diff --git a/src/gui/painting/qdrawhelper_sse2.cpp b/src/gui/painting/qdrawhelper_sse2.cpp
index 22c0384c08..ba2ba323f9 100644
--- a/src/gui/painting/qdrawhelper_sse2.cpp
+++ b/src/gui/painting/qdrawhelper_sse2.cpp
@@ -43,7 +43,6 @@
#ifdef QT_HAVE_SSE2
-#include <private/qsimd_p.h>
#include <private/qdrawingprimitive_sse2_p.h>
#include <private/qpaintengine_raster_p.h>
@@ -161,22 +160,6 @@ void QT_FASTCALL comp_func_SourceOver_sse2(uint *destPixels, const uint *srcPixe
}
}
-inline int comp_func_Plus_one_pixel_const_alpha(uint d, const uint s, const uint const_alpha, const uint one_minus_const_alpha)
-{
-#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
- const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
-#undef MIX
- return INTERPOLATE_PIXEL_255(result, const_alpha, d, one_minus_const_alpha);
-}
-
-inline int comp_func_Plus_one_pixel(uint d, const uint s)
-{
-#define MIX(mask) (qMin(((qint64(s)&mask) + (qint64(d)&mask)), qint64(mask)))
- const int result = (MIX(AMASK) | MIX(RMASK) | MIX(GMASK) | MIX(BMASK));
-#undef MIX
- return result;
-}
-
void QT_FASTCALL comp_func_Plus_sse2(uint *dst, const uint *src, int length, uint const_alpha)
{
int x = 0;
@@ -328,6 +311,78 @@ void QT_FASTCALL comp_func_solid_SourceOver_sse2(uint *destPixels, int length, u
}
}
+CompositionFunctionSolid qt_functionForModeSolid_onlySSE2[numCompositionFunctions] = {
+ comp_func_solid_SourceOver_sse2,
+ comp_func_solid_DestinationOver,
+ comp_func_solid_Clear,
+ comp_func_solid_Source,
+ comp_func_solid_Destination,
+ comp_func_solid_SourceIn,
+ comp_func_solid_DestinationIn,
+ comp_func_solid_SourceOut,
+ comp_func_solid_DestinationOut,
+ comp_func_solid_SourceAtop,
+ comp_func_solid_DestinationAtop,
+ comp_func_solid_XOR,
+ comp_func_solid_Plus,
+ comp_func_solid_Multiply,
+ comp_func_solid_Screen,
+ comp_func_solid_Overlay,
+ comp_func_solid_Darken,
+ comp_func_solid_Lighten,
+ comp_func_solid_ColorDodge,
+ comp_func_solid_ColorBurn,
+ comp_func_solid_HardLight,
+ comp_func_solid_SoftLight,
+ comp_func_solid_Difference,
+ comp_func_solid_Exclusion,
+ rasterop_solid_SourceOrDestination,
+ rasterop_solid_SourceAndDestination,
+ rasterop_solid_SourceXorDestination,
+ rasterop_solid_NotSourceAndNotDestination,
+ rasterop_solid_NotSourceOrNotDestination,
+ rasterop_solid_NotSourceXorDestination,
+ rasterop_solid_NotSource,
+ rasterop_solid_NotSourceAndDestination,
+ rasterop_solid_SourceAndNotDestination
+};
+
+CompositionFunction qt_functionForMode_onlySSE2[numCompositionFunctions] = {
+ comp_func_SourceOver_sse2,
+ comp_func_DestinationOver,
+ comp_func_Clear,
+ comp_func_Source_sse2,
+ comp_func_Destination,
+ comp_func_SourceIn,
+ comp_func_DestinationIn,
+ comp_func_SourceOut,
+ comp_func_DestinationOut,
+ comp_func_SourceAtop,
+ comp_func_DestinationAtop,
+ comp_func_XOR,
+ comp_func_Plus_sse2,
+ comp_func_Multiply,
+ comp_func_Screen,
+ comp_func_Overlay,
+ comp_func_Darken,
+ comp_func_Lighten,
+ comp_func_ColorDodge,
+ comp_func_ColorBurn,
+ comp_func_HardLight,
+ comp_func_SoftLight,
+ comp_func_Difference,
+ comp_func_Exclusion,
+ rasterop_SourceOrDestination,
+ rasterop_SourceAndDestination,
+ rasterop_SourceXorDestination,
+ rasterop_NotSourceAndNotDestination,
+ rasterop_NotSourceOrNotDestination,
+ rasterop_NotSourceXorDestination,
+ rasterop_NotSource,
+ rasterop_NotSourceAndDestination,
+ rasterop_SourceAndNotDestination
+};
+
void qt_memfill16_sse2(quint16 *dest, quint16 value, int count)
{
if (count < 3) {
diff --git a/src/gui/painting/qdrawhelper_ssse3.cpp b/src/gui/painting/qdrawhelper_ssse3.cpp
index 9c02009d72..4cb40895ba 100644
--- a/src/gui/painting/qdrawhelper_ssse3.cpp
+++ b/src/gui/painting/qdrawhelper_ssse3.cpp
@@ -39,11 +39,10 @@
**
****************************************************************************/
+#include <private/qdrawhelper_x86_p.h>
#ifdef QT_HAVE_SSSE3
-#include <private/qsimd_p.h>
-#include <private/qdrawhelper_x86_p.h>
#include <private/qdrawingprimitive_sse2_p.h>
QT_BEGIN_NAMESPACE
diff --git a/src/gui/painting/qdrawhelper_x86_p.h b/src/gui/painting/qdrawhelper_x86_p.h
index d7282a7fc3..09ccd77f52 100644
--- a/src/gui/painting/qdrawhelper_x86_p.h
+++ b/src/gui/painting/qdrawhelper_x86_p.h
@@ -122,6 +122,9 @@ void qt_blend_rgb32_on_rgb32_sse2(uchar *destPixels, int dbpl,
const uchar *srcPixels, int sbpl,
int w, int h,
int const_alpha);
+
+extern CompositionFunction qt_functionForMode_onlySSE2[];
+extern CompositionFunctionSolid qt_functionForModeSolid_onlySSE2[];
#endif // QT_HAVE_SSE2
#ifdef QT_HAVE_IWMMXT
diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp
index be900060b8..c6046acd5a 100644
--- a/src/gui/painting/qpainter.cpp
+++ b/src/gui/painting/qpainter.cpp
@@ -696,9 +696,9 @@ void QPainterPrivate::updateEmulationSpecifier(QPainterState *s)
skip = false;
- QBrush penBrush = s->pen.brush();
- Qt::BrushStyle brushStyle = s->brush.style();
- Qt::BrushStyle penBrushStyle = penBrush.style();
+ QBrush penBrush = (qpen_style(s->pen) == Qt::NoPen) ? QBrush(Qt::NoBrush) : qpen_brush(s->pen);
+ Qt::BrushStyle brushStyle = qbrush_style(s->brush);
+ Qt::BrushStyle penBrushStyle = qbrush_style(penBrush);
alpha = (penBrushStyle != Qt::NoBrush
&& (penBrushStyle < Qt::LinearGradientPattern && penBrush.color().alpha() != 255)
&& !penBrush.isOpaque())
@@ -5863,7 +5863,8 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
}
bool paintEngineSupportsTransformations = d->extended->type() == QPaintEngine::OpenGL2
- || d->extended->type() == QPaintEngine::OpenVG;
+ || d->extended->type() == QPaintEngine::OpenVG
+ || d->extended->type() == QPaintEngine::OpenGL;
if (paintEngineSupportsTransformations && !staticText_d->untransformedCoordinates) {
staticText_d->untransformedCoordinates = true;
@@ -5907,7 +5908,7 @@ void QPainter::drawStaticText(const QPointF &topLeftPosition, const QStaticText
// Recreate the layout of the static text because the matrix or font has changed
if (staticTextNeedsReinit)
- staticText_d->init();
+ staticText_d->init();
if (transformedPosition != staticText_d->position) { // Translate to actual position
QFixed fx = QFixed::fromReal(transformedPosition.x());
@@ -9027,7 +9028,7 @@ void QPainter::drawPixmapFragments(const PixmapFragment *fragments, int fragment
{
Q_D(QPainter);
- if (!d->engine)
+ if (!d->engine || pixmap.isNull())
return;
#ifndef QT_NO_DEBUG
diff --git a/src/gui/painting/qtransform.h b/src/gui/painting/qtransform.h
index 212a582217..11f267337c 100644
--- a/src/gui/painting/qtransform.h
+++ b/src/gui/painting/qtransform.h
@@ -64,7 +64,6 @@ class QVariant;
class Q_GUI_EXPORT QTransform
{
- Q_ENUMS(TransformationType)
public:
enum TransformationType {
TxNone = 0x00,
diff --git a/src/gui/styles/qcleanlooksstyle.cpp b/src/gui/styles/qcleanlooksstyle.cpp
index ada5293320..306219d01f 100644
--- a/src/gui/styles/qcleanlooksstyle.cpp
+++ b/src/gui/styles/qcleanlooksstyle.cpp
@@ -2157,7 +2157,7 @@ void QCleanlooksStyle::drawControl(ControlElement element, const QStyleOption *o
}
if (button->features & QStyleOptionButton::HasMenu)
- ir = ir.adjusted(0, 0, -pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
+ ir = ir.adjusted(0, 0, -proxy()->pixelMetric(PM_MenuButtonIndicator, button, widget), 0);
proxy()->drawItemText(painter, ir, tf, button->palette, (button->state & State_Enabled),
button->text, QPalette::ButtonText);
}
@@ -4014,8 +4014,8 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio
switch (subControl) {
case SC_SliderHandle: {
if (slider->orientation == Qt::Horizontal) {
- rect.setHeight(pixelMetric(PM_SliderThickness));
- rect.setWidth(pixelMetric(PM_SliderLength));
+ rect.setHeight(proxy()->pixelMetric(PM_SliderThickness));
+ rect.setWidth(proxy()->pixelMetric(PM_SliderLength));
int centerY = slider->rect.center().y() - rect.height() / 2;
if (slider->tickPosition & QSlider::TicksAbove)
centerY += tickSize;
@@ -4023,8 +4023,8 @@ QRect QCleanlooksStyle::subControlRect(ComplexControl control, const QStyleOptio
centerY -= tickSize;
rect.moveTop(centerY);
} else {
- rect.setWidth(pixelMetric(PM_SliderThickness));
- rect.setHeight(pixelMetric(PM_SliderLength));
+ rect.setWidth(proxy()->pixelMetric(PM_SliderThickness));
+ rect.setHeight(proxy()->pixelMetric(PM_SliderLength));
int centerX = slider->rect.center().x() - rect.width() / 2;
if (slider->tickPosition & QSlider::TicksAbove)
centerX += tickSize;
diff --git a/src/gui/styles/qgtkstyle.cpp b/src/gui/styles/qgtkstyle.cpp
index c989bd3d8a..c5429dd0f5 100644
--- a/src/gui/styles/qgtkstyle.cpp
+++ b/src/gui/styles/qgtkstyle.cpp
@@ -836,7 +836,10 @@ void QGtkStyle::drawPrimitive(PrimitiveElement element,
case PE_PanelItemViewItem:
if (const QStyleOptionViewItemV4 *vopt = qstyleoption_cast<const QStyleOptionViewItemV4 *>(option)) {
- if (vopt->backgroundBrush.style() != Qt::NoBrush) {
+ uint resolve_mask = vopt->palette.resolve();
+ if (vopt->backgroundBrush.style() != Qt::NoBrush
+ || (resolve_mask & (1 << QPalette::Base)))
+ {
QPointF oldBO = painter->brushOrigin();
painter->setBrushOrigin(vopt->rect.topLeft());
painter->fillRect(vopt->rect, vopt->backgroundBrush);
diff --git a/src/gui/styles/qs60style.cpp b/src/gui/styles/qs60style.cpp
index e28403bf4d..358c6aa494 100644
--- a/src/gui/styles/qs60style.cpp
+++ b/src/gui/styles/qs60style.cpp
@@ -154,6 +154,9 @@ QS60StylePrivate::~QS60StylePrivate()
{
clearCaches(); //deletes also background image
deleteThemePalette();
+#ifdef Q_WS_S60
+ removeAnimations();
+#endif
}
void QS60StylePrivate::drawSkinElement(SkinElements element, QPainter *painter,
@@ -1097,8 +1100,7 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
}
State mflags = bflags;
if (toolBtn->state & State_Sunken) {
- if (toolBtn->activeSubControls & SC_ToolButton)
- bflags |= State_Sunken;
+ bflags |= State_Sunken;
mflags |= State_Sunken;
}
@@ -1114,11 +1116,6 @@ void QS60Style::drawComplexControl(ComplexControl control, const QStyleOptionCom
if (bflags & (State_Sunken | State_On | State_Raised | State_Enabled)) {
tool.rect = button.unite(menuRect);
tool.state = bflags;
- const QToolButton *toolButtonWidget = qobject_cast<const QToolButton *>(widget);
- const QS60StylePrivate::SkinElements element =
- ((toolButtonWidget && toolButtonWidget->isDown()) || (option->state & State_Sunken)) ?
- QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton;
- QS60StylePrivate::drawSkinElement(element, painter, tool.rect, flags);
drawPrimitive(PE_PanelButtonTool, &tool, painter, widget);
}
if (toolBtn->subControls & SC_ToolButtonMenu) {
@@ -2174,9 +2171,12 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
case PE_PanelButtonBevel:
case PE_FrameButtonBevel:
if (QS60StylePrivate::canDrawThemeBackground(option->palette.base(), widget)) {
- const bool isPressed = option->state & State_Sunken;
- const QS60StylePrivate::SkinElements skinElement =
- isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
+ const bool isPressed = (option->state & State_Sunken) || (option->state & State_On);
+ QS60StylePrivate::SkinElements skinElement;
+ if (element == PE_PanelButtonTool)
+ skinElement = isPressed ? QS60StylePrivate::SE_ToolBarButtonPressed : QS60StylePrivate::SE_ToolBarButton;
+ else
+ skinElement = isPressed ? QS60StylePrivate::SE_ButtonPressed : QS60StylePrivate::SE_ButtonNormal;
QS60StylePrivate::drawSkinElement(skinElement, painter, option->rect, flags);
} else {
commonStyleDraws = true;
@@ -2340,16 +2340,20 @@ void QS60Style::drawPrimitive(PrimitiveElement element, const QStyleOption *opti
tableView = true;
QS60StylePrivate::SkinElements element;
+ bool themeGraphicDefined = false;
QRect elementRect = option->rect;
//draw item is drawn as pressed, if it already has focus.
if (isPressed && (hasFocus || isSelected)) {
+ themeGraphicDefined = true;
element = tableView ? QS60StylePrivate::SE_TableItemPressed : QS60StylePrivate::SE_ListItemPressed;
} else if (hasFocus || (isSelected && selectionBehavior != QAbstractItemView::SelectItems)) {
element = QS60StylePrivate::SE_ListHighlight;
elementRect = highlightRect;
+ themeGraphicDefined = true;
}
- QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags);
+ if (themeGraphicDefined)
+ QS60StylePrivate::drawSkinElement(element, painter, elementRect, flags);
} else {
QCommonStyle::drawPrimitive(element, option, painter, widget);
}
diff --git a/src/gui/styles/qs60style_p.h b/src/gui/styles/qs60style_p.h
index 836969a99a..51ced96edb 100644
--- a/src/gui/styles/qs60style_p.h
+++ b/src/gui/styles/qs60style_p.h
@@ -571,6 +571,7 @@ public:
void startAnimation(QS60StyleEnums::SkinParts animation);
void stopAnimation(QS60StyleEnums::SkinParts animation);
static QS60StyleAnimation* animationDefinition(QS60StyleEnums::SkinParts part);
+ static void removeAnimations();
#endif
diff --git a/src/gui/styles/qs60style_s60.cpp b/src/gui/styles/qs60style_s60.cpp
index f44b85e7d6..5dda42e74a 100644
--- a/src/gui/styles/qs60style_s60.cpp
+++ b/src/gui/styles/qs60style_s60.cpp
@@ -1152,6 +1152,12 @@ QS60StylePrivate::QS60StylePrivate()
setActiveLayout();
}
+void QS60StylePrivate::removeAnimations()
+{
+ //currently only one animation in the list.
+ m_animations()->removeFirst();
+}
+
QColor QS60StylePrivate::s60Color(QS60StyleEnums::ColorLists list,
int index, const QStyleOption *option)
{
diff --git a/src/gui/styles/qwindowsstyle.cpp b/src/gui/styles/qwindowsstyle.cpp
index 579dd0b7da..720dd6d2d8 100644
--- a/src/gui/styles/qwindowsstyle.cpp
+++ b/src/gui/styles/qwindowsstyle.cpp
@@ -44,7 +44,7 @@
#if !defined(QT_NO_STYLE_WINDOWS) || defined(QT_PLUGIN)
-#include "qlibrary.h"
+#include <private/qsystemlibrary_p.h>
#include "qapplication.h"
#include "qbitmap.h"
#include "qdrawutil.h" // for now
@@ -126,7 +126,7 @@ QWindowsStylePrivate::QWindowsStylePrivate()
#if defined(Q_WS_WIN) && !defined(Q_OS_WINCE)
if ((QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA
&& QSysInfo::WindowsVersion < QSysInfo::WV_NT_based)) {
- QLibrary shellLib(QLatin1String("shell32"));
+ QSystemLibrary shellLib(QLatin1String("shell32"));
pSHGetStockIconInfo = (PtrSHGetStockIconInfo)shellLib.resolve("SHGetStockIconInfo");
}
#endif
@@ -921,9 +921,9 @@ static const char *const question_xpm[] = {
static QPixmap loadIconFromShell32( int resourceId, int size )
{
#ifdef Q_OS_WINCE
- HMODULE hmod = LoadLibrary(L"ceshell.dll");
+ HMODULE hmod = LoadLibrary(L"ceshell");
#else
- HMODULE hmod = LoadLibrary(L"shell32.dll");
+ HMODULE hmod = QSystemLibrary::load(L"shell32");
#endif
if( hmod ) {
HICON iconHandle = (HICON)LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, size, size, 0);
diff --git a/src/gui/styles/qwindowsvistastyle.cpp b/src/gui/styles/qwindowsvistastyle.cpp
index 851159248f..58542e5252 100644
--- a/src/gui/styles/qwindowsvistastyle.cpp
+++ b/src/gui/styles/qwindowsvistastyle.cpp
@@ -42,6 +42,7 @@
#include "qwindowsvistastyle.h"
#include "qwindowsvistastyle_p.h"
#include <private/qstylehelper_p.h>
+#include <private/qsystemlibrary_p.h>
#if !defined(QT_NO_STYLE_WINDOWSVISTA) || defined(QT_PLUGIN)
@@ -2574,7 +2575,7 @@ bool QWindowsVistaStylePrivate::resolveSymbols()
static bool tried = false;
if (!tried) {
tried = true;
- QLibrary themeLib(QLatin1String("uxtheme"));
+ QSystemLibrary themeLib(QLatin1String("uxtheme"));
pSetWindowTheme = (PtrSetWindowTheme )themeLib.resolve("SetWindowTheme");
pIsThemePartDefined = (PtrIsThemePartDefined )themeLib.resolve("IsThemePartDefined");
pGetThemePartSize = (PtrGetThemePartSize )themeLib.resolve("GetThemePartSize");
diff --git a/src/gui/styles/qwindowsxpstyle.cpp b/src/gui/styles/qwindowsxpstyle.cpp
index 8743807016..d36011c9ca 100644
--- a/src/gui/styles/qwindowsxpstyle.cpp
+++ b/src/gui/styles/qwindowsxpstyle.cpp
@@ -48,7 +48,7 @@
#include <private/qapplication_p.h>
#include <private/qstylehelper_p.h>
#include <private/qwidget_p.h>
-#include <qlibrary.h>
+#include <private/qsystemlibrary_p.h>
#include <qpainter.h>
#include <qpaintengine.h>
#include <qwidget.h>
@@ -344,7 +344,7 @@ bool QWindowsXPStylePrivate::resolveSymbols()
static bool tried = false;
if (!tried) {
tried = true;
- QLibrary themeLib(QLatin1String("uxtheme"));
+ QSystemLibrary themeLib(QLatin1String("uxtheme"));
pIsAppThemed = (PtrIsAppThemed)themeLib.resolve("IsAppThemed");
if (pIsAppThemed) {
pIsThemeActive = (PtrIsThemeActive )themeLib.resolve("IsThemeActive");
diff --git a/src/gui/text/qfont_s60.cpp b/src/gui/text/qfont_s60.cpp
index ccd17a2123..d39f30a7c7 100644
--- a/src/gui/text/qfont_s60.cpp
+++ b/src/gui/text/qfont_s60.cpp
@@ -40,15 +40,21 @@
****************************************************************************/
#include "qfont.h"
+#include "qfont_p.h"
#include <private/qt_s60_p.h>
#include <private/qpixmap_s60_p.h>
#include "qmutex.h"
QT_BEGIN_NAMESPACE
-#if 1
#ifdef QT_NO_FREETYPE
Q_GLOBAL_STATIC(QMutex, lastResortFamilyMutex);
+extern QStringList qt_symbian_fontFamiliesOnFontServer(); // qfontdatabase_s60.cpp
+Q_GLOBAL_STATIC_WITH_INITIALIZER(QStringList, fontFamiliesOnFontServer, {
+ // We are only interested in the initial font families. No Application fonts.
+ // Therefore, we are allowed to cache the list.
+ x->append(qt_symbian_fontFamiliesOnFontServer());
+});
#endif // QT_NO_FREETYPE
QString QFont::lastResortFamily() const
@@ -70,7 +76,7 @@ QString QFont::lastResortFamily() const
lock.relock();
}
return family;
-#else
+#else // QT_NO_FREETYPE
// For the FreeType case we just hard code the face name, since otherwise on
// East Asian systems we may get a name for a stroke based (non-ttf) font.
@@ -82,15 +88,24 @@ QString QFont::lastResortFamily() const
return QLatin1String(isJapaneseOrChineseSystem?"Heisei Kaku Gothic S60":"Series 60 Sans");
#endif // QT_NO_FREETYPE
}
-#else // 0
-QString QFont::lastResortFamily() const
-{
- return QLatin1String("Series 60 Sans");
-}
-#endif // 0
QString QFont::defaultFamily() const
{
+#ifdef QT_NO_FREETYPE
+ switch(d->request.styleHint) {
+ case QFont::SansSerif: {
+ static const char* const preferredSansSerif[] = {"Nokia Sans S60", "Series 60 Sans"};
+ for (int i = 0; i < sizeof preferredSansSerif / sizeof preferredSansSerif[0]; ++i) {
+ const QString sansSerif = QLatin1String(preferredSansSerif[i]);
+ if (fontFamiliesOnFontServer()->contains(sansSerif))
+ return sansSerif;
+ }
+ }
+ // No break. Intentional fall through.
+ default:
+ return lastResortFamily();
+ }
+#endif // QT_NO_FREETYPE
return lastResortFamily();
}
diff --git a/src/gui/text/qfontdatabase_s60.cpp b/src/gui/text/qfontdatabase_s60.cpp
index 0b38aaba14..ec252cdb49 100644
--- a/src/gui/text/qfontdatabase_s60.cpp
+++ b/src/gui/text/qfontdatabase_s60.cpp
@@ -58,6 +58,21 @@
QT_BEGIN_NAMESPACE
+QStringList qt_symbian_fontFamiliesOnFontServer() // Also used in qfont_s60.cpp
+{
+ QStringList result;
+ QSymbianFbsHeapLock lock(QSymbianFbsHeapLock::Unlock);
+ const int numTypeFaces = S60->screenDevice()->NumTypefaces();
+ for (int i = 0; i < numTypeFaces; i++) {
+ TTypefaceSupport typefaceSupport;
+ S60->screenDevice()->TypefaceSupport(typefaceSupport, i);
+ const QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length());
+ result.append(familyName);
+ }
+ lock.relock();
+ return result;
+}
+
QFileInfoList alternativeFilePaths(const QString &path, const QStringList &nameFilters,
QDir::Filters filters = QDir::NoFilter, QDir::SortFlags sort = QDir::NoSort,
bool uniqueFileNames = true)
@@ -99,6 +114,7 @@ public:
~QSymbianFontDatabaseExtrasImplementation();
const QSymbianTypeFaceExtras *extras(const QString &typeface, bool bold, bool italic) const;
+ void addFontFileToFontStore(const QFileInfo &fontFileInfo);
#ifndef Q_SYMBIAN_HAS_FONTTABLE_API
struct CFontFromFontStoreReleaser {
@@ -150,11 +166,8 @@ QSymbianFontDatabaseExtrasImplementation::QSymbianFontDatabaseExtrasImplementati
m_store->InstallRasterizerL(m_rasterizer);
CleanupStack::Pop(m_rasterizer););
- foreach (const QFileInfo &fontFileInfo, fontFiles) {
- const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath());
- TPtrC fontFilePtr(qt_QString2TPtrC(fontFile));
- QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr));
- }
+ foreach (const QFileInfo &fontFileInfo, fontFiles)
+ addFontFileToFontStore(fontFileInfo);
#endif // !Q_SYMBIAN_HAS_FONTTABLE_API
}
@@ -250,6 +263,14 @@ const QSymbianTypeFaceExtras *QSymbianFontDatabaseExtrasImplementation::extras(c
}
return m_extrasHash.value(searchKey);
}
+
+void QSymbianFontDatabaseExtrasImplementation::addFontFileToFontStore(const QFileInfo &fontFileInfo)
+{
+ const QString fontFile = QDir::toNativeSeparators(fontFileInfo.absoluteFilePath());
+ TPtrC fontFilePtr(qt_QString2TPtrC(fontFile));
+ QT_TRAP_THROWING(m_store->AddFileL(fontFilePtr));
+}
+
#else // QT_NO_FREETYPE
class QFontEngineFTS60 : public QFontEngineFT
{
@@ -310,6 +331,57 @@ void QFontEngineMultiS60::loadEngine(int at)
Q_ASSERT(engines[at]);
}
+static bool addFontToScreenDevice(int screenDeviceFontIndex,
+ const QSymbianFontDatabaseExtrasImplementation *dbExtras)
+{
+ TTypefaceSupport typefaceSupport;
+ S60->screenDevice()->TypefaceSupport(typefaceSupport, screenDeviceFontIndex);
+ CFont *font; // We have to get a font instance in order to know all the details
+ TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11);
+ if (S60->screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
+ return false;
+ QScopedPointer<CFont, QSymbianFontDatabaseExtrasImplementation::CFontFromScreenDeviceReleaser> sFont(font);
+ if (font->TypeUid() != KCFbsFontUid)
+ return false;
+ TOpenFontFaceAttrib faceAttrib;
+ const CFbsFont *cfbsFont = static_cast<const CFbsFont *>(font);
+ cfbsFont->GetFaceAttrib(faceAttrib);
+
+ QtFontStyle::Key styleKey;
+ styleKey.style = faceAttrib.IsItalic()?QFont::StyleItalic:QFont::StyleNormal;
+ styleKey.weight = faceAttrib.IsBold()?QFont::Bold:QFont::Normal;
+
+ QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length());
+ QtFontFamily *family = privateDb()->family(familyName, true);
+ family->fixedPitch = faceAttrib.IsMonoWidth();
+ QtFontFoundry *foundry = family->foundry(QString(), true);
+ QtFontStyle *style = foundry->style(styleKey, true);
+ style->smoothScalable = typefaceSupport.iIsScalable;
+ style->pixelSize(0, true);
+
+ const QSymbianTypeFaceExtras *typeFaceExtras =
+ dbExtras->extras(familyName, faceAttrib.IsBold(), faceAttrib.IsItalic());
+ const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
+ const unsigned char* data = reinterpret_cast<const unsigned char*>(os2Table.constData());
+ const unsigned char* ulUnicodeRange = data + 42;
+ quint32 unicodeRange[4] = {
+ qFromBigEndian<quint32>(ulUnicodeRange),
+ qFromBigEndian<quint32>(ulUnicodeRange + 4),
+ qFromBigEndian<quint32>(ulUnicodeRange + 8),
+ qFromBigEndian<quint32>(ulUnicodeRange + 12)
+ };
+ const unsigned char* ulCodePageRange = data + 78;
+ quint32 codePageRange[2] = {
+ qFromBigEndian<quint32>(ulCodePageRange),
+ qFromBigEndian<quint32>(ulCodePageRange + 4)
+ };
+ const QList<QFontDatabase::WritingSystem> writingSystems =
+ determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
+ foreach (const QFontDatabase::WritingSystem system, writingSystems)
+ family->writingSystems[system] = QtFontFamily::Supported;
+ return true;
+}
+
static void initializeDb()
{
QFontDatabasePrivate *db = privateDb();
@@ -325,59 +397,9 @@ static void initializeDb()
const int numTypeFaces = S60->screenDevice()->NumTypefaces();
const QSymbianFontDatabaseExtrasImplementation *dbExtras =
static_cast<const QSymbianFontDatabaseExtrasImplementation*>(db->symbianExtras);
- bool fontAdded = false;
- for (int i = 0; i < numTypeFaces; i++) {
- TTypefaceSupport typefaceSupport;
- S60->screenDevice()->TypefaceSupport(typefaceSupport, i);
- CFont *font; // We have to get a font instance in order to know all the details
- TFontSpec fontSpec(typefaceSupport.iTypeface.iName, 11);
- if (S60->screenDevice()->GetNearestFontInPixels(font, fontSpec) != KErrNone)
- continue;
- QScopedPointer<CFont, QSymbianFontDatabaseExtrasImplementation::CFontFromScreenDeviceReleaser> sFont(font);
- if (font->TypeUid() == KCFbsFontUid) {
- TOpenFontFaceAttrib faceAttrib;
- const CFbsFont *cfbsFont = static_cast<const CFbsFont *>(font);
- cfbsFont->GetFaceAttrib(faceAttrib);
-
- QtFontStyle::Key styleKey;
- styleKey.style = faceAttrib.IsItalic()?QFont::StyleItalic:QFont::StyleNormal;
- styleKey.weight = faceAttrib.IsBold()?QFont::Bold:QFont::Normal;
-
- QString familyName((const QChar *)typefaceSupport.iTypeface.iName.Ptr(), typefaceSupport.iTypeface.iName.Length());
- QtFontFamily *family = db->family(familyName, true);
- family->fixedPitch = faceAttrib.IsMonoWidth();
- QtFontFoundry *foundry = family->foundry(QString(), true);
- QtFontStyle *style = foundry->style(styleKey, true);
- style->smoothScalable = typefaceSupport.iIsScalable;
- style->pixelSize(0, true);
-
- const QSymbianTypeFaceExtras *typeFaceExtras =
- dbExtras->extras(familyName, faceAttrib.IsBold(), faceAttrib.IsItalic());
- const QByteArray os2Table = typeFaceExtras->getSfntTable(MAKE_TAG('O', 'S', '/', '2'));
- const unsigned char* data = reinterpret_cast<const unsigned char*>(os2Table.constData());
- const unsigned char* ulUnicodeRange = data + 42;
- quint32 unicodeRange[4] = {
- qFromBigEndian<quint32>(ulUnicodeRange),
- qFromBigEndian<quint32>(ulUnicodeRange + 4),
- qFromBigEndian<quint32>(ulUnicodeRange + 8),
- qFromBigEndian<quint32>(ulUnicodeRange + 12)
- };
- const unsigned char* ulCodePageRange = data + 78;
- quint32 codePageRange[2] = {
- qFromBigEndian<quint32>(ulCodePageRange),
- qFromBigEndian<quint32>(ulCodePageRange + 4)
- };
- const QList<QFontDatabase::WritingSystem> writingSystems =
- determineWritingSystemsFromTrueTypeBits(unicodeRange, codePageRange);
- foreach (const QFontDatabase::WritingSystem system, writingSystems)
- family->writingSystems[system] = QtFontFamily::Supported;
-
- fontAdded = true;
- }
- }
+ for (int i = 0; i < numTypeFaces; i++)
+ addFontToScreenDevice(i, dbExtras);
- Q_ASSERT(fontAdded);
-
lock.relock();
#else // QT_NO_FREETYPE
diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp
index c50d363d94..8a03c5d75e 100644
--- a/src/gui/text/qfontdatabase_win.cpp
+++ b/src/gui/text/qfontdatabase_win.cpp
@@ -45,7 +45,7 @@
#include "qfont_p.h"
#include "qfontengine_p.h"
#include "qpaintdevice.h"
-#include "qlibrary.h"
+#include <private/qsystemlibrary_p.h>
#include "qabstractfileengine.h"
#include "qendian.h"
@@ -1049,7 +1049,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
{
if(!fnt->data.isEmpty()) {
#ifndef Q_OS_WINCE
- PtrAddFontMemResourceEx ptrAddFontMemResourceEx = (PtrAddFontMemResourceEx)QLibrary::resolve(QLatin1String("gdi32"),
+ PtrAddFontMemResourceEx ptrAddFontMemResourceEx = (PtrAddFontMemResourceEx)QSystemLibrary::resolve(QLatin1String("gdi32"),
"AddFontMemResourceEx");
if (!ptrAddFontMemResourceEx)
return;
@@ -1111,7 +1111,7 @@ static void registerFont(QFontDatabasePrivate::ApplicationFont *fnt)
if (AddFontResource((LPCWSTR)fnt->fileName.utf16()) == 0)
return;
#else
- PtrAddFontResourceExW ptrAddFontResourceExW = (PtrAddFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"),
+ PtrAddFontResourceExW ptrAddFontResourceExW = (PtrAddFontResourceExW)QSystemLibrary::resolve(QLatin1String("gdi32"),
"AddFontResourceExW");
if (!ptrAddFontResourceExW
|| ptrAddFontResourceExW((wchar_t*)fnt->fileName.utf16(), FR_PRIVATE, 0) == 0)
@@ -1140,7 +1140,7 @@ bool QFontDatabase::removeApplicationFont(int handle)
if (!removeSucceeded)
return false;
#else
- PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)QLibrary::resolve(QLatin1String("gdi32"),
+ PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx = (PtrRemoveFontMemResourceEx)QSystemLibrary::resolve(QLatin1String("gdi32"),
"RemoveFontMemResourceEx");
if (!ptrRemoveFontMemResourceEx
|| !ptrRemoveFontMemResourceEx(font.handle))
@@ -1151,7 +1151,7 @@ bool QFontDatabase::removeApplicationFont(int handle)
if (!RemoveFontResource((LPCWSTR)font.fileName.utf16()))
return false;
#else
- PtrRemoveFontResourceExW ptrRemoveFontResourceExW = (PtrRemoveFontResourceExW)QLibrary::resolve(QLatin1String("gdi32"),
+ PtrRemoveFontResourceExW ptrRemoveFontResourceExW = (PtrRemoveFontResourceExW)QSystemLibrary::resolve(QLatin1String("gdi32"),
"RemoveFontResourceExW");
if (!ptrRemoveFontResourceExW
|| !ptrRemoveFontResourceExW((LPCWSTR)font.fileName.utf16(), FR_PRIVATE, 0))
diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp
index 1c705ae911..398029b741 100644
--- a/src/gui/text/qfontengine.cpp
+++ b/src/gui/text/qfontengine.cpp
@@ -874,8 +874,8 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
enum {
Invalid,
- Symbol,
AppleRoman,
+ Symbol,
Unicode11,
Unicode,
MicrosoftUnicode,
@@ -939,7 +939,7 @@ const uchar *QFontEngine::getCMap(const uchar *table, uint tableSize, bool *isSy
return 0;
resolveTable:
- *isSymbolFont = (score == Symbol);
+ *isSymbolFont = (symbolTable > -1);
unsigned int unicode_table = qFromBigEndian<quint32>(maps + 8*tableToUse + 4);
@@ -1093,6 +1093,18 @@ const QVector<QRgb> &QFontEngine::grayPalette()
return *qt_grayPalette();
}
+QFixed QFontEngine::lastRightBearing(const QGlyphLayout &glyphs, bool round)
+{
+ if (glyphs.numGlyphs >= 1) {
+ glyph_t glyph = glyphs.glyphs[glyphs.numGlyphs - 1];
+ glyph_metrics_t gi = boundingBox(glyph);
+ if (gi.isValid())
+ return round ? QFixed(qRound(gi.xoff - gi.x - gi.width))
+ : QFixed(gi.xoff - gi.x - gi.width);
+ }
+ return 0;
+}
+
// ------------------------------------------------------------------
// The box font engine
// ------------------------------------------------------------------
diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp
index 1ee714444b..814ad21650 100644
--- a/src/gui/text/qfontengine_ft.cpp
+++ b/src/gui/text/qfontengine_ft.cpp
@@ -94,6 +94,13 @@ QT_BEGIN_NAMESPACE
#define Y_SIZE(face,i) ((face)->available_sizes[i].height << 6)
#endif
+/* FreeType 2.1.10 starts to provide FT_GlyphSlot_Embolden */
+#if (FREETYPE_MAJOR*10000+FREETYPE_MINOR*100+FREETYPE_PATCH) >= 20110
+#define Q_FT_GLYPHSLOT_EMBOLDEN(slot) FT_GlyphSlot_Embolden(slot)
+#else
+#define Q_FT_GLYPHSLOT_EMBOLDEN(slot)
+#endif
+
#define FLOOR(x) ((x) & -64)
#define CEIL(x) (((x)+63) & -64)
#define TRUNC(x) ((x) >> 6)
@@ -799,7 +806,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyphMetrics(QGlyphSet *set, uint glyph
}
FT_GlyphSlot slot = face->glyph;
- if (embolden) FT_GlyphSlot_Embolden(slot);
+ if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot);
int left = slot->metrics.horiBearingX;
int right = slot->metrics.horiBearingX + slot->metrics.width;
int top = slot->metrics.horiBearingY;
@@ -945,7 +952,7 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, Glyph
return 0;
FT_GlyphSlot slot = face->glyph;
- if (embolden) FT_GlyphSlot_Embolden(slot);
+ if (embolden) Q_FT_GLYPHSLOT_EMBOLDEN(slot);
FT_Library library = qt_getFreetype();
info.xOff = TRUNC(ROUND(slot->advance.x));
@@ -1563,8 +1570,6 @@ bool QFontEngineFT::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs
FT_Face face = freetype->face;
for ( int i = 0; i < len; ++i ) {
unsigned int uc = getChar(str, i, len);
- if (mirrored)
- uc = QChar::mirroredChar(uc);
glyphs->glyphs[glyph_pos] = uc < QFreetypeFace::cmapCacheSize ? freetype->cmapCache[uc] : 0;
if ( !glyphs->glyphs[glyph_pos] ) {
glyph_t glyph;
diff --git a/src/gui/text/qfontengine_mac.mm b/src/gui/text/qfontengine_mac.mm
index 91b608253a..bdf3848b71 100644
--- a/src/gui/text/qfontengine_mac.mm
+++ b/src/gui/text/qfontengine_mac.mm
@@ -455,12 +455,13 @@ bool QCoreTextFontEngine::stringToCMap(const QChar *, int, QGlyphLayout *, int *
glyph_metrics_t QCoreTextFontEngine::boundingBox(const QGlyphLayout &glyphs)
{
QFixed w;
+ bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics;
+
for (int i = 0; i < glyphs.numGlyphs; ++i) {
- w += (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? glyphs.effectiveAdvance(i).round()
- : glyphs.effectiveAdvance(i);
+ w += round ? glyphs.effectiveAdvance(i).round()
+ : glyphs.effectiveAdvance(i);
}
- return glyph_metrics_t(0, -(ascent()), w, ascent()+descent(), w, 0);
+ return glyph_metrics_t(0, -(ascent()), w - lastRightBearing(glyphs, round), ascent()+descent(), w, 0);
}
glyph_metrics_t QCoreTextFontEngine::boundingBox(glyph_t glyph)
{
@@ -1480,12 +1481,12 @@ void QFontEngineMac::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFla
glyph_metrics_t QFontEngineMac::boundingBox(const QGlyphLayout &glyphs)
{
QFixed w;
+ bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics;
for (int i = 0; i < glyphs.numGlyphs; ++i) {
- w += (fontDef.styleStrategy & QFont::ForceIntegerMetrics)
- ? glyphs.effectiveAdvance(i).round()
- : glyphs.effectiveAdvance(i);
+ w += round ? glyphs.effectiveAdvance(i).round()
+ : glyphs.effectiveAdvance(i);
}
- return glyph_metrics_t(0, -(ascent()), w, ascent()+descent(), w, 0);
+ return glyph_metrics_t(0, -(ascent()), w - lastRightBearing(glyphs, round), ascent()+descent(), w, 0);
}
glyph_metrics_t QFontEngineMac::boundingBox(glyph_t glyph)
diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h
index 897f76f774..48f3ce0035 100644
--- a/src/gui/text/qfontengine_p.h
+++ b/src/gui/text/qfontengine_p.h
@@ -253,6 +253,7 @@ public:
protected:
static const QVector<QRgb> &grayPalette();
+ QFixed lastRightBearing(const QGlyphLayout &glyphs, bool round = false);
private:
struct GlyphCacheEntry {
diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp
index a0593cc478..53b6910ee0 100644
--- a/src/gui/text/qfontengine_qpf.cpp
+++ b/src/gui/text/qfontengine_qpf.cpp
@@ -578,8 +578,6 @@ bool QFontEngineQPF::stringToCMap(const QChar *str, int len, QGlyphLayout *glyph
if (symbol) {
for (int i = 0; i < len; ++i) {
unsigned int uc = getChar(str, i, len);
- if (mirrored)
- uc = QChar::mirroredChar(uc);
glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc);
if(!glyphs->glyphs[glyph_pos] && uc < 0x100)
glyphs->glyphs[glyph_pos] = getTrueTypeGlyphIndex(cmap, uc + 0xf000);
diff --git a/src/gui/text/qfontengine_qws.cpp b/src/gui/text/qfontengine_qws.cpp
index a7a95d07ba..decc89c503 100644
--- a/src/gui/text/qfontengine_qws.cpp
+++ b/src/gui/text/qfontengine_qws.cpp
@@ -557,7 +557,7 @@ glyph_metrics_t QFontEngineQPF1::boundingBox(const QGlyphLayout &glyphs)
QFixed w = 0;
for (int i = 0; i < glyphs.numGlyphs; ++i)
w += glyphs.effectiveAdvance(i);
- return glyph_metrics_t(0, -ascent(), w, ascent()+descent()+1, w, 0);
+ return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0);
}
glyph_metrics_t QFontEngineQPF1::boundingBox(glyph_t glyph)
diff --git a/src/gui/text/qfontengine_s60.cpp b/src/gui/text/qfontengine_s60.cpp
index 52a1fe70b1..5980f201d3 100644
--- a/src/gui/text/qfontengine_s60.cpp
+++ b/src/gui/text/qfontengine_s60.cpp
@@ -166,6 +166,11 @@ const uchar *QSymbianTypeFaceExtras::cmap() const
return reinterpret_cast<const uchar *>(m_cmapTable.constData());
}
+bool QSymbianTypeFaceExtras::isSymbolCMap() const
+{
+ return m_symbolCMap;
+}
+
CFont *QSymbianTypeFaceExtras::fontOwner() const
{
return m_cFont;
@@ -256,7 +261,7 @@ bool QFontEngineS60::stringToCMap(const QChar *characters, int len, QGlyphLayout
for (int i = 0; i < len; ++i) {
const unsigned int uc = getChar(characters, i, len);
*g++ = QFontEngine::getTrueTypeGlyphIndex(cmap,
- isRtl ? QChar::mirroredChar(uc) : uc);
+ (isRtl && !m_extras->isSymbolCMap()) ? QChar::mirroredChar(uc) : uc);
}
glyphs->numGlyphs = g - glyphs->glyphs;
@@ -345,7 +350,7 @@ glyph_metrics_t QFontEngineS60::boundingBox(const QGlyphLayout &glyphs)
for (int i = 0; i < glyphs.numGlyphs; ++i)
w += glyphs.effectiveAdvance(i);
- return glyph_metrics_t(0, -ascent(), w, ascent()+descent()+1, w, 0);
+ return glyph_metrics_t(0, -ascent(), w - lastRightBearing(glyphs), ascent()+descent()+1, w, 0);
}
glyph_metrics_t QFontEngineS60::boundingBox_const(glyph_t glyph) const
diff --git a/src/gui/text/qfontengine_s60_p.h b/src/gui/text/qfontengine_s60_p.h
index d65f13bbe5..d05c23c4e0 100644
--- a/src/gui/text/qfontengine_s60_p.h
+++ b/src/gui/text/qfontengine_s60_p.h
@@ -81,6 +81,7 @@ public:
bool getSfntTableData(uint tag, uchar *buffer, uint *length) const;
const uchar *cmap() const;
CFont *fontOwner() const;
+ bool isSymbolCMap() const;
private:
CFont* m_cFont;
diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp
index a805612ac4..82de0d5ac0 100644
--- a/src/gui/text/qfontengine_win.cpp
+++ b/src/gui/text/qfontengine_win.cpp
@@ -50,7 +50,7 @@
#include "qt_windows.h"
#include <private/qapplication_p.h>
-#include <qlibrary.h>
+#include <private/qsystemlibrary_p.h>
#include <qpaintdevice.h>
#include <qpainter.h>
#include <limits.h>
@@ -140,7 +140,7 @@ static void resolveGetCharWidthI()
if (resolvedGetCharWidthI)
return;
resolvedGetCharWidthI = true;
- ptrGetCharWidthI = (PtrGetCharWidthI)QLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI");
+ ptrGetCharWidthI = (PtrGetCharWidthI)QSystemLibrary::resolve(QLatin1String("gdi32"), "GetCharWidthI");
}
#endif // !defined(Q_WS_WINCE)
@@ -487,7 +487,7 @@ glyph_metrics_t QFontEngineWin::boundingBox(const QGlyphLayout &glyphs)
for (int i = 0; i < glyphs.numGlyphs; ++i)
w += glyphs.effectiveAdvance(i);
- return glyph_metrics_t(0, -tm.tmAscent, w, tm.tmHeight, w, 0);
+ return glyph_metrics_t(0, -tm.tmAscent, w - lastRightBearing(glyphs), tm.tmHeight, w, 0);
}
#ifndef Q_WS_WINCE
diff --git a/src/gui/text/qstatictext.cpp b/src/gui/text/qstatictext.cpp
index 21c2e0246c..b950b13028 100644
--- a/src/gui/text/qstatictext.cpp
+++ b/src/gui/text/qstatictext.cpp
@@ -400,9 +400,9 @@ QStaticTextPrivate::QStaticTextPrivate()
QStaticTextPrivate::QStaticTextPrivate(const QStaticTextPrivate &other)
: text(other.text), font(other.font), textWidth(other.textWidth), matrix(other.matrix),
- items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), needsRelayout(true),
- useBackendOptimizations(other.useBackendOptimizations), textFormat(other.textFormat),
- untransformedCoordinates(other.untransformedCoordinates)
+ items(0), itemCount(0), glyphPool(0), positionPool(0), charPool(0), textOption(other.textOption),
+ needsRelayout(true), useBackendOptimizations(other.useBackendOptimizations),
+ textFormat(other.textFormat), untransformedCoordinates(other.untransformedCoordinates)
{
}
diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp
index 8d6dd6ced6..05de8f5ad8 100644
--- a/src/gui/text/qtextengine.cpp
+++ b/src/gui/text/qtextengine.cpp
@@ -1646,7 +1646,6 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const
for (int i = 0; i < layoutData->items.size(); i++) {
const QScriptItem *si = layoutData->items.constData() + i;
- QFontEngine *fe = fontEngine(*si);
int pos = si->position;
int ilen = length(i);
@@ -1676,6 +1675,7 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const
while (charFrom < ilen && logClusters[charFrom] == glyphStart)
charFrom++;
if (charFrom < ilen) {
+ QFontEngine *fe = fontEngine(*si);
glyphStart = logClusters[charFrom];
int charEnd = from + len - 1 - pos;
if (charEnd >= ilen)
@@ -1694,11 +1694,6 @@ glyph_metrics_t QTextEngine::boundingBox(int from, int len) const
gm.yoff += m.yoff;
}
}
-
- glyph_t glyph = glyphs.glyphs[logClusters[ilen - 1]];
- glyph_metrics_t gi = fe->boundingBox(glyph);
- if (gi.isValid())
- gm.width -= qRound(gi.xoff - gi.x - gi.width);
}
}
return gm;
@@ -2144,8 +2139,11 @@ bool QTextEngine::LayoutData::reallocate(int totalGlyphs)
void **newMem = memory;
newMem = (void **)::realloc(memory_on_stack ? 0 : memory, newAllocated*sizeof(void *));
- Q_CHECK_PTR(newMem);
- if (memory_on_stack && newMem)
+ if (!newMem) {
+ layoutState = LayoutFailed;
+ return false;
+ }
+ if (memory_on_stack)
memcpy(newMem, memory, allocated*sizeof(void *));
memory = newMem;
memory_on_stack = false;
@@ -2265,6 +2263,9 @@ bool QTextEngine::atWordSeparator(int position) const
case ',':
case '?':
case '!':
+ case '@':
+ case '#':
+ case '$':
case ':':
case ';':
case '-':
@@ -2285,6 +2286,7 @@ bool QTextEngine::atWordSeparator(int position) const
case '*':
case '\'':
case '"':
+ case '`':
case '~':
case '|':
return true;
diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp
index 24f6ccfb8f..cd023cb360 100644
--- a/src/gui/util/qdesktopservices_s60.cpp
+++ b/src/gui/util/qdesktopservices_s60.cpp
@@ -223,6 +223,7 @@ static void handleOtherSchemesL(const TDesC& aUrl)
TApaTask task = taskList.FindApp(KUidBrowser);
if (task.Exists()){
// Switch to existing browser instance
+ task.BringToForeground();
HBufC8* param8 = HBufC8::NewLC(buf16->Length());
param8->Des().Append(buf16->Des());
task.SendMessage(TUid::Uid( 0 ), *param8); // Uid is not used
diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp
index aab7e16631..735de0419e 100644
--- a/src/gui/util/qdesktopservices_win.cpp
+++ b/src/gui/util/qdesktopservices_win.cpp
@@ -41,7 +41,7 @@
#include <qsettings.h>
#include <qdir.h>
-#include <qlibrary.h>
+#include <private/qsystemlibrary_p.h>
#include <qurl.h>
#include <qstringlist.h>
#include <qprocess.h>
@@ -177,9 +177,9 @@ QString QDesktopServices::storageLocation(StandardLocation type)
QString result;
#ifndef Q_OS_WINCE
- QLibrary library(QLatin1String("shell32"));
+ QSystemLibrary library(QLatin1String("shell32"));
#else
- QLibrary library(QLatin1String("coredll"));
+ QSystemLibrary library(QLatin1String("coredll"));
#endif // Q_OS_WINCE
typedef BOOL (WINAPI*GetSpecialFolderPath)(HWND, LPWSTR, int, BOOL);
static GetSpecialFolderPath SHGetSpecialFolderPath =
diff --git a/src/gui/util/qsystemtrayicon_win.cpp b/src/gui/util/qsystemtrayicon_win.cpp
index a9585b994a..fc5de44ee6 100644
--- a/src/gui/util/qsystemtrayicon_win.cpp
+++ b/src/gui/util/qsystemtrayicon_win.cpp
@@ -54,7 +54,7 @@
#include <windowsx.h>
#include <commctrl.h>
-#include <QLibrary>
+#include <private/qsystemlibrary_p.h>
#include <QApplication>
#include <QSettings>
@@ -155,14 +155,14 @@ QSystemTrayIconSys::QSystemTrayIconSys(QSystemTrayIcon *object)
// Allow the WM_TASKBARCREATED message through the UIPI filter on Windows Vista and higher
static PtrChangeWindowMessageFilterEx pChangeWindowMessageFilterEx =
- (PtrChangeWindowMessageFilterEx)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
+ (PtrChangeWindowMessageFilterEx)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilterEx");
if (pChangeWindowMessageFilterEx) {
// Call the safer ChangeWindowMessageFilterEx API if available
pChangeWindowMessageFilterEx(winId(), MYWM_TASKBARCREATED, Q_MSGFLT_ALLOW, 0);
} else {
static PtrChangeWindowMessageFilter pChangeWindowMessageFilter =
- (PtrChangeWindowMessageFilter)QLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
+ (PtrChangeWindowMessageFilter)QSystemLibrary::resolve(QLatin1String("user32"), "ChangeWindowMessageFilter");
if (pChangeWindowMessageFilter) {
// Call the deprecated ChangeWindowMessageFilter API otherwise
@@ -350,7 +350,7 @@ void QSystemTrayIconPrivate::install_sys()
QRect QSystemTrayIconSys::findIconGeometry(const int iconId)
{
static PtrShell_NotifyIconGetRect Shell_NotifyIconGetRect =
- (PtrShell_NotifyIconGetRect)QLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect");
+ (PtrShell_NotifyIconGetRect)QSystemLibrary::resolve(QLatin1String("shell32"), "Shell_NotifyIconGetRect");
if (Shell_NotifyIconGetRect) {
Q_NOTIFYICONIDENTIFIER nid;
diff --git a/src/gui/widgets/qcombobox.cpp b/src/gui/widgets/qcombobox.cpp
index 917a325ead..96d2acdd06 100644
--- a/src/gui/widgets/qcombobox.cpp
+++ b/src/gui/widgets/qcombobox.cpp
@@ -2849,7 +2849,8 @@ void QComboBox::mousePressEvent(QMouseEvent *e)
if (sc == QStyle::SC_ComboBoxArrow)
d->updateArrow(QStyle::State_Sunken);
#ifdef QT_KEYPAD_NAVIGATION
- if (!d->lineEdit) {
+ //if the container already exists, then d->viewContainer() is safe to call
+ if (d->container) {
#endif
// We've restricted the next couple of lines, because by not calling
// viewContainer(), we avoid creating the QComboBoxPrivateContainer.
diff --git a/src/gui/widgets/qdatetimeedit.cpp b/src/gui/widgets/qdatetimeedit.cpp
index 7a61dc7e01..bd6c57703d 100644
--- a/src/gui/widgets/qdatetimeedit.cpp
+++ b/src/gui/widgets/qdatetimeedit.cpp
@@ -248,7 +248,7 @@ void QDateTimeEdit::setDateTime(const QDateTime &datetime)
/*!
\property QDateTimeEdit::date
- \brief the QDate that is set in the QDateTimeEdit
+ \brief the QDate that is set in the widget
By default, this property contains a date that refers to January 1, 2000.
@@ -279,7 +279,7 @@ void QDateTimeEdit::setDate(const QDate &date)
/*!
\property QDateTimeEdit::time
- \brief the QTime that is set in the QDateTimeEdit
+ \brief the QTime that is set in the widget
By default, this property contains a time of 00:00:00 and 0 milliseconds.
@@ -1555,13 +1555,6 @@ QTimeEdit::QTimeEdit(const QTime &time, QWidget *parent)
{
}
-/*!
- \property QTimeEdit::time
- \brief the QTime that is shown in the widget
-
- By default, this property contains a time of 00:00:00 and 0 milliseconds.
-*/
-
/*!
\class QDateEdit
@@ -1616,13 +1609,6 @@ QDateEdit::QDateEdit(const QDate &date, QWidget *parent)
{
}
-/*!
- \property QDateEdit::date
- \brief the QDate that is shown in the widget
-
- By default, this property contains a date referring to January 1, 2000.
-*/
-
// --- QDateTimeEditPrivate ---
diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp
index 6ed621ba0b..f742d32f9f 100644
--- a/src/gui/widgets/qlinecontrol.cpp
+++ b/src/gui/widgets/qlinecontrol.cpp
@@ -419,7 +419,7 @@ void QLineControl::processInputMethodEvent(QInputMethodEvent *event)
int c = m_cursor; // cursor position after insertion of commit string
- if (event->replacementStart() == 0)
+ if (event->replacementStart() <= 0)
c += event->commitString().length() + qMin(-event->replacementStart(), event->replacementLength());
m_cursor += event->replacementStart();
@@ -527,7 +527,7 @@ void QLineControl::draw(QPainter *painter, const QPoint &offset, const QRect &cl
int cursor = m_cursor;
if (m_preeditCursor != -1)
cursor += m_preeditCursor;
- if(!m_blinkPeriod || m_blinkStatus)
+ if (!m_hideCursor && (!m_blinkPeriod || m_blinkStatus))
m_textLayout.drawCursor(painter, offset, cursor, m_cursorWidth);
}
}
diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp
index 981e934ecf..caaef6866e 100644
--- a/src/gui/widgets/qlineedit.cpp
+++ b/src/gui/widgets/qlineedit.cpp
@@ -1929,7 +1929,11 @@ void QLineEdit::paintEvent(QPaintEvent *)
// text doesn't fit, text document is to the left of lineRect; align
// right
d->hscroll = widthUsed - lineRect.width() + 1;
+ } else {
+ //in case the text is bigger than the lineedit, the hscroll can never be negative
+ d->hscroll = qMax(0, d->hscroll);
}
+
// the y offset is there to keep the baseline constant in case we have script changes in the text.
QPoint topLeft = lineRect.topLeft() - QPoint(d->hscroll, d->control->ascent() - fm.ascent());