Commit Graph

9805 Commits

Author SHA1 Message Date
Robin Burchell 5352f67ffa qmltime: Correct module name in error message.
Change-Id: Icccad866bdbaf53bf2cb3f1aff30ecd9ff6d06a5
Reviewed-by: Michael Brasser <michael.brasser@live.com>
2015-01-06 22:26:59 +01:00
Jocelyn Turcotte a832461468 Fix the vertex ordering of merged triangle strips
Culling and gl_FrontFacing depend on the vertex order matching the
value set through glFrontFace. To match the default counter-clockwise
order we need to preserve the parity of triangles relatively to the
start of the indices argument of glDrawElements, but we break this
parity because of the degenerate triangles between merged strips.

Fix the issue by skipping the first degenerate triangle, the parity
of following strips will be preserved since they are then separated
by two triangles.

This fixes a regression of
tests/manual/scenegraph_lancelot/data/shaders/culling/culling_1.qml
triggered by 38cab579a0.

Change-Id: Iefa7eaab68112d31be9d8646bd288eb000528cd5
Reviewed-by: Gunnar Sletta <gunnar@sletta.org>
2015-01-06 18:26:21 +01:00
Gunnar Sletta a371bac3fb Reuse the memory we use for vertex uploads.
Every batch would have its own buffer with its own memory
and the original idea was that it would stabilize so that
the same batch would be used over and over, so the memory
allocatd for each batch's buffer would be reused. In practice
batches get discarded and recycled in somewhat arbitrary
order so we always end up reallocating.

Instead, use a single buffer for all uploads. This saves us several
reallocations per frame, and also prevents pooling of several
potentially large allocated blocks inside the renderer.

The exception is when using visualization or for drivers
which have broken index buffer support (nouveau only currently),
where we keep the existing behavior as the buffer data is
needed during rendering and visualization.

Change-Id: Id29095e00128ec1ee6d4ac3caa8f2c17cc7bbd27
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2015-01-06 17:18:27 +01:00
hjk ba455b8e1c Some minimal changes to make qmlpuppet compile again
Access to QJSEnginePrivate::createCache and the previous
signature of QQmlPropertyCache::invalidate is used.

Change-Id: Ie2578eee33ee4ebb2cdc4574d8d1cb7c8209868e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
2015-01-06 10:55:33 +01:00
Gunnar Sletta d8a09da9a4 Remove bogus assert.
It is perfectly valid to reparent nodes to a parent
that is part of an existing hierarchy.

Change-Id: Icf2dbe6030d399047e7ebe735e3096d1a8cd8c0e
Task-number: QTBUG-43278
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
2015-01-05 15:26:39 +01:00
Gunnar Sletta 01cb25953d Traverse children correctly when reparenting.
Since the children are being removed from the parent, using
nextSibling on the child won't work. We need to extract the
first child from the parent until there are no more children
left.

Change-Id: Ifca5f2760e2b1c7ba56c198623c5dc9d82c7560f
Task-number: QTBUG-42530
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
2015-01-05 15:26:38 +01:00
Albert Astals Cid c7ab634fc7 Add propertyName to error
May help a bit to the reader, even if the line is already there
sometimes it can be confusing if it is a default property like data

