aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/3rdparty/masm/assembler/ARM64Assembler.h2
-rw-r--r--src/3rdparty/masm/yarr/YarrJIT.cpp8
-rw-r--r--src/imports/testlib/TestCase.qml3
-rw-r--r--src/qml/compiler/qv4instr_moth.cpp2
-rw-r--r--src/qml/jsruntime/qv4regexp.cpp60
-rw-r--r--src/qml/jsruntime/qv4regexpobject.cpp8
-rw-r--r--src/qml/jsruntime/qv4stringobject.cpp39
-rw-r--r--src/qml/memory/qv4mm.cpp2
-rw-r--r--src/qml/qml/qqmlnotifier.cpp12
-rw-r--r--src/qml/qml/qqmlnotifier_p.h61
-rw-r--r--src/quick/doc/qtquick.qdocconf9
-rw-r--r--src/quick/handlers/qquickpinchhandler.cpp42
-rw-r--r--src/quick/handlers/qquickpinchhandler_p.h3
-rw-r--r--src/quick/handlers/qquicksinglepointhandler.cpp2
-rw-r--r--src/quick/handlers/qquicktaphandler.cpp11
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp310
-rw-r--r--src/quick/items/qquickborderimage.cpp2
-rw-r--r--src/quick/items/qquickflickable.cpp14
-rw-r--r--src/quick/items/qquickflickable_p.h2
-rw-r--r--src/quick/items/qquickflickable_p_p.h4
-rw-r--r--src/quick/items/qquickitem_p.h2
-rw-r--r--src/quick/scenegraph/util/qsgatlastexture.cpp4
-rw-r--r--src/quick/util/qquickpath.cpp2
-rw-r--r--src/quickshapes/qquickshape.cpp8
24 files changed, 360 insertions, 252 deletions
diff --git a/src/3rdparty/masm/assembler/ARM64Assembler.h b/src/3rdparty/masm/assembler/ARM64Assembler.h
index fcf2e485e8..a9166e83a2 100644
--- a/src/3rdparty/masm/assembler/ARM64Assembler.h
+++ b/src/3rdparty/masm/assembler/ARM64Assembler.h
@@ -3051,7 +3051,7 @@ public:
UNUSED_PARAM(size);
#endif
#elif OS(INTEGRITY)
- ManageCaches((Address)code, size, ACCESS_DST_COHERENT);
+ ManageCaches((Address)code, size, ACCESS_DST_SYNC);
#else
#error "The cacheFlush support is missing on this platform."
#endif
diff --git a/src/3rdparty/masm/yarr/YarrJIT.cpp b/src/3rdparty/masm/yarr/YarrJIT.cpp
index 98e4ade51f..da65b772f7 100644
--- a/src/3rdparty/masm/yarr/YarrJIT.cpp
+++ b/src/3rdparty/masm/yarr/YarrJIT.cpp
@@ -3534,20 +3534,20 @@ public:
CodeRef codeRef;
if (compileMode == MatchOnly) {
if (m_charSize == Char8) {
- codeRef = FINALIZE_CODE(linkBuffer, "YarJIT",
+ codeRef = FINALIZE_CODE(linkBuffer, "YarrJIT",
"Match-only 8-bit regular expression");
codeBlock.set8BitCodeMatchOnly(codeRef);
} else {
- codeRef = FINALIZE_CODE(linkBuffer, "YarJIT",
+ codeRef = FINALIZE_CODE(linkBuffer, "YarrJIT",
"Match-only 16-bit regular expression");
codeBlock.set16BitCodeMatchOnly(codeRef);
}
} else {
if (m_charSize == Char8) {
- codeRef = FINALIZE_CODE(linkBuffer, "YarJIT", "8-bit regular expression");
+ codeRef = FINALIZE_CODE(linkBuffer, "YarrJIT", "8-bit regular expression");
codeBlock.set8BitCode(codeRef);
} else {
- codeRef = FINALIZE_CODE(linkBuffer, "YarJIT", "16-bit regular expression");
+ codeRef = FINALIZE_CODE(linkBuffer, "YarrJIT", "16-bit regular expression");
codeBlock.set16BitCode(codeRef);
}
}
diff --git a/src/imports/testlib/TestCase.qml b/src/imports/testlib/TestCase.qml
index 4dee4162be..e7669fd03d 100644
--- a/src/imports/testlib/TestCase.qml
+++ b/src/imports/testlib/TestCase.qml
@@ -1398,9 +1398,6 @@ Item {
If \a item is obscured by another item, or a child of \a item occupies
that position, then the event will be delivered to the other item instead.
- Note: this method does not imply a drop action, to make a drop, an additional
- mouseRelease(item, x + dx, y + dy) is needed.
-
\sa mousePress(), mouseClick(), mouseDoubleClick(), mouseDoubleClickSequence(), mouseMove(), mouseRelease(), mouseWheel()
*/
function mouseDrag(item, x, y, dx, dy, button, modifiers, delay) {
diff --git a/src/qml/compiler/qv4instr_moth.cpp b/src/qml/compiler/qv4instr_moth.cpp
index def58de9a8..c0b1be1492 100644
--- a/src/qml/compiler/qv4instr_moth.cpp
+++ b/src/qml/compiler/qv4instr_moth.cpp
@@ -157,7 +157,7 @@ QString dumpRegister(int reg, int nFormals)
else if (reg == CallData::Argc)
return QStringLiteral("(argc)");
reg -= CallData::HeaderSize();
- if (reg <= nFormals)
+ if (reg < nFormals)
return QStringLiteral("a%1").arg(reg);
reg -= nFormals;
return QStringLiteral("r%1").arg(reg);
diff --git a/src/qml/jsruntime/qv4regexp.cpp b/src/qml/jsruntime/qv4regexp.cpp
index 05c3b4c4ca..4ed1dbd5aa 100644
--- a/src/qml/jsruntime/qv4regexp.cpp
+++ b/src/qml/jsruntime/qv4regexp.cpp
@@ -45,6 +45,22 @@
using namespace QV4;
+static JSC::RegExpFlags jscFlags(uint flags)
+{
+ JSC::RegExpFlags jscFlags = JSC::NoFlags;
+ if (flags & CompiledData::RegExp::RegExp_Global)
+ jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagGlobal);
+ if (flags & CompiledData::RegExp::RegExp_IgnoreCase)
+ jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagIgnoreCase);
+ if (flags & CompiledData::RegExp::RegExp_Multiline)
+ jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagMultiline);
+ if (flags & CompiledData::RegExp::RegExp_Unicode)
+ jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagUnicode);
+ if (flags & CompiledData::RegExp::RegExp_Sticky)
+ jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagSticky);
+ return jscFlags;
+}
+
RegExpCache::~RegExpCache()
{
for (RegExpCache::Iterator it = begin(), e = end(); it != e; ++it) {
@@ -57,21 +73,43 @@ DEFINE_MANAGED_VTABLE(RegExp);
uint RegExp::match(const QString &string, int start, uint *matchOffsets)
{
+ static const uint offsetJITFail = std::numeric_limits<unsigned>::max() - 1;
+
if (!isValid())
return JSC::Yarr::offsetNoMatch;
WTF::String s(string);
#if ENABLE(YARR_JIT)
- if (d()->hasValidJITCode()) {
+ auto *priv = d();
+ if (priv->hasValidJITCode()) {
+ uint ret = JSC::Yarr::offsetNoMatch;
#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
char buffer[8192];
- return uint(jitCode()->execute(s.characters16(), start, s.length(), (int*)matchOffsets, buffer, 8192).start);
+ ret = uint(priv->jitCode->execute(s.characters16(), start, s.length(),
+ (int*)matchOffsets, buffer, 8192).start);
#else
- return uint(jitCode()->execute(s.characters16(), start, s.length(), (int*)matchOffsets).start);
+ ret = uint(priv->jitCode->execute(s.characters16(), start, s.length(),
+ (int*)matchOffsets).start);
#endif
+ if (ret != offsetJITFail)
+ return ret;
+
+ // JIT failed. We need byteCode to run the interpreter.
+ if (!priv->byteCode) {
+ JSC::Yarr::ErrorCode error = JSC::Yarr::ErrorCode::NoError;
+ JSC::Yarr::YarrPattern yarrPattern(WTF::String(*priv->pattern), jscFlags(priv->flags),
+ error);
+
+ // As we successfully parsed the pattern before, we should still be able to.
+ Q_ASSERT(error == JSC::Yarr::ErrorCode::NoError);
+
+ priv->byteCode = JSC::Yarr::byteCompile(
+ yarrPattern,
+ priv->internalClass->engine->bumperPointerAllocator).release();
+ }
}
-#endif
+#endif // ENABLE(YARR_JIT)
return JSC::Yarr::interpret(byteCode(), s.characters16(), string.length(), start, matchOffsets);
}
@@ -176,19 +214,7 @@ void Heap::RegExp::init(ExecutionEngine *engine, const QString &pattern, uint fl
valid = false;
JSC::Yarr::ErrorCode error = JSC::Yarr::ErrorCode::NoError;
- JSC::RegExpFlags jscFlags = JSC::NoFlags;
- if (flags & CompiledData::RegExp::RegExp_Global)
- jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagGlobal);
- if (flags & CompiledData::RegExp::RegExp_IgnoreCase)
- jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagIgnoreCase);
- if (flags & CompiledData::RegExp::RegExp_Multiline)
- jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagMultiline);
- if (flags & CompiledData::RegExp::RegExp_Unicode)
- jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagUnicode);
- if (flags & CompiledData::RegExp::RegExp_Sticky)
- jscFlags = static_cast<JSC::RegExpFlags>(flags | JSC::FlagSticky);
-
- JSC::Yarr::YarrPattern yarrPattern(WTF::String(pattern), jscFlags, error);
+ JSC::Yarr::YarrPattern yarrPattern(WTF::String(pattern), jscFlags(flags), error);
if (error != JSC::Yarr::ErrorCode::NoError)
return;
subPatternCount = yarrPattern.m_numSubpatterns;
diff --git a/src/qml/jsruntime/qv4regexpobject.cpp b/src/qml/jsruntime/qv4regexpobject.cpp
index 9df286065d..39a2e96b45 100644
--- a/src/qml/jsruntime/qv4regexpobject.cpp
+++ b/src/qml/jsruntime/qv4regexpobject.cpp
@@ -181,17 +181,19 @@ ReturnedValue RegExpObject::builtinExec(ExecutionEngine *engine, const String *s
}
Q_ALLOCA_VAR(uint, matchOffsets, value()->captureCount() * 2 * sizeof(uint));
- const int result = Scoped<RegExp>(scope, value())->match(s, offset, matchOffsets);
+ const uint result = Scoped<RegExp>(scope, value())->match(s, offset, matchOffsets);
RegExpCtor *regExpCtor = static_cast<RegExpCtor *>(scope.engine->regExpCtor());
regExpCtor->d()->clearLastMatch();
- if (result == -1) {
+ if (result == JSC::Yarr::offsetNoMatch) {
if (global() || sticky())
setLastIndex(0);
RETURN_RESULT(Encode::null());
}
+ Q_ASSERT(result <= uint(std::numeric_limits<int>::max()));
+
// fill in result data
ScopedArrayObject array(scope, scope.engine->newArrayObject(scope.engine->internalClasses(EngineBase::Class_RegExpExecArray)));
int len = value()->captureCount();
@@ -207,7 +209,7 @@ ReturnedValue RegExpObject::builtinExec(ExecutionEngine *engine, const String *s
array->arrayPut(i, v);
}
array->setArrayLengthUnchecked(len);
- array->setProperty(Index_ArrayIndex, Value::fromInt32(result));
+ array->setProperty(Index_ArrayIndex, Value::fromInt32(int(result)));
array->setProperty(Index_ArrayInput, *str);
RegExpCtor::Data *dd = regExpCtor->d();
diff --git a/src/qml/jsruntime/qv4stringobject.cpp b/src/qml/jsruntime/qv4stringobject.cpp
index d0f6aff9d9..8186153ba4 100644
--- a/src/qml/jsruntime/qv4stringobject.cpp
+++ b/src/qml/jsruntime/qv4stringobject.cpp
@@ -722,41 +722,52 @@ static void appendReplacementString(QString *result, const QString &input, const
result->reserve(result->length() + replaceValue.length());
for (int i = 0; i < replaceValue.length(); ++i) {
if (replaceValue.at(i) == QLatin1Char('$') && i < replaceValue.length() - 1) {
- ushort ch = replaceValue.at(++i).unicode();
+ ushort ch = replaceValue.at(i + 1).unicode();
uint substStart = JSC::Yarr::offsetNoMatch;
uint substEnd = JSC::Yarr::offsetNoMatch;
+ int skip = 0;
if (ch == '$') {
*result += QChar(ch);
+ ++i;
continue;
} else if (ch == '&') {
substStart = matchOffsets[0];
substEnd = matchOffsets[1];
+ skip = 1;
} else if (ch == '`') {
substStart = 0;
substEnd = matchOffsets[0];
+ skip = 1;
} else if (ch == '\'') {
substStart = matchOffsets[1];
substEnd = input.length();
- } else if (ch >= '1' && ch <= '9') {
+ skip = 1;
+ } else if (ch >= '0' && ch <= '9') {
uint capture = ch - '0';
- Q_ASSERT(capture > 0);
- if (capture < static_cast<uint>(captureCount)) {
+ skip = 1;
+ if (i < replaceValue.length() - 2) {
+ ch = replaceValue.at(i + 2).unicode();
+ if (ch >= '0' && ch <= '9') {
+ uint c = capture*10 + ch - '0';
+ if (c < static_cast<uint>(captureCount)) {
+ capture = c;
+ skip = 2;
+ }
+ }
+ }
+ if (capture > 0 && capture < static_cast<uint>(captureCount)) {
substStart = matchOffsets[capture * 2];
substEnd = matchOffsets[capture * 2 + 1];
- }
- } else if (ch == '0' && i < replaceValue.length() - 1) {
- int capture = (ch - '0') * 10;
- ch = replaceValue.at(++i).unicode();
- if (ch >= '0' && ch <= '9') {
- capture += ch - '0';
- if (capture > 0 && capture < captureCount) {
- substStart = matchOffsets[capture * 2];
- substEnd = matchOffsets[capture * 2 + 1];
- }
+ } else {
+ skip = 0;
}
}
+ i += skip;
if (substStart != JSC::Yarr::offsetNoMatch && substEnd != JSC::Yarr::offsetNoMatch)
*result += input.midRef(substStart, substEnd - substStart);
+ else {
+ *result += replaceValue.at(i);
+ }
} else {
*result += replaceValue.at(i);
}
diff --git a/src/qml/memory/qv4mm.cpp b/src/qml/memory/qv4mm.cpp
index 97254b9172..3cf22d82e5 100644
--- a/src/qml/memory/qv4mm.cpp
+++ b/src/qml/memory/qv4mm.cpp
@@ -973,8 +973,6 @@ void MemoryManager::sweep(bool lastSweep, ClassDestroyStatsCallback classCountPt
// signal before we start sweeping the heap
if (QObjectWrapper *qobjectWrapper = (*it).as<QObjectWrapper>())
qobjectWrapper->destroyObject(lastSweep);
-
- (*it) = Value::undefinedValue();
}
// remove objects from weak maps and sets
diff --git a/src/qml/qml/qqmlnotifier.cpp b/src/qml/qml/qqmlnotifier.cpp
index ac247ae0ad..0706b8c0cf 100644
--- a/src/qml/qml/qqmlnotifier.cpp
+++ b/src/qml/qml/qqmlnotifier.cpp
@@ -90,24 +90,20 @@ void QQmlNotifier::emitNotify(QQmlNotifierEndpoint *endpoint, void **a)
NotifyListTraversalData &data = stack[i];
if (!data.endpoint->isNotifying()) {
- data.originalSenderPtr = data.endpoint->senderPtr;
+ data.endpoint->startNotifying(&data.originalSenderPtr);
data.disconnectWatch = &data.originalSenderPtr;
- data.endpoint->senderPtr = qintptr(data.disconnectWatch) | 0x1;
} else {
data.disconnectWatch = (qintptr *)(data.endpoint->senderPtr & ~0x1);
}
}
while (--i >= 0) {
- const NotifyListTraversalData &data = stack.at(i);
+ NotifyListTraversalData &data = stack[i];
if (*data.disconnectWatch) {
-
Q_ASSERT(QQmlNotifier_callbacks[data.endpoint->callback]);
QQmlNotifier_callbacks[data.endpoint->callback](data.endpoint, a);
-
if (data.disconnectWatch == &data.originalSenderPtr && data.originalSenderPtr) {
- // End of notifying, restore values
- data.endpoint->senderPtr = data.originalSenderPtr;
+ data.endpoint->stopNotifying(&data.originalSenderPtr);
}
}
}
@@ -137,7 +133,7 @@ void QQmlNotifierEndpoint::connect(QObject *source, int sourceSignal, QQmlEngine
qPrintable(engineName));
}
- senderPtr = qintptr(source);
+ setSender(qintptr(source));
this->sourceSignal = sourceSignal;
QQmlPropertyPrivate::flushSignal(source, sourceSignal);
QQmlData *ddata = QQmlData::get(source, true);
diff --git a/src/qml/qml/qqmlnotifier_p.h b/src/qml/qml/qqmlnotifier_p.h
index d77e314de5..67d80a9d86 100644
--- a/src/qml/qml/qqmlnotifier_p.h
+++ b/src/qml/qml/qqmlnotifier_p.h
@@ -105,10 +105,16 @@ public:
inline void disconnect();
inline bool isNotifying() const;
+ inline void startNotifying(qintptr *originalSenderPtr);
+ inline void stopNotifying(qintptr *originalSenderPtr);
+
inline void cancelNotify();
inline int signalIndex() const { return sourceSignal; }
+ inline qintptr sender() const;
+ inline void setSender(qintptr sender);
+
inline QObject *senderAsObject() const;
inline QQmlNotifier *senderAsNotifier() const;
@@ -138,12 +144,9 @@ QQmlNotifier::~QQmlNotifier()
while (endpoint) {
QQmlNotifierEndpoint *n = endpoint;
endpoint = n->next;
-
- if (n->isNotifying()) *((qintptr *)(n->senderPtr & ~0x1)) = 0;
-
+ n->setSender(0x0);
n->next = nullptr;
n->prev = nullptr;
- n->senderPtr = 0;
n->sourceSignal = -1;
}
endpoints = nullptr;
@@ -193,7 +196,7 @@ void QQmlNotifierEndpoint::connect(QQmlNotifier *notifier)
if (next) { next->prev = &next; }
notifier->endpoints = this;
prev = &notifier->endpoints;
- senderPtr = qintptr(notifier);
+ setSender(qintptr(notifier));
}
void QQmlNotifierEndpoint::disconnect()
@@ -205,15 +208,15 @@ void QQmlNotifierEndpoint::disconnect()
if (sourceSignal != -1) {
QObject * const obj = senderAsObject();
+ Q_ASSERT(obj);
QObjectPrivate * const priv = QObjectPrivate::get(obj);
if (needsConnectNotify)
priv->disconnectNotify(QMetaObjectPrivate::signal(obj->metaObject(), sourceSignal));
}
- if (isNotifying()) *((qintptr *)(senderPtr & ~0x1)) = 0;
+ setSender(0x0);
next = nullptr;
prev = nullptr;
- senderPtr = 0;
sourceSignal = -1;
}
@@ -229,26 +232,60 @@ bool QQmlNotifierEndpoint::isNotifying() const
return senderPtr & 0x1;
}
+void QQmlNotifierEndpoint::startNotifying(qintptr *originalSenderPtr)
+{
+ Q_ASSERT(*originalSenderPtr == 0);
+ // Set the endpoint to notifying:
+ // - Save the original senderPtr,
+ *originalSenderPtr = senderPtr;
+ // - Take a pointer of it,
+ // - And assign that to the senderPtr, including a flag to signify "notifying".
+ senderPtr = qintptr(originalSenderPtr) | 0x1;
+}
+
+void QQmlNotifierEndpoint::stopNotifying(qintptr *originalSenderPtr)
+{
+ // End of notifying, restore values
+ Q_ASSERT((senderPtr & ~0x1) == qintptr(originalSenderPtr));
+ senderPtr = *originalSenderPtr;
+ *originalSenderPtr = 0;
+}
+
/*!
Cancel any notifies that are in progress.
*/
void QQmlNotifierEndpoint::cancelNotify()
{
if (isNotifying()) {
- qintptr sp = *((qintptr *)(senderPtr & ~0x1));
- *((qintptr *)(senderPtr & ~0x1)) = 0;
- senderPtr = sp;
+ auto *ptr = (qintptr *)(senderPtr & ~0x1);
+ Q_ASSERT(ptr);
+ senderPtr = *ptr;
+ *ptr = 0;
}
}
+qintptr QQmlNotifierEndpoint::sender() const
+{
+ return isNotifying() ? *(qintptr *)(senderPtr & ~0x1) : senderPtr;
+}
+
+void QQmlNotifierEndpoint::setSender(qintptr sender)
+{
+ // If we're just notifying, we write through to the originalSenderPtr
+ if (isNotifying())
+ *(qintptr *)(senderPtr & ~0x1) = sender;
+ else
+ senderPtr = sender;
+}
+
QObject *QQmlNotifierEndpoint::senderAsObject() const
{
- return isNotifying()?((QObject *)(*((qintptr *)(senderPtr & ~0x1)))):((QObject *)senderPtr);
+ return (QObject *)(sender());
}
QQmlNotifier *QQmlNotifierEndpoint::senderAsNotifier() const
{
- return isNotifying()?((QQmlNotifier *)(*((qintptr *)(senderPtr & ~0x1)))):((QQmlNotifier *)senderPtr);
+ return (QQmlNotifier *)(sender());
}
QT_END_NAMESPACE
diff --git a/src/quick/doc/qtquick.qdocconf b/src/quick/doc/qtquick.qdocconf
index 21a44a2fab..b1268097fc 100644
--- a/src/quick/doc/qtquick.qdocconf
+++ b/src/quick/doc/qtquick.qdocconf
@@ -52,10 +52,11 @@ exampledirs += ../../../examples/quick \
imagedirs += images
-
-#add particles sources
-headerdirs += ../../particles
-sourcedirs += ../../particles
+#add particles and shapes sources
+headerdirs += ../../particles \
+ ../../quickshapes
+sourcedirs += ../../particles \
+ ../../quickshapes
#add imports directory because of dependencies
headerdirs += ../../imports
diff --git a/src/quick/handlers/qquickpinchhandler.cpp b/src/quick/handlers/qquickpinchhandler.cpp
index e6442e7258..a0fec37443 100644
--- a/src/quick/handlers/qquickpinchhandler.cpp
+++ b/src/quick/handlers/qquickpinchhandler.cpp
@@ -99,7 +99,7 @@ QQuickPinchHandler::QQuickPinchHandler(QQuickItem *parent)
*/
void QQuickPinchHandler::setMinimumScale(qreal minimumScale)
{
- if (m_minimumScale == minimumScale)
+ if (qFuzzyCompare(m_minimumScale, minimumScale))
return;
m_minimumScale = minimumScale;
@@ -114,7 +114,7 @@ void QQuickPinchHandler::setMinimumScale(qreal minimumScale)
*/
void QQuickPinchHandler::setMaximumScale(qreal maximumScale)
{
- if (m_maximumScale == maximumScale)
+ if (qFuzzyCompare(m_maximumScale, maximumScale))
return;
m_maximumScale = maximumScale;
@@ -129,7 +129,7 @@ void QQuickPinchHandler::setMaximumScale(qreal maximumScale)
*/
void QQuickPinchHandler::setMinimumRotation(qreal minimumRotation)
{
- if (m_minimumRotation == minimumRotation)
+ if (qFuzzyCompare(m_minimumRotation, minimumRotation))
return;
m_minimumRotation = minimumRotation;
@@ -144,7 +144,7 @@ void QQuickPinchHandler::setMinimumRotation(qreal minimumRotation)
*/
void QQuickPinchHandler::setMaximumRotation(qreal maximumRotation)
{
- if (m_maximumRotation == maximumRotation)
+ if (qFuzzyCompare(m_maximumRotation, maximumRotation))
return;
m_maximumRotation = maximumRotation;
@@ -158,7 +158,7 @@ void QQuickPinchHandler::setMaximumRotation(qreal maximumRotation)
*/
void QQuickPinchHandler::setMinimumX(qreal minX)
{
- if (m_minimumX == minX)
+ if (qFuzzyCompare(m_minimumX, minX))
return;
m_minimumX = minX;
emit minimumXChanged();
@@ -171,7 +171,7 @@ void QQuickPinchHandler::setMinimumX(qreal minX)
*/
void QQuickPinchHandler::setMaximumX(qreal maxX)
{
- if (m_maximumX == maxX)
+ if (qFuzzyCompare(m_maximumX, maxX))
return;
m_maximumX = maxX;
emit maximumXChanged();
@@ -184,7 +184,7 @@ void QQuickPinchHandler::setMaximumX(qreal maxX)
*/
void QQuickPinchHandler::setMinimumY(qreal minY)
{
- if (m_minimumY == minY)
+ if (qFuzzyCompare(m_minimumY, minY))
return;
m_minimumY = minY;
emit minimumYChanged();
@@ -197,7 +197,7 @@ void QQuickPinchHandler::setMinimumY(qreal minY)
*/
void QQuickPinchHandler::setMaximumY(qreal maxY)
{
- if (m_maximumY == maxY)
+ if (qFuzzyCompare(m_maximumY, maxY))
return;
m_maximumY = maxY;
emit maximumYChanged();
@@ -258,10 +258,10 @@ void QQuickPinchHandler::onActiveChanged()
m_startScale = t->scale(); // TODO incompatible with independent x/y scaling
m_startRotation = t->rotation();
QVector3D xformOrigin(t->transformOriginPoint());
- m_startMatrix.translate(t->x(), t->y());
+ m_startMatrix.translate(float(t->x()), float(t->y()));
m_startMatrix.translate(xformOrigin);
- m_startMatrix.scale(m_startScale);
- m_startMatrix.rotate(m_startRotation, 0, 0, -1);
+ m_startMatrix.scale(float(m_startScale));
+ m_startMatrix.rotate(float(m_startRotation), 0, 0, -1);
m_startMatrix.translate(-xformOrigin);
} else {
m_startScale = m_accumulatedScale;
@@ -377,9 +377,9 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event)
QVector2D centroidRelativeMovement = currentCentroidRelativePosition - pressCentroidRelativePosition;
accumulatedMovementMagnitude += centroidRelativeMovement.length();
- accumulatedCentroidDistance += pressCentroidRelativePosition.length();
+ accumulatedCentroidDistance += qreal(pressCentroidRelativePosition.length());
if (event->isPressEvent())
- m_accumulatedStartCentroidDistance += (QVector2D(point->scenePressPosition()) - pressCentroid).length();
+ m_accumulatedStartCentroidDistance += qreal((QVector2D(point->scenePressPosition()) - pressCentroid).length());
} else {
setPassiveGrab(point);
}
@@ -400,7 +400,7 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event)
if (!yAxis()->enabled())
avgDrag.setY(0);
- const qreal centroidMovementDelta = (currentCentroid - pressCentroid).length();
+ const qreal centroidMovementDelta = qreal((currentCentroid - pressCentroid).length());
qreal distanceToCentroidDelta = qAbs(accumulatedCentroidDistance - m_accumulatedStartCentroidDistance); // Used to detect scale
if (numberOfPointsDraggedOverThreshold >= 1) {
@@ -451,17 +451,13 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event)
// 3. Drag/translate
const QPointF centroidStartParentPos = target()->parentItem()->mapFromScene(m_centroid.sceneGrabPosition());
m_activeTranslation = QVector2D(centroidParentPos - centroidStartParentPos);
- if (!xAxis()->enabled())
- m_activeTranslation.setX(0);
- if (!yAxis()->enabled())
- m_activeTranslation.setY(0);
// apply rotation + scaling around the centroid - then apply translation.
QMatrix4x4 mat;
const QVector3D centroidParentVector(centroidParentPos);
mat.translate(centroidParentVector);
- mat.rotate(m_activeRotation, 0, 0, 1);
- mat.scale(m_activeScale);
+ mat.rotate(float(m_activeRotation), 0, 0, 1);
+ mat.scale(float(m_activeScale));
mat.translate(-centroidParentVector);
mat.translate(QVector3D(m_activeTranslation));
@@ -473,14 +469,16 @@ void QQuickPinchHandler::handlePointerEventImpl(QQuickPointerEvent *event)
if (xAxis()->enabled())
pos.setX(qBound(xAxis()->minimum(), pos.x(), xAxis()->maximum()));
+ else
+ pos.rx() -= qreal(m_activeTranslation.x());
if (yAxis()->enabled())
pos.setY(qBound(yAxis()->minimum(), pos.y(), yAxis()->maximum()));
+ else
+ pos.ry() -= qreal(m_activeTranslation.y());
target()->setPosition(pos);
target()->setRotation(rotation);
target()->setScale(m_accumulatedScale);
-
- // TODO some translation inadvertently happens; try to hold the chosen pinch origin in place
} else {
m_activeTranslation = QVector2D(m_centroid.scenePosition() - m_centroid.scenePressPosition());
}
diff --git a/src/quick/handlers/qquickpinchhandler_p.h b/src/quick/handlers/qquickpinchhandler_p.h
index 8f24d18166..b9e2cbf48f 100644
--- a/src/quick/handlers/qquickpinchhandler_p.h
+++ b/src/quick/handlers/qquickpinchhandler_p.h
@@ -150,10 +150,9 @@ private:
qreal m_startDistance = 0;
QPointF m_startPos;
qreal m_accumulatedStartCentroidDistance = 0;
-
QVector<PointData> m_startAngles;
- QMatrix4x4 m_startMatrix;
QQuickMatrix4x4 m_transform;
+ QMatrix4x4 m_startMatrix;
};
QT_END_NAMESPACE
diff --git a/src/quick/handlers/qquicksinglepointhandler.cpp b/src/quick/handlers/qquicksinglepointhandler.cpp
index 8f2f403975..c0fa39fad3 100644
--- a/src/quick/handlers/qquicksinglepointhandler.cpp
+++ b/src/quick/handlers/qquicksinglepointhandler.cpp
@@ -115,7 +115,7 @@ bool QQuickSinglePointHandler::wantsPointerEvent(QQuickPointerEvent *event)
int candidatePointCount = 0;
int c = event->pointCount();
QQuickEventPoint *chosen = nullptr;
- for (int i = 0; i < c; ++i) {
+ for (int i = 0; i < c && !chosen; ++i) {
QQuickEventPoint *p = event->point(i);
if (!p->exclusiveGrabber() && wantsEventPoint(p)) {
if (!chosen)
diff --git a/src/quick/handlers/qquicktaphandler.cpp b/src/quick/handlers/qquicktaphandler.cpp
index d480d3b491..475942b7ac 100644
--- a/src/quick/handlers/qquicktaphandler.cpp
+++ b/src/quick/handlers/qquicktaphandler.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2017 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -38,6 +38,7 @@
****************************************************************************/
#include "qquicktaphandler_p.h"
+#include "qquicksinglepointhandler_p_p.h"
#include <qpa/qplatformtheme.h>
#include <private/qguiapplication_p.h>
#include <QtGui/qstylehints.h>
@@ -312,8 +313,14 @@ void QQuickTapHandler::setPressed(bool press, bool cancel, QQuickEventPoint *poi
// on release, ungrab after emitting changed signals
setExclusiveGrab(point, press);
}
- if (cancel)
+ if (cancel) {
emit canceled(point);
+ setExclusiveGrab(point, false);
+ // In case there is a filtering parent (Flickable), we should not give up the passive grab,
+ // so that it can continue to filter future events.
+ d_func()->reset();
+ emit pointChanged();
+ }
}
}
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index cb4e7ab918..de19a927a0 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -130,10 +130,10 @@ QT_BEGIN_NAMESPACE
Q_CORE_EXPORT double qstrtod(const char *s00, char const **se, bool *ok);
-#define CHECK_CONTEXT(r) if (!r || !r->d()->context || !r->d()->context->bufferValid()) \
+#define CHECK_CONTEXT(r) if (!r || !r->d()->context() || !r->d()->context()->bufferValid()) \
THROW_GENERIC_ERROR("Not a Context2D object");
-#define CHECK_CONTEXT_SETTER(r) if (!r || !r->d()->context || !r->d()->context->bufferValid()) \
+#define CHECK_CONTEXT_SETTER(r) if (!r || !r->d()->context() || !r->d()->context()->bufferValid()) \
THROW_GENERIC_ERROR("Not a Context2D object");
#define qClamp(val, min, max) qMin(qMax(val, min), max)
#define CHECK_RGBA(c) (c == '-' || c == '.' || (c >=0 && c <= 9))
@@ -491,8 +491,29 @@ namespace QV4 {
namespace Heap {
struct QQuickJSContext2D : Object {
- void init() { Object::init(); }
- QQuickContext2D* context;
+ void init()
+ {
+ Object::init();
+ m_context = nullptr;
+ }
+
+ void destroy()
+ {
+ delete m_context;
+ Object::destroy();
+ }
+
+ QQuickContext2D *context() { return m_context ? *m_context : nullptr; }
+ void setContext(QQuickContext2D *context)
+ {
+ if (m_context)
+ *m_context = context;
+ else
+ m_context = new QPointer<QQuickContext2D>(context);
+ }
+
+private:
+ QPointer<QQuickContext2D>* m_context;
};
struct QQuickJSContext2DPrototype : Object {
@@ -543,6 +564,7 @@ struct QQuickJSContext2DImageData : Object {
struct QQuickJSContext2D : public QV4::Object
{
V4_OBJECT2(QQuickJSContext2D, QV4::Object)
+ V4_NEEDS_DESTROY
static QV4::ReturnedValue method_get_globalAlpha(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc);
static QV4::ReturnedValue method_set_globalAlpha(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc);
@@ -991,7 +1013,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_get_canvas(const QV4::Func
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::QObjectWrapper::wrap(scope.engine, r->d()->context->canvas()));
+ RETURN_RESULT(QV4::QObjectWrapper::wrap(scope.engine, r->d()->context()->canvas()));
}
/*!
@@ -1006,7 +1028,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_restore(const QV4::Functio
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- r->d()->context->popState();
+ r->d()->context()->popState();
RETURN_RESULT(thisObject->asReturnedValue());
}
@@ -1020,7 +1042,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_reset(const QV4::FunctionO
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- r->d()->context->reset();
+ r->d()->context()->reset();
RETURN_RESULT(thisObject->asReturnedValue());
}
@@ -1061,7 +1083,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_save(const QV4::FunctionOb
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- r->d()->context->pushState();
+ r->d()->context()->pushState();
RETURN_RESULT(*thisObject);
}
@@ -1091,7 +1113,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rotate(const QV4::Function
CHECK_CONTEXT(r)
if (argc >= 1)
- r->d()->context->rotate(argv[0].toNumber());
+ r->d()->context()->rotate(argv[0].toNumber());
RETURN_RESULT(*thisObject);
}
@@ -1120,7 +1142,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_scale(const QV4::FunctionO
if (argc >= 2)
- r->d()->context->scale(argv[0].toNumber(), argv[1].toNumber());
+ r->d()->context()->scale(argv[0].toNumber(), argv[1].toNumber());
RETURN_RESULT(*thisObject);
}
@@ -1167,7 +1189,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_setTransform(const QV4::Fu
if (argc >= 6)
- r->d()->context->setTransform( argv[0].toNumber()
+ r->d()->context()->setTransform( argv[0].toNumber()
, argv[1].toNumber()
, argv[2].toNumber()
, argv[3].toNumber()
@@ -1196,7 +1218,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_transform(const QV4::Funct
CHECK_CONTEXT(r)
if (argc >= 6)
- r->d()->context->transform( argv[0].toNumber()
+ r->d()->context()->transform( argv[0].toNumber()
, argv[1].toNumber()
, argv[2].toNumber()
, argv[3].toNumber()
@@ -1223,7 +1245,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_translate(const QV4::Funct
CHECK_CONTEXT(r)
if (argc >= 2)
- r->d()->context->translate(argv[0].toNumber(), argv[1].toNumber());
+ r->d()->context()->translate(argv[0].toNumber(), argv[1].toNumber());
RETURN_RESULT(*thisObject);
}
@@ -1243,7 +1265,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_resetTransform(const QV4::
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- r->d()->context->setTransform(1, 0, 0, 1, 0, 0);
+ r->d()->context()->setTransform(1, 0, 0, 1, 0, 0);
RETURN_RESULT(*thisObject);
@@ -1263,7 +1285,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_shear(const QV4::FunctionO
CHECK_CONTEXT(r)
if (argc >= 2)
- r->d()->context->shear(argv[0].toNumber(), argv[1].toNumber());
+ r->d()->context()->shear(argv[0].toNumber(), argv[1].toNumber());
RETURN_RESULT(*thisObject);
@@ -1283,7 +1305,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalAlpha(const QV4::Function
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::Encode(r->d()->context->state.globalAlpha));
+ RETURN_RESULT(QV4::Encode(r->d()->context()->state.globalAlpha));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -1298,9 +1320,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalAlpha(const QV4::Function
if (!qt_is_finite(globalAlpha))
RETURN_UNDEFINED();
- if (globalAlpha >= 0.0 && globalAlpha <= 1.0 && r->d()->context->state.globalAlpha != globalAlpha) {
- r->d()->context->state.globalAlpha = globalAlpha;
- r->d()->context->buffer()->setGlobalAlpha(r->d()->context->state.globalAlpha);
+ if (globalAlpha >= 0.0 && globalAlpha <= 1.0 && r->d()->context()->state.globalAlpha != globalAlpha) {
+ r->d()->context()->state.globalAlpha = globalAlpha;
+ r->d()->context()->buffer()->setGlobalAlpha(r->d()->context()->state.globalAlpha);
}
RETURN_UNDEFINED();
}
@@ -1337,7 +1359,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_globalCompositeOperation(const
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- RETURN_RESULT(scope.engine->newString(qt_composite_mode_to_string(r->d()->context->state.globalCompositeOperation)));
+ RETURN_RESULT(scope.engine->newString(qt_composite_mode_to_string(r->d()->context()->state.globalCompositeOperation)));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -1354,9 +1376,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_globalCompositeOperation(const
if (cm == QPainter::CompositionMode_SourceOver && mode != QLatin1String("source-over"))
RETURN_UNDEFINED();
- if (cm != r->d()->context->state.globalCompositeOperation) {
- r->d()->context->state.globalCompositeOperation = cm;
- r->d()->context->buffer()->setGlobalCompositeOperation(cm);
+ if (cm != r->d()->context()->state.globalCompositeOperation) {
+ r->d()->context()->state.globalCompositeOperation = cm;
+ r->d()->context()->buffer()->setGlobalCompositeOperation(cm);
}
RETURN_UNDEFINED();
@@ -1391,7 +1413,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(const QV4::FunctionOb
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- QColor color = r->d()->context->state.fillStyle.color();
+ QColor color = r->d()->context()->state.fillStyle.color();
if (color.isValid()) {
if (color.alpha() == 255)
RETURN_RESULT(scope.engine->newString(color.name()));
@@ -1403,7 +1425,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillStyle(const QV4::FunctionOb
QString str = QString::fromLatin1("rgba(%1, %2, %3, %4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(alphaString);
RETURN_RESULT(scope.engine->newString(str));
}
- RETURN_RESULT(r->d()->context->m_fillStyle.value());
+ RETURN_RESULT(r->d()->context()->m_fillStyle.value());
}
QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -1417,25 +1439,25 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillStyle(const QV4::FunctionOb
if (value->as<Object>()) {
QColor color = scope.engine->toVariant(value, qMetaTypeId<QColor>()).value<QColor>();
if (color.isValid()) {
- r->d()->context->state.fillStyle = color;
- r->d()->context->buffer()->setFillStyle(color);
- r->d()->context->m_fillStyle.set(scope.engine, value);
+ r->d()->context()->state.fillStyle = color;
+ r->d()->context()->buffer()->setFillStyle(color);
+ r->d()->context()->m_fillStyle.set(scope.engine, value);
} else {
QV4::Scoped<QQuickContext2DStyle> style(scope, value->as<QQuickContext2DStyle>());
- if (style && *style->d()->brush != r->d()->context->state.fillStyle) {
- r->d()->context->state.fillStyle = *style->d()->brush;
- r->d()->context->buffer()->setFillStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
- r->d()->context->m_fillStyle.set(scope.engine, value);
- r->d()->context->state.fillPatternRepeatX = style->d()->patternRepeatX;
- r->d()->context->state.fillPatternRepeatY = style->d()->patternRepeatY;
+ if (style && *style->d()->brush != r->d()->context()->state.fillStyle) {
+ r->d()->context()->state.fillStyle = *style->d()->brush;
+ r->d()->context()->buffer()->setFillStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
+ r->d()->context()->m_fillStyle.set(scope.engine, value);
+ r->d()->context()->state.fillPatternRepeatX = style->d()->patternRepeatX;
+ r->d()->context()->state.fillPatternRepeatY = style->d()->patternRepeatY;
}
}
} else if (value->isString()) {
QColor color = qt_color_from_string(value);
- if (color.isValid() && r->d()->context->state.fillStyle != QBrush(color)) {
- r->d()->context->state.fillStyle = QBrush(color);
- r->d()->context->buffer()->setFillStyle(r->d()->context->state.fillStyle);
- r->d()->context->m_fillStyle.set(scope.engine, value);
+ if (color.isValid() && r->d()->context()->state.fillStyle != QBrush(color)) {
+ r->d()->context()->state.fillStyle = QBrush(color);
+ r->d()->context()->buffer()->setFillStyle(r->d()->context()->state.fillStyle);
+ r->d()->context()->m_fillStyle.set(scope.engine, value);
}
}
RETURN_UNDEFINED();
@@ -1458,7 +1480,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_fillRule(const QV4::FunctionObj
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- RETURN_RESULT(scope.engine->fromVariant(r->d()->context->state.fillRule));
+ RETURN_RESULT(scope.engine->fromVariant(r->d()->context()->state.fillRule));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -1471,14 +1493,14 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_fillRule(const QV4::FunctionObj
if ((value->isString() && value->toQString() == QLatin1String("WindingFill"))
|| (value->isInt32() && value->integerValue() == Qt::WindingFill)) {
- r->d()->context->state.fillRule = Qt::WindingFill;
+ r->d()->context()->state.fillRule = Qt::WindingFill;
} else if ((value->isString() && value->toQStringNoThrow() == QLatin1String("OddEvenFill"))
|| (value->isInt32() && value->integerValue() == Qt::OddEvenFill)) {
- r->d()->context->state.fillRule = Qt::OddEvenFill;
+ r->d()->context()->state.fillRule = Qt::OddEvenFill;
} else {
//error
}
- r->d()->context->m_path.setFillRule(r->d()->context->state.fillRule);
+ r->d()->context()->m_path.setFillRule(r->d()->context()->state.fillRule);
RETURN_UNDEFINED();
}
/*!
@@ -1500,7 +1522,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(const QV4::Function
QV4::Scoped<QQuickJSContext2D> r(scope, thisObject->as<QQuickJSContext2D>());
CHECK_CONTEXT(r)
- QColor color = r->d()->context->state.strokeStyle.color();
+ QColor color = r->d()->context()->state.strokeStyle.color();
if (color.isValid()) {
if (color.alpha() == 255)
RETURN_RESULT(scope.engine->newString(color.name()));
@@ -1512,7 +1534,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_strokeStyle(const QV4::Function
QString str = QString::fromLatin1("rgba(%1, %2, %3, %4)").arg(color.red()).arg(color.green()).arg(color.blue()).arg(alphaString);
RETURN_RESULT(scope.engine->newString(str));
}
- RETURN_RESULT(r->d()->context->m_strokeStyle.value());
+ RETURN_RESULT(r->d()->context()->m_strokeStyle.value());
}
QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -1526,26 +1548,26 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_strokeStyle(const QV4::Function
if (value->as<Object>()) {
QColor color = scope.engine->toVariant(value, qMetaTypeId<QColor>()).value<QColor>();
if (color.isValid()) {
- r->d()->context->state.fillStyle = color;
- r->d()->context->buffer()->setStrokeStyle(color);
- r->d()->context->m_strokeStyle.set(scope.engine, value);
+ r->d()->context()->state.fillStyle = color;
+ r->d()->context()->buffer()->setStrokeStyle(color);
+ r->d()->context()->m_strokeStyle.set(scope.engine, value);
} else {
QV4::Scoped<QQuickContext2DStyle> style(scope, value->as<QQuickContext2DStyle>());
- if (style && *style->d()->brush != r->d()->context->state.strokeStyle) {
- r->d()->context->state.strokeStyle = *style->d()->brush;
- r->d()->context->buffer()->setStrokeStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
- r->d()->context->m_strokeStyle.set(scope.engine, value);
- r->d()->context->state.strokePatternRepeatX = style->d()->patternRepeatX;
- r->d()->context->state.strokePatternRepeatY = style->d()->patternRepeatY;
+ if (style && *style->d()->brush != r->d()->context()->state.strokeStyle) {
+ r->d()->context()->state.strokeStyle = *style->d()->brush;
+ r->d()->context()->buffer()->setStrokeStyle(*style->d()->brush, style->d()->patternRepeatX, style->d()->patternRepeatY);
+ r->d()->context()->m_strokeStyle.set(scope.engine, value);
+ r->d()->context()->state.strokePatternRepeatX = style->d()->patternRepeatX;
+ r->d()->context()->state.strokePatternRepeatY = style->d()->patternRepeatY;
}
}
} else if (value->isString()) {
QColor color = qt_color_from_string(value);
- if (color.isValid() && r->d()->context->state.strokeStyle != QBrush(color)) {
- r->d()->context->state.strokeStyle = QBrush(color);
- r->d()->context->buffer()->setStrokeStyle(r->d()->context->state.strokeStyle);
- r->d()->context->m_strokeStyle.set(scope.engine, value);
+ if (color.isValid() && r->d()->context()->state.strokeStyle != QBrush(color)) {
+ r->d()->context()->state.strokeStyle = QBrush(color);
+ r->d()->context()->buffer()->setStrokeStyle(r->d()->context()->state.strokeStyle);
+ r->d()->context()->m_strokeStyle.set(scope.engine, value);
}
}
RETURN_UNDEFINED();
@@ -1764,7 +1786,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createPattern(const QV4::F
patternTexture = *pixelData->d()->image;
}
} else {
- patternTexture = r->d()->context->createPixmap(QUrl(argv[0].toQStringNoThrow()))->image();
+ patternTexture = r->d()->context()->createPixmap(QUrl(argv[0].toQStringNoThrow()))->image();
}
if (!patternTexture.isNull()) {
@@ -1814,7 +1836,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineCap(const QV4::FunctionObje
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- switch (r->d()->context->state.lineCap) {
+ switch (r->d()->context()->state.lineCap) {
case Qt::RoundCap:
RETURN_RESULT(scope.engine->newString(QStringLiteral("round")));
case Qt::SquareCap:
@@ -1846,9 +1868,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineCap(const QV4::FunctionObje
else
RETURN_UNDEFINED();
- if (cap != r->d()->context->state.lineCap) {
- r->d()->context->state.lineCap = cap;
- r->d()->context->buffer()->setLineCap(cap);
+ if (cap != r->d()->context()->state.lineCap) {
+ r->d()->context()->state.lineCap = cap;
+ r->d()->context()->buffer()->setLineCap(cap);
}
RETURN_UNDEFINED();
}
@@ -1873,7 +1895,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineJoin(const QV4::FunctionObj
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- switch (r->d()->context->state.lineJoin) {
+ switch (r->d()->context()->state.lineJoin) {
case Qt::RoundJoin:
RETURN_RESULT(scope.engine->newString(QStringLiteral("round")));
case Qt::BevelJoin:
@@ -1905,9 +1927,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineJoin(const QV4::FunctionObj
else
RETURN_UNDEFINED();
- if (join != r->d()->context->state.lineJoin) {
- r->d()->context->state.lineJoin = join;
- r->d()->context->buffer()->setLineJoin(join);
+ if (join != r->d()->context()->state.lineJoin) {
+ r->d()->context()->state.lineJoin = join;
+ r->d()->context()->buffer()->setLineJoin(join);
}
RETURN_UNDEFINED();
}
@@ -1922,7 +1944,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineWidth(const QV4::FunctionOb
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::Encode(r->d()->context->state.lineWidth));
+ RETURN_RESULT(QV4::Encode(r->d()->context()->state.lineWidth));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -1933,9 +1955,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineWidth(const QV4::FunctionOb
qreal w = argc ? argv[0].toNumber() : -1;
- if (w > 0 && qt_is_finite(w) && w != r->d()->context->state.lineWidth) {
- r->d()->context->state.lineWidth = w;
- r->d()->context->buffer()->setLineWidth(w);
+ if (w > 0 && qt_is_finite(w) && w != r->d()->context()->state.lineWidth) {
+ r->d()->context()->state.lineWidth = w;
+ r->d()->context()->buffer()->setLineWidth(w);
}
RETURN_UNDEFINED();
}
@@ -1951,7 +1973,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_miterLimit(const QV4::FunctionO
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::Encode(r->d()->context->state.miterLimit));
+ RETURN_RESULT(QV4::Encode(r->d()->context()->state.miterLimit));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -1962,9 +1984,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_miterLimit(const QV4::FunctionO
qreal ml = argc ? argv[0].toNumber() : -1;
- if (ml > 0 && qt_is_finite(ml) && ml != r->d()->context->state.miterLimit) {
- r->d()->context->state.miterLimit = ml;
- r->d()->context->buffer()->setMiterLimit(ml);
+ if (ml > 0 && qt_is_finite(ml) && ml != r->d()->context()->state.miterLimit) {
+ r->d()->context()->state.miterLimit = ml;
+ r->d()->context()->buffer()->setMiterLimit(ml);
}
RETURN_UNDEFINED();
}
@@ -1982,7 +2004,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getLineDash(const QV4::Fun
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- const QVector<qreal> pattern = r->d()->context->state.lineDash;
+ const QVector<qreal> pattern = r->d()->context()->state.lineDash;
QV4::ScopedArrayObject array(scope, scope.engine->newArrayObject(pattern.size()));
array->arrayReserve(pattern.size());
for (int i = 0; i < pattern.size(); i++)
@@ -2047,8 +2069,8 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_setLineDash(const QV4::Fun
dashes += dashes;
}
- r->d()->context->state.lineDash = dashes;
- r->d()->context->buffer()->setLineDash(dashes);
+ r->d()->context()->state.lineDash = dashes;
+ r->d()->context()->buffer()->setLineDash(dashes);
RETURN_UNDEFINED();
}
@@ -2066,7 +2088,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_lineDashOffset(const QV4::Funct
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::Encode(r->d()->context->state.lineDashOffset));
+ RETURN_RESULT(QV4::Encode(r->d()->context()->state.lineDashOffset));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_lineDashOffset(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -2077,9 +2099,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_lineDashOffset(const QV4::Funct
const qreal offset = argc ? argv[0].toNumber() : -1;
- if (qt_is_finite(offset) && offset != r->d()->context->state.lineDashOffset) {
- r->d()->context->state.lineDashOffset = offset;
- r->d()->context->buffer()->setLineDashOffset(offset);
+ if (qt_is_finite(offset) && offset != r->d()->context()->state.lineDashOffset) {
+ r->d()->context()->state.lineDashOffset = offset;
+ r->d()->context()->buffer()->setLineDashOffset(offset);
}
RETURN_UNDEFINED();
}
@@ -2096,7 +2118,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowBlur(const QV4::FunctionO
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::Encode(r->d()->context->state.shadowBlur));
+ RETURN_RESULT(QV4::Encode(r->d()->context()->state.shadowBlur));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -2107,9 +2129,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowBlur(const QV4::FunctionO
qreal blur = argc ? argv[0].toNumber() : -1;
- if (blur > 0 && qt_is_finite(blur) && blur != r->d()->context->state.shadowBlur) {
- r->d()->context->state.shadowBlur = blur;
- r->d()->context->buffer()->setShadowBlur(blur);
+ if (blur > 0 && qt_is_finite(blur) && blur != r->d()->context()->state.shadowBlur) {
+ r->d()->context()->state.shadowBlur = blur;
+ r->d()->context()->buffer()->setShadowBlur(blur);
}
RETURN_UNDEFINED();
}
@@ -2124,7 +2146,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowColor(const QV4::Function
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(scope.engine->newString(r->d()->context->state.shadowColor.name()));
+ RETURN_RESULT(scope.engine->newString(r->d()->context()->state.shadowColor.name()));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -2137,9 +2159,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowColor(const QV4::Function
if (argc)
color = qt_color_from_string(argv[0]);
- if (color.isValid() && color != r->d()->context->state.shadowColor) {
- r->d()->context->state.shadowColor = color;
- r->d()->context->buffer()->setShadowColor(color);
+ if (color.isValid() && color != r->d()->context()->state.shadowColor) {
+ r->d()->context()->state.shadowColor = color;
+ r->d()->context()->buffer()->setShadowColor(color);
}
RETURN_UNDEFINED();
}
@@ -2157,7 +2179,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetX(const QV4::Functi
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::Encode(r->d()->context->state.shadowOffsetX));
+ RETURN_RESULT(QV4::Encode(r->d()->context()->state.shadowOffsetX));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -2167,9 +2189,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetX(const QV4::Functi
CHECK_CONTEXT_SETTER(r)
qreal offsetX = argc ? argv[0].toNumber() : qt_qnan();
- if (qt_is_finite(offsetX) && offsetX != r->d()->context->state.shadowOffsetX) {
- r->d()->context->state.shadowOffsetX = offsetX;
- r->d()->context->buffer()->setShadowOffsetX(offsetX);
+ if (qt_is_finite(offsetX) && offsetX != r->d()->context()->state.shadowOffsetX) {
+ r->d()->context()->state.shadowOffsetX = offsetX;
+ r->d()->context()->buffer()->setShadowOffsetX(offsetX);
}
RETURN_UNDEFINED();
}
@@ -2185,7 +2207,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_shadowOffsetY(const QV4::Functi
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(QV4::Encode(r->d()->context->state.shadowOffsetY));
+ RETURN_RESULT(QV4::Encode(r->d()->context()->state.shadowOffsetY));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -2195,9 +2217,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_shadowOffsetY(const QV4::Functi
CHECK_CONTEXT_SETTER(r)
qreal offsetY = argc ? argv[0].toNumber() : qt_qnan();
- if (qt_is_finite(offsetY) && offsetY != r->d()->context->state.shadowOffsetY) {
- r->d()->context->state.shadowOffsetY = offsetY;
- r->d()->context->buffer()->setShadowOffsetY(offsetY);
+ if (qt_is_finite(offsetY) && offsetY != r->d()->context()->state.shadowOffsetY) {
+ r->d()->context()->state.shadowOffsetY = offsetY;
+ r->d()->context()->buffer()->setShadowOffsetY(offsetY);
}
RETURN_UNDEFINED();
}
@@ -2209,7 +2231,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_path(const QV4::FunctionObject
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(r->d()->context->m_v4path.value());
+ RETURN_RESULT(r->d()->context()->m_v4path.value());
}
QV4::ReturnedValue QQuickJSContext2D::method_set_path(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -2219,16 +2241,16 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_path(const QV4::FunctionObject
CHECK_CONTEXT_SETTER(r)
QV4::ScopedValue value(scope, argc ? argv[0] : QV4::Value::undefinedValue());
- r->d()->context->beginPath();
+ r->d()->context()->beginPath();
QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, value);
if (!!qobjectWrapper) {
if (QQuickPath *path = qobject_cast<QQuickPath*>(qobjectWrapper->object()))
- r->d()->context->m_path = path->path();
+ r->d()->context()->m_path = path->path();
} else {
QString path =value->toQStringNoThrow();
- QQuickSvgParser::parsePathDataFast(path, r->d()->context->m_path);
+ QQuickSvgParser::parsePathDataFast(path, r->d()->context()->m_path);
}
- r->d()->context->m_v4path.set(scope.engine, value);
+ r->d()->context()->m_v4path.set(scope.engine, value);
RETURN_UNDEFINED();
}
#endif // QT_CONFIG(quick_path)
@@ -2246,7 +2268,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clearRect(const QV4::Funct
if (argc >= 4)
- r->d()->context->clearRect(argv[0].toNumber(),
+ r->d()->context()->clearRect(argv[0].toNumber(),
argv[1].toNumber(),
argv[2].toNumber(),
argv[3].toNumber());
@@ -2267,7 +2289,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillRect(const QV4::Functi
CHECK_CONTEXT(r)
if (argc >= 4)
- r->d()->context->fillRect(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
+ r->d()->context()->fillRect(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
RETURN_RESULT(*thisObject);
}
@@ -2289,7 +2311,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeRect(const QV4::Func
CHECK_CONTEXT(r)
if (argc >= 4)
- r->d()->context->strokeRect(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
+ r->d()->context()->strokeRect(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
RETURN_RESULT(*thisObject);
@@ -2333,7 +2355,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arc(const QV4::FunctionObj
if (qt_is_finite(radius) && radius < 0)
THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
- r->d()->context->arc(argv[0].toNumber(),
+ r->d()->context()->arc(argv[0].toNumber(),
argv[1].toNumber(),
radius,
argv[3].toNumber(),
@@ -2380,7 +2402,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_arcTo(const QV4::FunctionO
if (qt_is_finite(radius) && radius < 0)
THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "Incorrect argument radius");
- r->d()->context->arcTo(argv[0].toNumber(),
+ r->d()->context()->arcTo(argv[0].toNumber(),
argv[1].toNumber(),
argv[2].toNumber(),
argv[3].toNumber(),
@@ -2402,7 +2424,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_beginPath(const QV4::Funct
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- r->d()->context->beginPath();
+ r->d()->context()->beginPath();
RETURN_RESULT(*thisObject);
@@ -2444,7 +2466,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_bezierCurveTo(const QV4::F
if (!qt_is_finite(cp1x) || !qt_is_finite(cp1y) || !qt_is_finite(cp2x) || !qt_is_finite(cp2y) || !qt_is_finite(x) || !qt_is_finite(y))
RETURN_UNDEFINED();
- r->d()->context->bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
+ r->d()->context()->bezierCurveTo(cp1x, cp1y, cp2x, cp2y, x, y);
}
RETURN_RESULT(*thisObject);
}
@@ -2479,7 +2501,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_clip(const QV4::FunctionOb
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- r->d()->context->clip();
+ r->d()->context()->clip();
RETURN_RESULT(*thisObject);
}
@@ -2496,7 +2518,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_closePath(const QV4::Funct
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- r->d()->context->closePath();
+ r->d()->context()->closePath();
RETURN_RESULT(*thisObject);
}
@@ -2515,7 +2537,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fill(const QV4::FunctionOb
QV4::Scope scope(b);
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r);
- r->d()->context->fill();
+ r->d()->context()->fill();
RETURN_RESULT(*thisObject);
}
@@ -2537,7 +2559,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_lineTo(const QV4::Function
if (!qt_is_finite(x) || !qt_is_finite(y))
RETURN_UNDEFINED();
- r->d()->context->lineTo(x, y);
+ r->d()->context()->lineTo(x, y);
}
RETURN_RESULT(*thisObject);
@@ -2560,7 +2582,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_moveTo(const QV4::Function
if (!qt_is_finite(x) || !qt_is_finite(y))
RETURN_UNDEFINED();
- r->d()->context->moveTo(x, y);
+ r->d()->context()->moveTo(x, y);
}
RETURN_RESULT(*thisObject);
@@ -2588,7 +2610,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_quadraticCurveTo(const QV4
if (!qt_is_finite(cpx) || !qt_is_finite(cpy) || !qt_is_finite(x) || !qt_is_finite(y))
RETURN_UNDEFINED();
- r->d()->context->quadraticCurveTo(cpx, cpy, x, y);
+ r->d()->context()->quadraticCurveTo(cpx, cpy, x, y);
}
RETURN_RESULT(*thisObject);
@@ -2606,7 +2628,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_rect(const QV4::FunctionOb
CHECK_CONTEXT(r)
if (argc >= 4)
- r->d()->context->rect(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
+ r->d()->context()->rect(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
RETURN_RESULT(*thisObject);
}
@@ -2624,7 +2646,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_roundedRect(const QV4::Fun
CHECK_CONTEXT(r)
if (argc >= 6)
- r->d()->context->roundedRect(argv[0].toNumber()
+ r->d()->context()->roundedRect(argv[0].toNumber()
, argv[1].toNumber()
, argv[2].toNumber()
, argv[3].toNumber()
@@ -2649,7 +2671,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_ellipse(const QV4::Functio
CHECK_CONTEXT(r)
if (argc >= 4)
- r->d()->context->ellipse(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
+ r->d()->context()->ellipse(argv[0].toNumber(), argv[1].toNumber(), argv[2].toNumber(), argv[3].toNumber());
RETURN_RESULT(*thisObject);
@@ -2673,7 +2695,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_text(const QV4::FunctionOb
if (!qt_is_finite(x) || !qt_is_finite(y))
RETURN_UNDEFINED();
- r->d()->context->text(argv[0].toQStringNoThrow(), x, y);
+ r->d()->context()->text(argv[0].toQStringNoThrow(), x, y);
}
RETURN_RESULT(*thisObject);
@@ -2694,7 +2716,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_stroke(const QV4::Function
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- r->d()->context->stroke();
+ r->d()->context()->stroke();
RETURN_RESULT(*thisObject);
}
@@ -2714,7 +2736,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_isPointInPath(const QV4::F
bool pointInPath = false;
if (argc >= 2)
- pointInPath = r->d()->context->isPointInPath(argv[0].toNumber(), argv[1].toNumber());
+ pointInPath = r->d()->context()->isPointInPath(argv[0].toNumber(), argv[1].toNumber());
RETURN_RESULT(QV4::Value::fromBoolean(pointInPath).asReturnedValue());
}
@@ -2765,7 +2787,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_font(const QV4::FunctionObject
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- RETURN_RESULT(scope.engine->newString(r->d()->context->state.font.toString()));
+ RETURN_RESULT(scope.engine->newString(r->d()->context()->state.font.toString()));
}
QV4::ReturnedValue QQuickJSContext2D::method_set_font(const QV4::FunctionObject *b, const QV4::Value *thisObject, const QV4::Value *argv, int argc)
@@ -2777,9 +2799,9 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_font(const QV4::FunctionObject
QV4::ScopedString s(scope, argc ? argv[0] : QV4::Value::undefinedValue(), QV4::ScopedString::Convert);
if (scope.engine->hasException)
RETURN_UNDEFINED();
- QFont font = qt_font_from_string(s->toQString(), r->d()->context->state.font);
- if (font != r->d()->context->state.font) {
- r->d()->context->state.font = font;
+ QFont font = qt_font_from_string(s->toQString(), r->d()->context()->state.font);
+ if (font != r->d()->context()->state.font) {
+ r->d()->context()->state.font = font;
}
RETURN_UNDEFINED();
}
@@ -2804,7 +2826,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textAlign(const QV4::FunctionOb
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- switch (r->d()->context->state.textAlign) {
+ switch (r->d()->context()->state.textAlign) {
case QQuickContext2D::End:
RETURN_RESULT(scope.engine->newString(QStringLiteral("end")));
case QQuickContext2D::Left:
@@ -2845,8 +2867,8 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textAlign(const QV4::FunctionOb
else
RETURN_UNDEFINED();
- if (ta != r->d()->context->state.textAlign)
- r->d()->context->state.textAlign = ta;
+ if (ta != r->d()->context()->state.textAlign)
+ r->d()->context()->state.textAlign = ta;
RETURN_UNDEFINED();
}
@@ -2872,7 +2894,7 @@ QV4::ReturnedValue QQuickJSContext2D::method_get_textBaseline(const QV4::Functio
QV4::Scoped<QQuickJSContext2D> r(scope, *thisObject);
CHECK_CONTEXT(r)
- switch (r->d()->context->state.textBaseline) {
+ switch (r->d()->context()->state.textBaseline) {
case QQuickContext2D::Hanging:
RETURN_RESULT(scope.engine->newString(QStringLiteral("hanging")));
case QQuickContext2D::Top:
@@ -2912,8 +2934,8 @@ QV4::ReturnedValue QQuickJSContext2D::method_set_textBaseline(const QV4::Functio
else
RETURN_UNDEFINED();
- if (tb != r->d()->context->state.textBaseline)
- r->d()->context->state.textBaseline = tb;
+ if (tb != r->d()->context()->state.textBaseline)
+ r->d()->context()->state.textBaseline = tb;
RETURN_UNDEFINED();
}
@@ -2937,8 +2959,8 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_fillText(const QV4::Functi
qreal y = argv[2].toNumber();
if (!qt_is_finite(x) || !qt_is_finite(y))
RETURN_UNDEFINED();
- QPainterPath textPath = r->d()->context->createTextGlyphs(x, y, argv[0].toQStringNoThrow());
- r->d()->context->buffer()->fill(textPath);
+ QPainterPath textPath = r->d()->context()->createTextGlyphs(x, y, argv[0].toQStringNoThrow());
+ r->d()->context()->buffer()->fill(textPath);
}
RETURN_RESULT(*thisObject);
@@ -2958,7 +2980,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_strokeText(const QV4::Func
CHECK_CONTEXT(r)
if (argc >= 3)
- r->d()->context->drawText(argv[0].toQStringNoThrow(), argv[1].toNumber(), argv[2].toNumber(), false);
+ r->d()->context()->drawText(argv[0].toQStringNoThrow(), argv[1].toNumber(), argv[2].toNumber(), false);
RETURN_RESULT(*thisObject);
}
@@ -2976,7 +2998,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_measureText(const QV4::Fun
CHECK_CONTEXT(r)
if (argc >= 1) {
- QFontMetrics fm(r->d()->context->state.font);
+ QFontMetrics fm(r->d()->context()->state.font);
uint width = fm.horizontalAdvance(argv[0].toQStringNoThrow());
QV4::ScopedObject tm(scope, scope.engine->newObject());
tm->put(QV4::ScopedString(scope, scope.engine->newIdentifier(QStringLiteral("width"))).getPointer(),
@@ -3057,7 +3079,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(const QV4::Funct
RETURN_UNDEFINED();
//FIXME:This function should be moved to QQuickContext2D::drawImage(...)
- if (!r->d()->context->state.invertibleCTM)
+ if (!r->d()->context()->state.invertibleCTM)
RETURN_UNDEFINED();
QQmlRefPointer<QQuickCanvasPixmap> pixmap;
@@ -3068,12 +3090,12 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(const QV4::Funct
if (!url.isValid())
THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
- pixmap = r->d()->context->createPixmap(url);
+ pixmap = r->d()->context()->createPixmap(url);
} else if (arg->isObject()) {
QV4::Scoped<QV4::QObjectWrapper> qobjectWrapper(scope, arg);
if (!!qobjectWrapper) {
if (QQuickImage *imageItem = qobject_cast<QQuickImage*>(qobjectWrapper->object())) {
- pixmap = r->d()->context->createPixmap(imageItem->source());
+ pixmap = r->d()->context()->createPixmap(imageItem->source());
} else if (QQuickCanvasItem *canvas = qobject_cast<QQuickCanvasItem*>(qobjectWrapper->object())) {
QImage img = canvas->toImage();
if (!img.isNull())
@@ -3093,7 +3115,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(const QV4::Funct
} else {
QUrl url(arg->toQStringNoThrow());
if (url.isValid())
- pixmap = r->d()->context->createPixmap(url);
+ pixmap = r->d()->context()->createPixmap(url);
else
THROW_DOM(DOMEXCEPTION_TYPE_MISMATCH_ERR, "drawImage(), type mismatch");
}
@@ -3156,7 +3178,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(const QV4::Funct
THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "drawImage(), index size error");
}
- r->d()->context->buffer()->drawPixmap(pixmap, QRectF(sx, sy, sw, sh), QRectF(dx, dy, dw, dh));
+ r->d()->context()->buffer()->drawPixmap(pixmap, QRectF(sx, sy, sw, sh), QRectF(dx, dy, dw, dh));
RETURN_RESULT(*thisObject);
}
@@ -3367,7 +3389,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createImageData(const QV4:
RETURN_RESULT(qt_create_image_data(w, h, scope.engine, QImage()));
}
} else if (arg0->isString()) {
- QImage image = r->d()->context->createPixmap(QUrl(arg0->toQStringNoThrow()))->image();
+ QImage image = r->d()->context()->createPixmap(QUrl(arg0->toQStringNoThrow()))->image();
RETURN_RESULT(qt_create_image_data(image.width(), image.height(), scope.engine, image));
}
} else if (argc == 2) {
@@ -3406,7 +3428,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_getImageData(const QV4::Fu
if (w <= 0 || h <= 0)
THROW_DOM(DOMEXCEPTION_INDEX_SIZE_ERR, "getImageData(): Invalid arguments");
- QImage image = r->d()->context->canvas()->toImage(QRectF(x, y, w, h));
+ QImage image = r->d()->context()->canvas()->toImage(QRectF(x, y, w, h));
RETURN_RESULT(qt_create_image_data(w, h, scope.engine, image));
}
RETURN_RESULT(QV4::Encode::null());
@@ -3492,7 +3514,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_putImageData(const QV4::Fu
}
QImage image = pixelArray->d()->image->copy(dirtyX, dirtyY, dirtyWidth, dirtyHeight);
- r->d()->context->buffer()->drawImage(image, QRectF(dirtyX, dirtyY, dirtyWidth, dirtyHeight), QRectF(dx, dy, dirtyWidth, dirtyHeight));
+ r->d()->context()->buffer()->drawImage(image, QRectF(dirtyX, dirtyY, dirtyWidth, dirtyHeight), QRectF(dx, dy, dirtyWidth, dirtyHeight));
}
RETURN_RESULT(*thisObject);
@@ -4538,7 +4560,7 @@ void QQuickContext2D::setV4Engine(QV4::ExecutionEngine *engine)
QV4::Scoped<QQuickJSContext2D> wrapper(scope, engine->memoryManager->allocate<QQuickJSContext2D>());
QV4::ScopedObject p(scope, ed->contextPrototype.value());
wrapper->setPrototypeOf(p);
- wrapper->d()->context = this;
+ wrapper->d()->setContext(this);
m_v4value = wrapper;
}
}
diff --git a/src/quick/items/qquickborderimage.cpp b/src/quick/items/qquickborderimage.cpp
index e4e766a129..b840328184 100644
--- a/src/quick/items/qquickborderimage.cpp
+++ b/src/quick/items/qquickborderimage.cpp
@@ -600,7 +600,7 @@ void QQuickBorderImagePrivate::calculateRects(const QQuickScaleGrid *border,
if (borderTop + borderBottom > sourceSize.height() && borderTop < sourceSize.height())
borderBottom = sourceSize.height() - borderTop;
*innerSourceRect = QRectF(QPointF(borderLeft / qreal(sourceSize.width()),
- borderTop * devicePixelRatio / qreal(sourceSize.height())),
+ borderTop / qreal(sourceSize.height())),
QPointF((sourceSize.width() - borderRight) / qreal(sourceSize.width()),
(sourceSize.height() - borderBottom) / qreal(sourceSize.height()))),
*innerTargetRect = QRectF(border->left(),
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp
index 85045be411..cf882e8c9e 100644
--- a/src/quick/items/qquickflickable.cpp
+++ b/src/quick/items/qquickflickable.cpp
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -61,6 +61,8 @@
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcHandlerParent)
+
// FlickThreshold determines how far the "mouse" must have moved
// before we perform a flick.
static const int FlickThreshold = 15;
@@ -1897,6 +1899,8 @@ void QQuickFlickablePrivate::data_append(QQmlListProperty<QObject> *prop, QObjec
{
if (QQuickItem *i = qmlobject_cast<QQuickItem *>(o)) {
i->setParentItem(static_cast<QQuickFlickablePrivate*>(prop->data)->contentItem);
+ } else if (QQuickPointerHandler *pointerHandler = qmlobject_cast<QQuickPointerHandler *>(o)) {
+ static_cast<QQuickFlickablePrivate*>(prop->data)->addPointerHandler(pointerHandler);
} else {
o->setParent(prop->object); // XXX todo - do we want this?
}
@@ -2356,6 +2360,14 @@ void QQuickFlickablePrivate::cancelInteraction()
}
}
+void QQuickFlickablePrivate::addPointerHandler(QQuickPointerHandler *h)
+{
+ Q_Q(const QQuickFlickable);
+ qCDebug(lcHandlerParent) << "reparenting handler" << h << "to contentItem of" << q;
+ h->setParent(contentItem);
+ QQuickItemPrivate::get(contentItem)->addPointerHandler(h);
+}
+
/*!
QQuickFlickable::filterMouseEvent checks filtered mouse events and potentially steals them.
diff --git a/src/quick/items/qquickflickable_p.h b/src/quick/items/qquickflickable_p.h
index 7e9b18e101..c54ed5ce71 100644
--- a/src/quick/items/qquickflickable_p.h
+++ b/src/quick/items/qquickflickable_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
diff --git a/src/quick/items/qquickflickable_p_p.h b/src/quick/items/qquickflickable_p_p.h
index c538cf7878..835c54170f 100644
--- a/src/quick/items/qquickflickable_p_p.h
+++ b/src/quick/items/qquickflickable_p_p.h
@@ -1,6 +1,6 @@
/****************************************************************************
**
-** Copyright (C) 2016 The Qt Company Ltd.
+** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the QtQuick module of the Qt Toolkit.
@@ -206,6 +206,8 @@ public:
void cancelInteraction();
+ void addPointerHandler(QQuickPointerHandler *h) override;
+
public:
QQuickItem *contentItem;
diff --git a/src/quick/items/qquickitem_p.h b/src/quick/items/qquickitem_p.h
index 4ca3a01d02..771228914b 100644
--- a/src/quick/items/qquickitem_p.h
+++ b/src/quick/items/qquickitem_p.h
@@ -281,7 +281,7 @@ public:
bool hasPointerHandlers() const;
bool hasHoverHandlers() const;
- void addPointerHandler(QQuickPointerHandler *h);
+ virtual void addPointerHandler(QQuickPointerHandler *h);
// data property
static void data_append(QQmlListProperty<QObject> *, QObject *);
diff --git a/src/quick/scenegraph/util/qsgatlastexture.cpp b/src/quick/scenegraph/util/qsgatlastexture.cpp
index 66c6d3a882..921ed0c1fc 100644
--- a/src/quick/scenegraph/util/qsgatlastexture.cpp
+++ b/src/quick/scenegraph/util/qsgatlastexture.cpp
@@ -517,8 +517,8 @@ Texture::Texture(Atlas *atlas, const QRect &textureRect, const QImage &image)
, m_nonatlas_texture(nullptr)
, m_has_alpha(image.hasAlphaChannel())
{
- float w = atlas->size().width();
- float h = atlas->size().height();
+ qreal w = atlas->size().width();
+ qreal h = atlas->size().height();
QRect nopad = atlasSubRectWithoutPadding();
m_texture_coords_rect = QRectF(nopad.x() / w,
nopad.y() / h,
diff --git a/src/quick/util/qquickpath.cpp b/src/quick/util/qquickpath.cpp
index 53b72d1e58..60d725d650 100644
--- a/src/quick/util/qquickpath.cpp
+++ b/src/quick/util/qquickpath.cpp
@@ -2007,7 +2007,7 @@ void QQuickPathAngleArc::setCenterY(qreal centerY)
return;
_centerY = centerY;
- emit centerXChanged();
+ emit centerYChanged();
emit changed();
}
diff --git a/src/quickshapes/qquickshape.cpp b/src/quickshapes/qquickshape.cpp
index 0c159ec21b..489d1c86f7 100644
--- a/src/quickshapes/qquickshape.cpp
+++ b/src/quickshapes/qquickshape.cpp
@@ -53,16 +53,16 @@ QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(QQSHAPE_LOG_TIME_DIRTY_SYNC, "qt.shape.time.sync")
/*!
- \qmlmodule QtQuick.Shapes 1.11
+ \qmlmodule QtQuick.Shapes 1.\QtMinorVersion
\title Qt Quick Shapes QML Types
\ingroup qmlmodules
\brief Provides QML types for drawing stroked and filled shapes.
To use the types in this module, import the module with the following line:
- \badcode
- import QtQuick.Shapes 1.11
- \endcode
+ \qml \QtMinorVersion
+ import QtQuick.Shapes 1.\1
+ \endqml
*/
QQuickShapeStrokeFillParams::QQuickShapeStrokeFillParams()