From f4c0ea2554253bf5055be61e8f94078227b07298 Mon Sep 17 00:00:00 2001 From: Andy Nichols Date: Thu, 4 May 2017 16:32:56 +0300 Subject: Software: Fix leaking of SGTextures Task-number: QTBUG-59865 Change-Id: I18911734b34e535c2c77d5a860bd776105617663 Reviewed-by: Laszlo Agocs --- src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp index 1fa5234377..384c124a02 100644 --- a/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp +++ b/src/quick/scenegraph/adaptations/software/qsgsoftwarepublicnodes.cpp @@ -74,6 +74,9 @@ QSGSoftwareImageNode::~QSGSoftwareImageNode() void QSGSoftwareImageNode::setTexture(QSGTexture *texture) { + if (m_owns) + delete m_texture; + m_texture = texture; markDirty(DirtyMaterial); m_cachedMirroredPixmapIsDirty = true; } -- cgit v1.2.3 From 7bf3f99ceca5818596c7dd03d6053ea40aa262b3 Mon Sep 17 00:00:00 2001 From: Arnaud Vrac Date: Thu, 27 Apr 2017 18:56:02 +0200 Subject: qquickpixmapcache: fix crash when loading images asynchronously Use copied data instead of data that might be destroyed. This was already fixed in most places in commit 22c39eda8ab316c. Change-Id: Ie31ebb2e53945dd66ce3d0114629c284407ff26c Reviewed-by: Albert Astals Cid Reviewed-by: Shawn Rutledge Reviewed-by: Robin Burchell --- src/quick/util/qquickpixmapcache.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/util/qquickpixmapcache.cpp b/src/quick/util/qquickpixmapcache.cpp index 402897ca7a..882482ad31 100644 --- a/src/quick/util/qquickpixmapcache.cpp +++ b/src/quick/util/qquickpixmapcache.cpp @@ -497,7 +497,7 @@ void QQuickPixmapReader::networkRequestDone(QNetworkReply *reply) QByteArray all = reply->readAll(); QBuffer buff(&all); buff.open(QIODevice::ReadOnly); - if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, job->requestSize, job->data->providerOptions)) + if (!readImage(reply->url(), &buff, &image, &errorString, &readSize, job->requestSize, job->providerOptions)) error = QQuickPixmapReply::Decoding; } // send completion event to the QQuickPixmapReply -- cgit v1.2.3 From 7730affa0dd50960da90f30d41b694a9e9ddd52b Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Fri, 5 May 2017 15:21:40 +0200 Subject: Prospective build fix for architectures where we don't support the JIT Always export the isel factory method for qmlcachegen, so that we can link. Task-number: QTBUG-60597 Change-Id: Ia348ee5dfe0892878e8fce6c8afd30bb8eb54a51 Reviewed-by: Dmitry Shachnev Reviewed-by: Robin Burchell --- src/qml/jit/qv4isel_masm.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index 4afcd1517f..ac72d2e8f5 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -1631,14 +1631,20 @@ QQmlRefPointer ISelFactory::createU return result; } +#endif // ENABLE(ASSEMBLER) + QT_BEGIN_NAMESPACE namespace QV4 { namespace JIT { +#if ENABLE(ASSEMBLER) template class Q_QML_EXPORT InstructionSelection<>; template class Q_QML_EXPORT ISelFactory<>; +#endif + #if defined(V4_BOOTSTRAP) Q_QML_EXPORT QV4::EvalISelFactory *createISelForArchitecture(const QString &architecture) { +#if ENABLE(ASSEMBLER) using ARMv7CrossAssembler = QV4::JIT::Assembler>; using ARM64CrossAssembler = QV4::JIT::Assembler>; @@ -1659,6 +1665,7 @@ Q_QML_EXPORT QV4::EvalISelFactory *createISelForArchitecture(const QString &arch #endif if (!hostArch.isEmpty() && architecture == hostArch) return new ISelFactory<>; +#endif // ENABLE(ASSEMBLER) return nullptr; } @@ -1667,4 +1674,3 @@ Q_QML_EXPORT QV4::EvalISelFactory *createISelForArchitecture(const QString &arch } } QT_END_NAMESPACE -#endif // ENABLE(ASSEMBLER) -- cgit v1.2.3 From 7286b296f97d3394f3c2a716116bd483c9874931 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Thu, 4 May 2017 16:17:05 +0200 Subject: Touch child mouse filtering: pass not grabbed points inside item bounds c2ca2cbf04071ffb3aee6af8d5ab9084dfa1c091 started to restrict delivery of items in childMouseEventFilter by checking that we wouldn't deliver completely random points outside the item that were not grabbed by child items. That is generally correct. It did no longer send along touch points that had any other state but pressed but were inside when they had no grabber. That part was wrong, points must be sent along if they are not grabbed and inside the item. Task-number: QTBUG-60368 Change-Id: Ida24f5d2310d3b71db79ae5f95da2c57dcd3f150 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickevents.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/quick/items/qquickevents.cpp b/src/quick/items/qquickevents.cpp index ac0505da82..448b63c347 100644 --- a/src/quick/items/qquickevents.cpp +++ b/src/quick/items/qquickevents.cpp @@ -861,8 +861,9 @@ QTouchEvent *QQuickPointerTouchEvent::touchEventForItem(QQuickItem *item, bool i } parent = parent->parentItem(); } - bool filterRelevant = isFiltering && grabberIsChild; + // when filtering, send points that are grabbed by a child and points that are not grabbed but inside + bool filterRelevant = isFiltering && (grabberIsChild || (!p->grabber() && item->contains(item->mapFromScene(p->scenePos())))); if (!(isGrabber || isPressInside || filterRelevant)) continue; -- cgit v1.2.3 From 02830aae1f3e9aaf89ca37637d40313babbff7b8 Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Wed, 16 Nov 2016 16:30:39 +0100 Subject: Don't crash: Connections with a signal on a nonexistent object MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QTBUG-56551 Change-Id: Ide09f177d3f6a3e9902f8ea904b3e6e4b998bd39 Reviewed-by: Jan Arve Sæther --- src/qml/qml/qqmlpropertycache.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/qml/qml/qqmlpropertycache.cpp b/src/qml/qml/qqmlpropertycache.cpp index 88ce2fa1b9..d18159841c 100644 --- a/src/qml/qml/qqmlpropertycache.cpp +++ b/src/qml/qml/qqmlpropertycache.cpp @@ -970,8 +970,11 @@ int QQmlPropertyCache::originalClone(QObject *object, int index) QQmlData *data = QQmlData::get(object, false); if (data && data->propertyCache) { QQmlPropertyCache *cache = data->propertyCache; - while (cache->signal(index)->isCloned()) + QQmlPropertyData *sig = cache->signal(index); + while (sig && sig->isCloned()) { --index; + sig = cache->signal(index); + } } else { while (QMetaObjectPrivate::signal(object->metaObject(), index).attributes() & QMetaMethod::Cloned) --index; -- cgit v1.2.3 From 802a5be531a9f2b1396f4ea4715c9a1dc593f778 Mon Sep 17 00:00:00 2001 From: Frederik Gladhorn Date: Wed, 10 May 2017 10:09:56 +0200 Subject: Fix hover delivery in case of touch release events This fixes tst_TouchMouse::hoverEnabled. It turns out that the problem is that QQuickWindowPrivate::flushFrameSynchronousEvents would deliver artificial hover events which (due to the nature of the function) would arrive without being synchronized with the test. This should not be a problem as such, but there was one bug: the hover event would also be sent in case of a touch release event. The definition of when to "pretend hover" is a bit shaky, but we should definitely not send hover events after touch releases. By clearing lastMousePosition instead of setting it to where the touch point is released we no longer receive bogus events. Task-number: QTBUG-55350 Change-Id: I4dea54740e37182f66c4a729d7b06a1c770c34a9 Reviewed-by: Robin Burchell Reviewed-by: Simon Hausmann --- src/quick/items/qquickwindow.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index 98901ab818..bdb362e1ff 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -1979,8 +1979,14 @@ bool QQuickWindowPrivate::compressTouchEvent(QTouchEvent *event) void QQuickWindowPrivate::handleTouchEvent(QTouchEvent *event) { translateTouchEvent(event); - if (event->touchPoints().size()) - lastMousePosition = event->touchPoints().at(0).pos(); + if (event->touchPoints().size()) { + auto point = event->touchPoints().at(0); + if (point.state() == Qt::TouchPointReleased) { + lastMousePosition = QPointF(); + } else { + lastMousePosition = point.pos(); + } + } qCDebug(DBG_TOUCH) << event; -- cgit v1.2.3 From e0c30279ec1fad88346ed3fb483bc3c672fdd01b Mon Sep 17 00:00:00 2001 From: Jan Arve Saether Date: Mon, 8 May 2017 11:25:10 +0200 Subject: Move pointerEvent instance to QQuickWindow With two or more windows, if events are being delivered to each, the grabbers can be different in each. We need unique instances of the QQuickPointerEvent objects for each window to avoid losing the grab state in the parent window while delivering a synthesized event to a subwindow, for example. Change-Id: I51da1212d573853969e32ad78f5b219d979a8a5c Task-number: QTBUG-57253 Reviewed-by: Shawn Rutledge --- src/quick/items/qquickevents_p_p.h | 25 +++++------------- src/quick/items/qquickwindow.cpp | 52 ++++++++++++++++++++++++++++++-------- src/quick/items/qquickwindow_p.h | 4 +++ 3 files changed, 52 insertions(+), 29 deletions(-) (limited to 'src') diff --git a/src/quick/items/qquickevents_p_p.h b/src/quick/items/qquickevents_p_p.h index cf6f83e5b1..3735d68a85 100644 --- a/src/quick/items/qquickevents_p_p.h +++ b/src/quick/items/qquickevents_p_p.h @@ -332,9 +332,9 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerEvent : public QObject Q_PROPERTY(Qt::MouseButtons buttons READ buttons) public: - QQuickPointerEvent(QObject *parent = nullptr) + QQuickPointerEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) : QObject(parent) - , m_device(nullptr) + , m_device(device) , m_event(nullptr) , m_button(Qt::NoButton) , m_pressedButtons(Qt::NoButton) @@ -385,8 +385,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerMouseEvent : public QQuickPointerEvent { Q_OBJECT public: - QQuickPointerMouseEvent(QObject *parent = nullptr) - : QQuickPointerEvent(parent), m_mousePoint(new QQuickEventPoint(this)) { } + QQuickPointerMouseEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) + : QQuickPointerEvent(parent, device), m_mousePoint(new QQuickEventPoint(this)) { } QQuickPointerEvent *reset(QEvent *) override; bool isPressEvent() const override; @@ -411,8 +411,8 @@ class Q_QUICK_PRIVATE_EXPORT QQuickPointerTouchEvent : public QQuickPointerEvent { Q_OBJECT public: - QQuickPointerTouchEvent(QObject *parent = nullptr) - : QQuickPointerEvent(parent) + QQuickPointerTouchEvent(QObject *parent = nullptr, QQuickPointerDevice *device = nullptr) + : QQuickPointerEvent(parent, device) , m_pointCount(0) , m_synthMouseEvent(QEvent::MouseMove, QPointF(), Qt::NoButton, Qt::NoButton, Qt::NoModifier) { } @@ -500,18 +500,10 @@ public: QQuickPointerDevice(DeviceType devType, PointerType pType, Capabilities caps, int maxPoints, int buttonCount, const QString &name, qint64 uniqueId = 0) : m_deviceType(devType), m_pointerType(pType), m_capabilities(caps) , m_maximumTouchPoints(maxPoints), m_buttonCount(buttonCount), m_name(name) - , m_uniqueId(QPointingDeviceUniqueId::fromNumericId(uniqueId)), m_event(nullptr) + , m_uniqueId(QPointingDeviceUniqueId::fromNumericId(uniqueId)) { - if (m_deviceType == Mouse) { - m_event = new QQuickPointerMouseEvent; - } else if (m_deviceType == TouchScreen || m_deviceType == TouchPad) { - m_event = new QQuickPointerTouchEvent; - } else { - Q_ASSERT(false); - } } - ~QQuickPointerDevice() { delete m_event; } DeviceType type() const { return m_deviceType; } PointerType pointerType() const { return m_pointerType; } Capabilities capabilities() const { return m_capabilities; } @@ -520,7 +512,6 @@ public: int buttonCount() const { return m_buttonCount; } QString name() const { return m_name; } QPointingDeviceUniqueId uniqueId() const { return m_uniqueId; } - QQuickPointerEvent *pointerEvent() const { return m_event; } static QQuickPointerDevice *touchDevice(QTouchDevice *d); static QList touchDevices(); @@ -535,8 +526,6 @@ private: int m_buttonCount; QString m_name; QPointingDeviceUniqueId m_uniqueId; - // the device-specific event instance which is reused during event delivery - QQuickPointerEvent *m_event; Q_DISABLE_COPY(QQuickPointerDevice) }; diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp index bdb362e1ff..c441cfc357 100644 --- a/src/quick/items/qquickwindow.cpp +++ b/src/quick/items/qquickwindow.cpp @@ -752,12 +752,12 @@ void QQuickWindowPrivate::setMouseGrabber(QQuickItem *grabber) if (grabber && touchMouseId != -1 && touchMouseDevice) { // update the touch item for mouse touch id to the new grabber qCDebug(DBG_TOUCH_TARGET) << "TP (mouse)" << hex << touchMouseId << "->" << q->mouseGrabberItem(); - auto point = touchMouseDevice->pointerEvent()->pointById(touchMouseId); + auto point = pointerEventInstance(touchMouseDevice)->pointById(touchMouseId); if (point) point->setGrabber(grabber); fromTouch = true; } else { - QQuickPointerEvent *event = QQuickPointerDevice::genericMouseDevice()->pointerEvent(); + QQuickPointerEvent *event = pointerEventInstance(QQuickPointerDevice::genericMouseDevice()); Q_ASSERT(event->pointCount() == 1); event->point(0)->setGrabber(grabber); } @@ -784,7 +784,7 @@ void QQuickWindowPrivate::grabTouchPoints(QQuickItem *grabber, const QVectorpointerEvent()->pointById(id); + auto point = pointerEventInstance(touchMouseDevice)->pointById(id); auto touchMouseGrabber = point->grabber(); if (touchMouseGrabber) { point->setGrabber(nullptr); @@ -798,7 +798,7 @@ void QQuickWindowPrivate::grabTouchPoints(QQuickItem *grabber, const QVectorpointerEvent()->pointById(id); + auto point = pointerEventInstance(device)->pointById(id); if (!point) continue; QQuickItem *oldGrabber = point->grabber(); @@ -824,7 +824,7 @@ void QQuickWindowPrivate::removeGrabber(QQuickItem *grabber, bool mouse, bool to if (Q_LIKELY(touch)) { const auto touchDevices = QQuickPointerDevice::touchDevices(); for (auto device : touchDevices) { - auto pointerEvent = device->pointerEvent(); + auto pointerEvent = pointerEventInstance(device); for (int i = 0; i < pointerEvent->pointCount(); ++i) { if (pointerEvent->point(i)->grabber() == grabber) { pointerEvent->point(i)->setGrabber(nullptr); @@ -1493,13 +1493,13 @@ QQuickItem *QQuickWindow::mouseGrabberItem() const Q_D(const QQuickWindow); if (d->touchMouseId != -1 && d->touchMouseDevice) { - QQuickPointerEvent *event = d->touchMouseDevice->pointerEvent(); + QQuickPointerEvent *event = d->pointerEventInstance(d->touchMouseDevice); auto point = event->pointById(d->touchMouseId); Q_ASSERT(point); return point->grabber(); } - QQuickPointerEvent *event = QQuickPointerDevice::genericMouseDevice()->pointerEvent(); + QQuickPointerEvent *event = d->pointerEventInstance(QQuickPointerDevice::genericMouseDevice()); Q_ASSERT(event->pointCount()); return event->point(0)->grabber(); } @@ -1883,7 +1883,7 @@ bool QQuickWindowPrivate::deliverTouchCancelEvent(QTouchEvent *event) // A TouchCancel event will typically not contain any points. // Deliver it to all items that have active touches. - QQuickPointerEvent *pointerEvent = QQuickPointerDevice::touchDevice(event->device())->pointerEvent(); + QQuickPointerEvent *pointerEvent = pointerEventInstance(QQuickPointerDevice::touchDevice(event->device())); QVector grabbers = pointerEvent->grabbers(); for (QQuickItem *grabber: qAsConst(grabbers)) { @@ -2113,6 +2113,32 @@ void QQuickWindowPrivate::flushFrameSynchronousEvents() } } +QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QQuickPointerDevice *device) const +{ + // the list of devices should be very small so a linear search should be ok + for (QQuickPointerEvent *e: pointerEventInstances) { + if (e->device() == device) + return e; + } + + QQuickPointerEvent *ev = nullptr; + QQuickWindow *q = const_cast(q_func()); + switch (device->type()) { + case QQuickPointerDevice::Mouse: + ev = new QQuickPointerMouseEvent(q, device); + break; + case QQuickPointerDevice::TouchPad: + case QQuickPointerDevice::TouchScreen: + ev = new QQuickPointerTouchEvent(q, device); + break; + default: + // TODO tablet event types + break; + } + pointerEventInstances << ev; + return ev; +} + /*! \internal Returns a QQuickPointerEvent instance suitable for wrapping and delivering \a event. @@ -2123,25 +2149,29 @@ void QQuickWindowPrivate::flushFrameSynchronousEvents() QQuickPointerEvent *QQuickWindowPrivate::pointerEventInstance(QEvent *event) const { QQuickPointerDevice *dev = nullptr; + QQuickPointerEvent *ev = nullptr; switch (event->type()) { case QEvent::MouseButtonPress: case QEvent::MouseButtonRelease: case QEvent::MouseButtonDblClick: case QEvent::MouseMove: dev = QQuickPointerDevice::genericMouseDevice(); + ev = pointerEventInstance(dev); break; case QEvent::TouchBegin: case QEvent::TouchUpdate: case QEvent::TouchEnd: case QEvent::TouchCancel: dev = QQuickPointerDevice::touchDevice(static_cast(event)->device()); + ev = pointerEventInstance(dev); break; // TODO tablet event types default: break; } - Q_ASSERT(dev); - return dev->pointerEvent()->reset(event); + + Q_ASSERT(ev); + return ev->reset(event); } void QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent *event) @@ -2616,7 +2646,7 @@ bool QQuickWindowPrivate::sendFilteredTouchEvent(QQuickItem *target, QQuickItem if (touchMouseUnset) { // the point was grabbed as a pure touch point before, now it will be treated as mouse // but the old receiver still needs to be informed - if (auto oldGrabber = touchMouseDevice->pointerEvent()->pointById(tp.id())->grabber()) + if (auto oldGrabber = pointerEventInstance(touchMouseDevice)->pointById(tp.id())->grabber()) oldGrabber->touchUngrabEvent(); } touchMouseUnset = false; // We want to leave touchMouseId and touchMouseDevice set diff --git a/src/quick/items/qquickwindow_p.h b/src/quick/items/qquickwindow_p.h index be915903c6..b3ff5a2b35 100644 --- a/src/quick/items/qquickwindow_p.h +++ b/src/quick/items/qquickwindow_p.h @@ -162,6 +162,10 @@ public: void flushFrameSynchronousEvents(); void deliverDelayedTouchEvent(); + // the device-specific event instances which are reused during event delivery + mutable QVector pointerEventInstances; + QQuickPointerEvent *pointerEventInstance(QQuickPointerDevice *device) const; + // delivery of pointer events: QQuickPointerEvent *pointerEventInstance(QEvent *ev) const; void deliverPointerEvent(QQuickPointerEvent *); -- cgit v1.2.3 From 9921b48c83490b450241d6c172f1375ab4efb6b1 Mon Sep 17 00:00:00 2001 From: Michael Brasser Date: Tue, 9 May 2017 09:21:58 -0500 Subject: Ensure same glyph cache is used for same font at different sizes Change-Id: I46b62616fd8141f65786e9e7bcb1068bed460732 Task-number: QTBUG-60696 Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/quick/scenegraph/util/qsgdistancefieldutil.cpp | 24 ++++++++++++++++++++-- src/quick/scenegraph/util/qsgdistancefieldutil_p.h | 4 +++- 2 files changed, 25 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp index 9ca9cdb107..84df7f3393 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil.cpp +++ b/src/quick/scenegraph/util/qsgdistancefieldutil.cpp @@ -84,12 +84,32 @@ QSGDistanceFieldGlyphCacheManager::~QSGDistanceFieldGlyphCacheManager() QSGDistanceFieldGlyphCache *QSGDistanceFieldGlyphCacheManager::cache(const QRawFont &font) { - return m_caches.value(font, 0); + return m_caches.value(fontKey(font), 0); } void QSGDistanceFieldGlyphCacheManager::insertCache(const QRawFont &font, QSGDistanceFieldGlyphCache *cache) { - m_caches.insert(font, cache); + m_caches.insert(fontKey(font), cache); +} + +QString QSGDistanceFieldGlyphCacheManager::fontKey(const QRawFont &font) +{ + QFontEngine *fe = QRawFontPrivate::get(font)->fontEngine; + if (!fe->faceId().filename.isEmpty()) { + QByteArray keyName = fe->faceId().filename; + if (font.style() != QFont::StyleNormal) + keyName += QByteArray(" I"); + if (font.weight() != QFont::Normal) + keyName += ' ' + QByteArray::number(font.weight()); + keyName += QByteArray(" DF"); + return QString::fromUtf8(keyName); + } else { + return QString::fromLatin1("%1_%2_%3_%4") + .arg(font.familyName()) + .arg(font.styleName()) + .arg(font.weight()) + .arg(font.style()); + } } QT_END_NAMESPACE diff --git a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h index ad366cb4d4..354a48a81e 100644 --- a/src/quick/scenegraph/util/qsgdistancefieldutil_p.h +++ b/src/quick/scenegraph/util/qsgdistancefieldutil_p.h @@ -80,7 +80,9 @@ public: void setAntialiasingSpreadFunc(AntialiasingSpreadFunc func) { m_antialiasingSpread_func = func; } private: - QHash m_caches; + static QString fontKey(const QRawFont &font); + + QHash m_caches; ThresholdFunc m_threshold_func; AntialiasingSpreadFunc m_antialiasingSpread_func; -- cgit v1.2.3 From a225bddf67f4786c845193630d4ab20b99a2fc3a Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Fri, 28 Apr 2017 13:25:50 +0200 Subject: Update the alloca() support in QtQml qv4alloca_p.h dates from April 2013 and contained just the #includes, whereas the code in qtqmlglobal_p.h was introduced earlier this year in commit 87f016ea9eddc874d5cba7d79d0a487d5ef61761. This commit moves the macros to qv4alloca_p.h and centralizes the support there. This also updates the #include detection mechanism, by using QT_CONFIG(alloca_h) to determine which #include to use. See commit 98c1d516b7f7624f7fcd7b9046783e3903a6a42b in qtbase for more details. Task-number: QTBUG-59700 Started-by: Thiago Macieira Change-Id: Icd0e0d4b27cb4e5eb892fffd14b4b38005ce2ecb Reviewed-by: Thiago Macieira Reviewed-by: Lars Knoll --- src/qml/jsruntime/jsruntime.pri | 1 + src/qml/jsruntime/qv4alloca_p.h | 53 +++++++++++++++++++++++++++++++++++++---- src/qml/qtqmlglobal_p.h | 40 ------------------------------- 3 files changed, 49 insertions(+), 45 deletions(-) (limited to 'src') diff --git a/src/qml/jsruntime/jsruntime.pri b/src/qml/jsruntime/jsruntime.pri index 955cf585e4..76ac8d4a91 100644 --- a/src/qml/jsruntime/jsruntime.pri +++ b/src/qml/jsruntime/jsruntime.pri @@ -46,6 +46,7 @@ SOURCES += \ HEADERS += \ $$PWD/qv4global_p.h \ + $$PWD/qv4alloca_p.h \ $$PWD/qv4engine_p.h \ $$PWD/qv4context_p.h \ $$PWD/qv4math_p.h \ diff --git a/src/qml/jsruntime/qv4alloca_p.h b/src/qml/jsruntime/qv4alloca_p.h index 2f486988c1..c21878fa42 100644 --- a/src/qml/jsruntime/qv4alloca_p.h +++ b/src/qml/jsruntime/qv4alloca_p.h @@ -51,15 +51,58 @@ // We mean it. // -#include +#include -#if defined(Q_OS_WIN) +#if QT_CONFIG(alloca_h) +# include +#elif QT_CONFIG(alloca_malloc_h) # include -# ifndef __GNUC__ +// This does not matter unless compiling in strict standard mode. +# ifdef Q_OS_WIN # define alloca _alloca # endif -#elif !defined(Q_OS_BSD4) || defined(Q_OS_DARWIN) -# include +#else +# include +#endif + +// Define Q_ALLOCA_VAR macro to be used instead of #ifdeffing +// the occurrences of alloca() in case it's not supported. +// Q_ALLOCA_DECLARE and Q_ALLOCA_ASSIGN macros separate +// memory allocation from the declaration and RAII. +#define Q_ALLOCA_VAR(type, name, size) \ + Q_ALLOCA_DECLARE(type, name); \ + Q_ALLOCA_ASSIGN(type, name, size) + +#if QT_CONFIG(alloca) + +#define Q_ALLOCA_DECLARE(type, name) \ + type *name = 0 + +#define Q_ALLOCA_ASSIGN(type, name, size) \ + name = static_cast(alloca(size)) + +#else +QT_BEGIN_NAMESPACE +class Qt_AllocaWrapper +{ +public: + Qt_AllocaWrapper() { m_data = 0; } + ~Qt_AllocaWrapper() { free(m_data); } + void *data() { return m_data; } + void allocate(int size) { m_data = malloc(size); } +private: + void *m_data; +}; +QT_END_NAMESPACE + +#define Q_ALLOCA_DECLARE(type, name) \ + Qt_AllocaWrapper _qt_alloca_##name; \ + type *name = nullptr + +#define Q_ALLOCA_ASSIGN(type, name, size) \ + _qt_alloca_##name.allocate(size); \ + name = static_cast(_qt_alloca_##name.data()) + #endif #endif diff --git a/src/qml/qtqmlglobal_p.h b/src/qml/qtqmlglobal_p.h index 6547274d09..e9834ffc4c 100644 --- a/src/qml/qtqmlglobal_p.h +++ b/src/qml/qtqmlglobal_p.h @@ -55,46 +55,6 @@ #include #include -// Define Q_ALLOCA_VAR macro to be used instead of #ifdeffing -// the occurrences of alloca() in case it's not supported. -// Q_ALLOCA_DECLARE and Q_ALLOCA_ASSIGN macros separate -// memory allocation from the declaration and RAII. -#define Q_ALLOCA_VAR(type, name, size) \ - Q_ALLOCA_DECLARE(type, name); \ - Q_ALLOCA_ASSIGN(type, name, size) - -#if defined(QT_BOOTSTRAPPED) || QT_CONFIG(alloca) - -#define Q_ALLOCA_DECLARE(type, name) \ - type *name = 0 - -#define Q_ALLOCA_ASSIGN(type, name, size) \ - name = static_cast(alloca(size)) - -#else -QT_BEGIN_NAMESPACE -class Qt_AllocaWrapper -{ -public: - Qt_AllocaWrapper() { m_data = 0; } - ~Qt_AllocaWrapper() { free(m_data); } - void *data() { return m_data; } - void allocate(int size) { m_data = malloc(size); } -private: - void *m_data; -}; -QT_END_NAMESPACE - -#define Q_ALLOCA_DECLARE(type, name) \ - Qt_AllocaWrapper _qt_alloca_##name; \ - type *name = 0 - -#define Q_ALLOCA_ASSIGN(type, name, size) \ - _qt_alloca_##name.allocate(size); \ - name = static_cast(_qt_alloca_##name.data()) - -#endif - #define Q_QML_PRIVATE_EXPORT Q_QML_EXPORT #endif // QTQMLGLOBAL_P_H -- cgit v1.2.3 From 7434d05cc102f27d36b8efccb4e37f20a4886ea9 Mon Sep 17 00:00:00 2001 From: Simon Hausmann Date: Tue, 9 May 2017 11:30:03 +0200 Subject: Fix build on MIPS32 Remove stack handling function that's dead code that doesn't compile. Task-number: QTBUG-58567 Change-Id: I704b0323522ce2a313d6cc85112f782872c3bf68 Reviewed-by: Lars Knoll --- src/3rdparty/masm/assembler/MacroAssembler.h | 8 -------- 1 file changed, 8 deletions(-) (limited to 'src') diff --git a/src/3rdparty/masm/assembler/MacroAssembler.h b/src/3rdparty/masm/assembler/MacroAssembler.h index f37861eb66..6e77a9ffb7 100644 --- a/src/3rdparty/masm/assembler/MacroAssembler.h +++ b/src/3rdparty/masm/assembler/MacroAssembler.h @@ -248,14 +248,6 @@ public: } #endif -#if CPU(MIPS) - void poke(FPRegisterID src, int index = 0) - { - ASSERT(!(index & 1)); - storeDouble(src, addressForPoke(index)); - } -#endif - // Backwards banches, these are currently all implemented using existing forwards branch mechanisms. void branchPtr(RelationalCondition cond, RegisterID op1, TrustedImmPtr imm, Label target) { -- cgit v1.2.3