Change-Id: I5cb8e8833c78a784ad4f5541d094840477e8f350
Reviewed-by: Robin Burchell <robin.burchell@viroteck.net>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-05 12:02:21 +01:00
Oleg Shparber 2fe82c505d Use QV4::ScopedObject typedef instead of actual type
Change-Id: I0b68c534ea513a7c230b12114f6b42b069f9864b
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-03 23:29:57 +01:00
Oleg Shparber 4a9ed3de7d Use QV4::ScopedArrayObject typedef instead of actual type
Change-Id: I975536745ac6c264aca074f84d223fbec7682d3d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-03 23:29:51 +01:00
Oleg Shparber 21d481c209 Use QV4::ScopedContext typedef instead of actual type
Change-Id: I71c6c9cf030e347fbc5e4073e9ca338a9ce95999
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:29:48 +01:00
Oleg Shparber 2fadffdc46 Use QV4::ScopedFunctionObject typedef instead of actual type
Change-Id: I6b4effaa5bef992b4ae9402eea7fe655bc7b18f0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:29:41 +01:00
Oleg Shparber 29c0102adb Use QV4::ScopedString typedef instead of actual type
Change-Id: I64ecbf6cea463387a70e909ecc5f9165d22a7b0f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:29:09 +01:00
Thiago Macieira d0db6dc2b7 Fix build: include <qdatastream.h> before using QDataStream
Change-Id: I779e0cd705f664368b47763d4367b9dc377c1770
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:11:29 +01:00
Lars Knoll 46e028bb45 Remove unused variable
Change-Id: I399e66822f52e35d122d3a20bb8de20206e5864d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:11:12 +01:00
Lars Knoll 1443b0566e Add a direct accessor to retrieve the JS engine from the ExecutionEngine
Change-Id: I2617143e39f354657e12541f3796a583e9934118
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:11:06 +01:00
Lars Knoll 3d11162fba Reduce v8engine dependency in the type wrapper
Change-Id: I3a50aa3c0929c14ad856463635bf2fb2188f5c9f
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:11:01 +01:00
Lars Knoll 545338b21c Reduce v8engine dependency in qv4include
Change-Id: Idc50e7ed9e0de5c8742688c8493c2124075450ee
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:10:55 +01:00
Lars Knoll b9b12af83f Remove v8engine dependency in fromVariant conversions
Change-Id: I3427129dc7a0e68c8fa0b61f353835e2bee179a0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:10:50 +01:00
Lars Knoll 2056538fea Remove v8engine dependency in toVariant conversions
Change-Id: I0f2f77c9cc268a0c5ca3ffe0cd66fc98bb1964b3
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 21:10:43 +01:00
Nobuaki Sukegawa 96178192c4 Do not cause SegFault when importing empty javascript
Change-Id: I31f6571e73b5dd74bf3ade5cadc2daa02475b5cb
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-02 15:31:11 +01:00
Simon Hausmann 2b5fb18562 Enable gadget wrapping for custom value types
[ChangeLog][QtQml] Custom C++ value types annotated with Q_GADGET are now fully
accessible in the QML and QJSEngine JavaScript environment.

QJSEngine::toScriptValue can be used for injection and fromScriptValue to
extraction. The QML "built-in" gadget wrappers for QPoint and the gui types are
not exposed this way, toScriptValue(point) will still return an opaque QVariant
wrapper. We could expose the core types right away, but then we would be
lacking an API to enable use of the Gui types that are registered in QtQuick.

It would be better to make the core types in qtbase gadgets and thus enable
them without the need for hooks and init functions to be called by the user.

Task-number: QTBUG-29769
Change-Id: I8179cd599bdc1209ff61cfdbdda419cb400296bb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2015-01-02 15:06:46 +01:00
Lars Knoll 9a2701c1c3 Remove v8engine dependency from qv4serialize.*
Change-Id: I5b4c1247286bf18c96df3b68b7bae9feefbbdbc9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-01 21:36:48 +01:00
Lars Knoll 05b5f4bc16 Don't store a v8engine pointer in qqmllistwrapper
Change-Id: I21b055deb74aafff8b2ee1cdce776e06f154dcaa
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-01 21:36:44 +01:00
Lars Knoll 032619e115 Remove unused enum value
Change-Id: I1e1a34a974cea129fcf4513c0a163254d6c114cd
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-01 21:36:41 +01:00
Lars Knoll 645d9e9632 Fix constructions of QJSEngine objects
The private class is not empty anymore, so calling the wrong
constructor would lead to memory corruption

Change-Id: I6d477fc63bba46be733273f548397c2a50ef2bf4
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2015-01-01 21:36:36 +01:00
Oleg Shparber 07d714f3ca Make QV4::Value::isNaN() inline
Change-Id: Ia80d3b150822ec9b3965c981d58660567ca73ec1
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-31 09:20:50 +01:00
Robin Burchell 132cdfa69c QV4::InternalClass: reserve space for transitions.
Profiling of allocations shows that this is one of the most frequent allocators.

Change-Id: Iae0350c61bfe37381577642b9a93064377f45c1d
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-31 05:07:08 +01:00
Simon Hausmann efc3cc717a Make QQmlPropertyCache available in QJSEngine
The QQmlEngine has two containers for property caches, one for QML types and
one for all-purpose meta-objects. The latter is rather useful and now being
moved to QJSEngine to be available there.

Change-Id: Ieab65c400b8a2e410e5f9eee6d603162dbb864d9
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-29 14:39:22 +01:00
Simon Hausmann 65953304a2 Prepare for QQmlPropertyCache to become available in QJSEngine
The cache is seemingly tied to QQmlEngine, but it isn't. A lot of
times a QQmlEngine parameter is unnecessarily dragged around and the
engine member is option as well as it turns out.

Change-Id: Iffd2a5046e9785249689ebfcbc8a0ad509f76aea
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-29 13:57:28 +01:00
Konstantin Ritt 802a996693 Fix build on MinGW
- alloca() needs malloc.h
- crtdbg.h couldn't be found on MinGW

Change-Id: Ibbf91a58d39ef1e2572baae3c409393acf7aa5df
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-28 18:46:59 +01:00
Simon Hausmann b7bcde88a3 Removed usage of QQmlValueType in QQmlValueTypeWrapper
QQmlValueType doesn't have anything really necessary :). Some code it has, but
that was only called from the wrapper, so it was moved there. This also reduces
one level of memory allocation for the wrapper.

In theory the allocation for the JavaScript wrapper could be changed to be the
size of the wrapper _plus_ the size needed for the gadget. However in
anticipation of wanting to be able to move objects, we can't do that as we
can't memmove() gadgets around - they might contain pointers to memory areas
within.

Change-Id: Icb5a6f5513e3b2c87f6639f6f7b1fb572af08137
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-28 18:39:51 +01:00
Oleg Shparber 7dd5895854 Make QV4::CallData::argument() method constant
Change-Id: Id2640f6a0c08069764baeac606a25fdb53b23419
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-27 09:40:45 +01:00
Tasuku Suzuki f8beab1d73 support XMLHttpRequest sync mode
[ChangeLog][QtQml][XMLHttpRequest] Supported synchronous requests

Change-Id: Ia38fcf97f212a14657bb519240d8406368a72390
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-26 04:39:46 +01:00
Simon Hausmann d641008d04 Prepare method invocation in QObject bindings for gadget support
In order to support calling invokable methods in gadgets from JavaScript, the
wrapper code needs to be able to operate on gadgets and not only QObject
pointers. The minimal abstraction for that - QQmlGadgetOrObject - is passed
through the relevant invocation methods in the wrapper for that.

Change-Id: I94f939c942241f49dce4d32d05bf24822b2d331b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-23 14:51:17 +01:00
Simon Hausmann c9adc7661a Move methodParameterTypes and methodReturnType helper functions
These can extract the type information from either a property cache (through
QQmlData from a QObject) or (fallback) from a QMetaObject.  The difference
between a QMetaObject and a QQmlPropertyCache is what QQmlMetaObject abstracts
and therefore we can move the functions there.  This is in preparation for
gadget support and also avoids the repeated QQmlData::get() dance but allows
the re-use of a QQmlMetaObject instance in the future to do that dance only
once.

Change-Id: Ibff6ce498d09fabc97e0801653edc5b1ff446c6a
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-23 14:51:04 +01:00
Simon Hausmann e66cf24a8d Reduce dependencies on QQmlValueType being a QObject
Don't rely on caching the property cache in the QQmlData of the value type,
instead we can cache is in the engine and store it in our object data.

Change-Id: I5f31313c066cd7918caf33e3fabdf5aac71f1adb
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-23 14:50:55 +01:00
Shawn Rutledge 4c9eaa24a5 Photosurface example: scale and rotate the frame, not the image
The size of the border around the image could otherwise change
dramatically, because the PinchArea was zooming the image.
It's conceivable that the frame could follow the image in scale and
rotation, but that doesn't work as long as the image is inside the
frame, because changing scale and rotation of the parent affects the
child too.  So it follows that the scale and rotation of the image
should never be directly set.  This helps the apparent size of the
white border around each image to be visually consistent.  Another
advantage is that the the image centroid doesn't tend to move,
so compensation is not necessary.

Change-Id: Ib7767e369097b32f006274add73ac544aedaf839
Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
2014-12-23 09:44:19 +01:00
Simon Hausmann cc904ba66c Further value type wrapper cleanups
Removed the QV8Engine * member in QQmlValueTypeWrapper.

Change-Id: I37cc131a3ff0279240b227c11a6b74bfc7bf4960
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-23 08:36:37 +01:00
Simon Hausmann a77526aac1 Begin cleaning up QQmlValueTypeWrapper
Get rid of the objectType member. Instead of checking for it and then
static_cast'ing to the specific class, it's easier to use Managed's as<>
template cast.

Also elimiate the QVariant value member for ValueTypeWrapperCopy. In fact, the
entire class is folded into ValueTypeWrapper itself as d()->type has the one
copy of the data.

Change-Id: I0d9c794400095830540d313187623b98b686f4cd
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-23 08:36:16 +01:00
Simon Hausmann 8906d90d8f Cleanup: Fix value type wrapper class name
It's supposed to be QQmlFoo instead of QmlFoo. While all this code is being
touched, we might as well fix the name.

Change-Id: Ia8be0c6ec46e114f7559c1e7a07a9d368932999e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-23 05:44:53 +01:00
Michael Brasser 5adb406bdd Fix QQmlProperty to work correctly with deeply nested objects.
Don't keep reusing the top-level object to look up nested properties.
This allows code such as the following to work correctly:

PropertyChanges {
    target: myObject
    textChild.font.pixelSize: 24
}

Change-Id: I39e52dbc20d2409fc756a36e668fcf664eb1905f
Reviewed-by: Brett Stottlemyer <bstottle@ford.com>
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-23 00:58:51 +01:00
Simon Hausmann fa3cf15e05 Initial work on gadget support
Changed built-in QtQml value types to use gadgets. This is in preparation for
supporting external gadgets.

This replaces the mostly direct inheritance of the concrete value types with
gadgets and "dynamic" inheritance through QQmlValueType being generic. Over
time as some of the value types may become gadgets, we can remove the ones
here. It's important that these "separate" gadgets have the same memory layout
as the actual types (QPointF, etc.).

Also while QQmlValueType remains practically a singleton, it's not required
anymore to be one. Consequently the JS wrappers for value types keep their own
instance of QQmlValueType. This allows eliminating the qobject_cast in various
places that dealt with the singleton nature. This comes at a cost, making the
JS wrappers slightly heavier. However that is meant to be a temporary situation
and finally the value type wrapper should merely store the meta-object in
addition to the data and the type.

Change-Id: I15071ded0a1e54203f29ec1ecf7a9ab646d1168e
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
2014-12-22 21:48:11 +01:00
Nobuaki Sukegawa ee771dda2e Add files generated by tests to gitignore
Change-Id: I1fac4df1e00cbe37c0c9ea69562dffc1eb4d5111
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 20:24:25 +01:00
Nobuaki Sukegawa eff84a13af Resolve type names inside guard property of SignalTransition
SignalTransition's guard is evaluated against ad-hoc QQmlContext because
it needs signal args added to its contextProperty.
Since QQmlContext created this way does not have import type cache, we
could not use type names inside guard.
To avoid this problem, this patch makes guard's context inherit parent's
type cahce.

Change-Id: I4ddd559779681b53d4ee42f4820d05438addb5ac
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 20:24:03 +01:00
Lars Knoll e7b66a6058 Make Managed inherit Value
This completes the first milestone towards being able to move
objects across the GC heap.

Change-Id: I8e6ce90254ea767188a31f0dc85b133534c87eb0
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 15:16:39 +01:00
Lars Knoll 74c658bb63 Make Property uses GC safe
Change-Id: I5aa41a07a2d25e5c8a2d64bfa58a55fcd7aaf77e
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 12:00:39 +01:00
Lars Knoll 965fac4418 Store a heap object in the qmlextensions
Change-Id: I5ad9236378ff1e037945d024ee5bd6629dddec4d
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 12:00:33 +01:00
Lars Knoll 2fe06148f2 Store a pointer to a heap object in the context wrapper
Change-Id: I2555e3e78e429260129d83894ca94d158c5e1704
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 12:00:26 +01:00
Lars Knoll 234e933b15 Use pointers to Heap object to avoid recursion
Change-Id: If491b35ba43758bd4792166f7213cd5a11d227d9
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 12:00:19 +01:00
Lars Knoll 4a194d4251 Use Scoped values a bit more consistently
Mainly cleanups, but also one or two potential places that could
lead to issues with a moving GC.

Change-Id: Ia388420052cd1a642120773f582bf21965830613
Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
2014-12-20 12:00:11 +01:00