summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThierry Bastian <thierry.bastian@nokia.com>2010-12-22 23:00:15 (GMT)
committerThierry Bastian <thierry.bastian@nokia.com>2010-12-22 23:00:15 (GMT)
commit8565d6d123227615312a791ae7acc5b252db264a (patch)
treeb7e26b73dca82687509ba873dbebfd7c205b5646
parent4c47a46be986681225b67faa73f957276636cc30 (diff)
parentbe8ad40ff0594118a5f5a883fcfff35e28c21a30 (diff)
downloadQt-8565d6d123227615312a791ae7acc5b252db264a.zip
Qt-8565d6d123227615312a791ae7acc5b252db264a.tar.gz
Qt-8565d6d123227615312a791ae7acc5b252db264a.tar.bz2
Merge branch '4.7-upstream' into 4.7-water
-rw-r--r--doc/src/declarative/basictypes.qdoc95
-rw-r--r--doc/src/declarative/extending.qdoc24
-rw-r--r--doc/src/declarative/qdeclarativereference.qdoc81
-rw-r--r--qmake/generators/symbian/symbiancommon.cpp2
-rw-r--r--src/gui/image/qpixmap.cpp4
-rw-r--r--src/gui/painting/qdrawhelper.cpp133
-rw-r--r--src/s60main/newallocator_hook.cpp12
7 files changed, 228 insertions, 123 deletions
diff --git a/doc/src/declarative/basictypes.qdoc b/doc/src/declarative/basictypes.qdoc
index 034b7d1..e9d3a44 100644
--- a/doc/src/declarative/basictypes.qdoc
+++ b/doc/src/declarative/basictypes.qdoc
@@ -95,6 +95,26 @@
*/
/*!
+ \qmlbasictype double
+ \ingroup qmlbasictypes
+
+ \brief A double number has a decimal point and is stored in double precision.
+
+ A double number has a decimal point and is stored in double precision, \l
+ {http://en.wikipedia.org/wiki/IEEE_754} {IEEE floating point}
+ format.
+
+ Example:
+ \qml
+ Item {
+ property double number: 32155.2355
+ }
+ \endqml
+
+ \sa {QML Basic Types}
+*/
+
+/*!
\qmlbasictype string
\ingroup qmlbasictypes
@@ -412,7 +432,8 @@
list only modify a \e copy of the list and not the actual list. (These current limitations
are due to restrictions on \l {Property Binding} where lists are involved.)
- To create a modifiable list, create an array object from within a \c .js JavaScript file,
+ You can, however, modify a copy of the list and then reassign the property to the modified
+ value. Other options are to create an array object from within a \c .js JavaScript file,
or implement a custom list element in C++. Here is a QML element that modifies the list in a
JavaScript file:
@@ -452,6 +473,78 @@
\sa {QML Basic Types}
*/
+
+/*!
+ \qmlbasictype variant
+ \ingroup qmlbasictypes
+
+ \brief A variant type is a generic property type.
+
+ A variant is a generic property type. A variant type property can hold any of the
+ \l {QML Basic Types}{basic type} values:
+
+ \qml
+ Item {
+ property variant aNumber : 100
+ property variant aString : "Hello world!"
+ property variant aList : [ 1, 2, "buckle my shoe" ]
+ }
+ \endqml
+
+ The \c variant type can also hold a \e copy of a JavaScript object. For example, the
+ \c animal property below defines a JavaScript object defined with JSON notation. The
+ object's properties and values can be examined using the standard JavaScript syntax,
+ as shown in the \c Component.onCompleted handler.
+
+ \qml
+ Item {
+ property variant animal : { 'type': 'bird', 'species': 'galah', 'age': 7 }
+
+ Component.onCompleted: {
+ for (var attribute in animal)
+ console.log(attribute, "=", animal[attribute])
+ }
+ }
+ \endqml
+
+ It must be noted that the \c animal property holds a \e copy of the defined object, and
+ not the object itself. (This is true even if the property refers to an object defined in
+ some JavaScript file; the property will hold a copy of the object, and not the actual
+ object.) The property essentially holds a copy of the contents within the object. This
+ has several implications:
+
+ \list
+ \o Changes to any of the property's values (for example, the \c animal.type value
+ above) only modify the \e copy of the object, not the object itself. You can, however,
+ modify a copy of the object and then reassign the property to the modified value.
+ \o Because the property only holds a copy of the object, \l{Property Binding}{bindings} to
+ any of the property's individual values are not updated until the whole property is
+ reassigned to a new value. For example:
+
+ \qml
+ Item {
+ property variant animal : { 'type': 'bird', 'species': 'galah', 'age': 7 }
+
+ Text { text: "Animal species: " + animal.species }
+
+ Component.onCompleted: {
+ animal.species = 'kookaburra' // this has no effect on the displayed text
+
+ var newObj = animal
+ newObj.species = 'kookaburra'
+ animal = newObj // this will update the displayed text
+ }
+ }
+ \endqml
+ \o Since the object values are copied, it does not hold any reference to the original
+ object, and extra data such as the object's JavaScript prototype chain is lost in the
+ process.
+ \endlist
+
+ \sa {QML Basic Types}
+*/
+
+
/*!
\qmlbasictype vector3d
\ingroup qmlbasictypes
diff --git a/doc/src/declarative/extending.qdoc b/doc/src/declarative/extending.qdoc
index 748ec6c..ff519f6 100644
--- a/doc/src/declarative/extending.qdoc
+++ b/doc/src/declarative/extending.qdoc
@@ -753,15 +753,15 @@ with their default values and the corresponding C++ type:
\table
\header \o QML Type Name \o Default value \o C++ Type Name
-\row \o int \o 0 \o int
-\row \o bool \o \c false \o bool
-\row \o double \o 0.0 \o double
-\row \o real \o 0.0 \o double
-\row \o string \o "" (empty string) \o QString
-\row \o url \o "" (empty url) \o QUrl
-\row \o color \o #000000 (black) \o QColor
-\row \o date \o \c undefined \o QDateTime
-\row \o variant \o \c undefined \o QVariant
+\row \o \l int \o 0 \o int
+\row \o \l bool \o \c false \o bool
+\row \o \l double \o 0.0 \o double
+\row \o \l real \o 0.0 \o double
+\row \o \l string \o "" (empty string) \o QString
+\row \o \l url \o "" (empty url) \o QUrl
+\row \o \l color \o #000000 (black) \o QColor
+\row \o \l date \o \c undefined \o QDateTime
+\row \o \l variant \o \c undefined \o QVariant
\endtable
QML object types can also be used as property types. This includes
@@ -776,6 +776,10 @@ property MyCustomType customProperty
Such object-type properties default to an \c undefined value.
+It is also possible to store a copy of a JavaScript object using the \c variant
+property type. This creates some restrictions on how the property should be used;
+see the \l {variant}{variant type documentation} for details.
+
\l{list}{List properties} are created with the \c list<Type> syntax, and default to an empty
list:
@@ -786,8 +790,6 @@ property list<Item> listOfItems
Note that list properties cannot be modified like ordinary JavaScript
arrays. See the \l {list}{list type documentation} for details.
-For details about accessing and manipulating QML properties from C++, see \l {Using QML with C++}.
-
\section2 Property change signals
diff --git a/doc/src/declarative/qdeclarativereference.qdoc b/doc/src/declarative/qdeclarativereference.qdoc
deleted file mode 100644
index c2c5e91..0000000
--- a/doc/src/declarative/qdeclarativereference.qdoc
+++ /dev/null
@@ -1,81 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
-** All rights reserved.
-** Contact: Nokia Corporation (qt-info@nokia.com)
-**
-** This file is part of the documentation of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:FDL$
-** No Commercial Usage
-** This file contains pre-release code and may not be distributed.
-** You may use this file in accordance with the terms and conditions
-** contained in the Technology Preview License Agreement accompanying
-** this package.
-**
-** GNU Free Documentation License
-** Alternatively, this file may be used under the terms of the GNU Free
-** Documentation License version 1.3 as published by the Free Software
-** Foundation and appearing in the file included in the packaging of this
-** file.
-**
-** If you have questions regarding the use of this file, please contact
-** Nokia at qt-info@nokia.com.
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-/*!
- \page qdeclarativereference.html
- \title QML Reference
-
- \target qtdeclarativemainpage
-
- QML is a language for building the animation rich,
- highly fluid user interfaces that are becoming common in portable consumer
- electronics devices such as mobile phones, media players, set-top boxes and
- netbooks. It is also appropriate for highly custom desktop
- user interfaces, or special elements in more traditional desktop user interfaces.
-
- Building fluid applications is done declaratively, rather than procedurally.
- That is, you specify \e what the UI should look like and how it should behave
- rather than specifying step-by-step \e how to build it. Specifying a UI declaratively
- does not just include the layout of the interface items, but also the way each
- individual item looks and behaves and the overall flow of the application.
-
- The QML elements provide a sophisticated set of graphical and behavioral building
- blocks. These different elements are combined together in \l {QML Documents}{QML documents} to build components
- ranging in complexity from simple buttons and sliders, to complete
- internet-enabled applications like a \l {http://www.flickr.com}{Flickr} photo browser.
-
- Getting Started:
- \list
- \o \l {Introduction to the QML language}
- \o \l {QML Tutorial}{Tutorial: 'Hello World'}
- \o \l {QML Advanced Tutorial}{Advanced Tutorial: 'Same Game'}
- \o \l {QML Examples and Demos}
- \endlist
-
- \section1 Core QML Features:
- \list
- \o \l {QML Documents}
- \o \l {Property Binding}
- \o \l {Integrating JavaScript}
- \o \l {QML Scope}
- \o \l {Network Transparency}
- \o \l {qmlmodels}{Data Models}
- \o \l {anchor-layout}{Anchor-based Layout}
- \o \l {qmlstates}{States}
- \o \l {qdeclarativeanimation.html}{Animation}
- \o \l {qdeclarativemodules.html}{Modules}
- \o \l {qmlfocus}{Keyboard Focus}
- \o \l {Extending types from QML}
- \endlist
-
- QML Reference:
- \list
- \o \l {elements}{QML Elements}
- \o \l {QML Global Object}
- \o \l {QML Internationalization}
- \endlist
-*/
diff --git a/qmake/generators/symbian/symbiancommon.cpp b/qmake/generators/symbian/symbiancommon.cpp
index 602bcc2..d9f12b3 100644
--- a/qmake/generators/symbian/symbiancommon.cpp
+++ b/qmake/generators/symbian/symbiancommon.cpp
@@ -977,7 +977,7 @@ bool SymbianCommonGenerator::parseTsContent(const QString &tsFilename, SymbianLo
QXmlStreamReader xml(&tsFile);
- while (xml.name() != tsElement)
+ while (!xml.atEnd() && xml.name() != tsElement)
xml.readNextStartElement();
while (xml.readNextStartElement()) {
diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp
index c5d9a7e..3a7be1d 100644
--- a/src/gui/image/qpixmap.cpp
+++ b/src/gui/image/qpixmap.cpp
@@ -775,8 +775,8 @@ QBitmap QPixmap::createHeuristicMask(bool clipTight) const
/*!
Creates and returns a mask for this pixmap based on the given \a
maskColor. If the \a mode is Qt::MaskInColor, all pixels matching the
- maskColor will be opaque. If \a mode is Qt::MaskOutColor, all pixels
- matching the maskColor will be transparent.
+ maskColor will be transparent. If \a mode is Qt::MaskOutColor, all pixels
+ matching the maskColor will be opaque.
This function is slow because it involves converting to/from a
QImage.
diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp
index 62af212..fdb686d 100644
--- a/src/gui/painting/qdrawhelper.cpp
+++ b/src/gui/painting/qdrawhelper.cpp
@@ -712,6 +712,38 @@ static inline uint interpolate_4_pixels_16(uint tl, uint tr, uint bl, uint br, i
}
#endif
+#if defined(QT_ALWAYS_HAVE_NEON)
+#define interpolate_4_pixels_16_neon(tl, tr, bl, br, distx, disty, disty_, colorMask, invColorMask, v_256, b) \
+{ \
+ const int16x8_t dxdy = vmulq_s16(distx, disty); \
+ const int16x8_t distx_ = vshlq_n_s16(distx, 4); \
+ const int16x8_t idxidy = vaddq_s16(dxdy, vsubq_s16(v_256, vaddq_s16(distx_, disty_))); \
+ const int16x8_t dxidy = vsubq_s16(distx_, dxdy); \
+ const int16x8_t idxdy = vsubq_s16(disty_, dxdy); \
+ \
+ int16x8_t tlAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(tl), 8)); \
+ int16x8_t tlRB = vandq_s16(tl, colorMask); \
+ int16x8_t trAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(tr), 8)); \
+ int16x8_t trRB = vandq_s16(tr, colorMask); \
+ int16x8_t blAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(bl), 8)); \
+ int16x8_t blRB = vandq_s16(bl, colorMask); \
+ int16x8_t brAG = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(br), 8)); \
+ int16x8_t brRB = vandq_s16(br, colorMask); \
+ \
+ int16x8_t rAG = vmulq_s16(tlAG, idxidy); \
+ int16x8_t rRB = vmulq_s16(tlRB, idxidy); \
+ rAG = vmlaq_s16(rAG, trAG, dxidy); \
+ rRB = vmlaq_s16(rRB, trRB, dxidy); \
+ rAG = vmlaq_s16(rAG, blAG, idxdy); \
+ rRB = vmlaq_s16(rRB, blRB, idxdy); \
+ rAG = vmlaq_s16(rAG, brAG, dxdy); \
+ rRB = vmlaq_s16(rRB, brRB, dxdy); \
+ \
+ rAG = vandq_s16(invColorMask, rAG); \
+ rRB = vreinterpretq_s16_u16(vshrq_n_u16(vreinterpretq_u16_s16(rRB), 8)); \
+ vst1q_s16((int16_t*)(b), vorrq_s16(rAG, rRB)); \
+}
+#endif
template<TextureBlendType blendType>
Q_STATIC_TEMPLATE_FUNCTION inline void fetchTransformedBilinear_pixelBounds(int max, int l1, int l2, int &v1, int &v2)
@@ -920,35 +952,36 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
const uchar *s2 = data->texture.scanLine(y2);
int disty = (fy & 0x0000ffff) >> 12;
-#if defined(QT_ALWAYS_HAVE_SSE2)
if (blendType != BlendTransformedBilinearTiled &&
(format == QImage::Format_ARGB32_Premultiplied || format == QImage::Format_RGB32)) {
- //prolog to get into the bounds
- while (b < end) {
- int x1 = (fx >> 16);
- int x2;
- fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2);
- if (x1 != x2) //break if we are insided the bounds.
- break;
- uint tl = fetch(s1, x1, data->texture.colorTable);
- uint tr = fetch(s1, x2, data->texture.colorTable);
- uint bl = fetch(s2, x1, data->texture.colorTable);
- uint br = fetch(s2, x2, data->texture.colorTable);
- int distx = (fx & 0x0000ffff) >> 12;
- *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty);
- fx += fdx;
- ++b;
- }
- uint *boundedEnd;
- if (fdx > 0)
- boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11));
- else
- boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11));
+#define BILINEAR_DOWNSCALE_BOUNDS_PROLOG \
+ while (b < end) { \
+ int x1 = (fx >> 16); \
+ int x2; \
+ fetchTransformedBilinear_pixelBounds<blendType>(image_width, image_x1, image_x2, x1, x2); \
+ if (x1 != x2) \
+ break; \
+ uint tl = fetch(s1, x1, data->texture.colorTable); \
+ uint tr = fetch(s1, x2, data->texture.colorTable); \
+ uint bl = fetch(s2, x1, data->texture.colorTable); \
+ uint br = fetch(s2, x2, data->texture.colorTable); \
+ int distx = (fx & 0x0000ffff) >> 12; \
+ *b = interpolate_4_pixels_16(tl, tr, bl, br, distx, disty); \
+ fx += fdx; \
+ ++b; \
+ } \
+ uint *boundedEnd; \
+ if (fdx > 0) \
+ boundedEnd = qMin(end, buffer + uint((image_x2 - (fx >> 16)) / data->m11)); \
+ else \
+ boundedEnd = qMin(end, buffer + uint((image_x1 - (fx >> 16)) / data->m11)); \
boundedEnd -= 3;
+#if defined(QT_ALWAYS_HAVE_SSE2)
+ BILINEAR_DOWNSCALE_BOUNDS_PROLOG
+
const __m128i colorMask = _mm_set1_epi32(0x00ff00ff);
- //const __m128i distShuffleMask = _mm_set_epi8(13, 12, 13, 12, 9, 8, 9, 8, 5, 4, 5, 4, 1, 0, 1, 0);
const __m128i v_256 = _mm_set1_epi16(256);
const __m128i v_disty = _mm_set1_epi16(disty);
__m128i v_fdx = _mm_set1_epi32(fdx*4);
@@ -976,8 +1009,7 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
bl.i[i] = *(addr_tl+secondLine);
br.i[i] = *(addr_tr+secondLine);
}
- __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12); //distx = (fx & 0x0000ffff) >> 12;
- //v_distx = _mm_shuffle_epi8(v_disty, distShuffleMask); //distx |= distx << 16;
+ __m128i v_distx = _mm_srli_epi16(v_fx.vect, 12);
v_distx = _mm_shufflehi_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
v_distx = _mm_shufflelo_epi16(v_distx, _MM_SHUFFLE(2,2,0,0));
@@ -986,8 +1018,57 @@ const uint * QT_FASTCALL fetchTransformedBilinear(uint *buffer, const Operator *
v_fx.vect = _mm_add_epi32(v_fx.vect, v_fdx);
}
fx = v_fx.i[0];
- }
+#elif defined(QT_ALWAYS_HAVE_NEON)
+ BILINEAR_DOWNSCALE_BOUNDS_PROLOG
+
+ const int16x8_t colorMask = vdupq_n_s16(0x00ff);
+ const int16x8_t invColorMask = vmvnq_s16(colorMask);
+ const int16x8_t v_256 = vdupq_n_s16(256);
+ const int16x8_t v_disty = vdupq_n_s16(disty);
+ const int16x8_t v_disty_ = vshlq_n_s16(v_disty, 4);
+ int32x4_t v_fdx = vdupq_n_s32(fdx*4);
+
+ ptrdiff_t secondLine = reinterpret_cast<const uint *>(s2) - reinterpret_cast<const uint *>(s1);
+
+ union Vect_buffer { int32x4_t vect; quint32 i[4]; };
+ Vect_buffer v_fx;
+
+ for (int i = 0; i < 4; i++) {
+ v_fx.i[i] = fx;
+ fx += fdx;
+ }
+
+ const int32x4_t v_ffff_mask = vdupq_n_s32(0x0000ffff);
+
+ while (b < boundedEnd) {
+
+ Vect_buffer tl, tr, bl, br;
+
+ Vect_buffer v_fx_shifted;
+ v_fx_shifted.vect = vshrq_n_s32(v_fx.vect, 16);
+
+ int32x4_t v_distx = vshrq_n_s32(vandq_s32(v_fx.vect, v_ffff_mask), 12);
+
+ for (int i = 0; i < 4; i++) {
+ int x1 = v_fx_shifted.i[i];
+ const uint *addr_tl = reinterpret_cast<const uint *>(s1) + x1;
+ const uint *addr_tr = addr_tl + 1;
+ tl.i[i] = *addr_tl;
+ tr.i[i] = *addr_tr;
+ bl.i[i] = *(addr_tl+secondLine);
+ br.i[i] = *(addr_tr+secondLine);
+ }
+
+ v_distx = vorrq_s32(v_distx, vshlq_n_s32(v_distx, 16));
+
+ interpolate_4_pixels_16_neon(vreinterpretq_s16_s32(tl.vect), vreinterpretq_s16_s32(tr.vect), vreinterpretq_s16_s32(bl.vect), vreinterpretq_s16_s32(br.vect), vreinterpretq_s16_s32(v_distx), v_disty, v_disty_, colorMask, invColorMask, v_256, b);
+ b+=4;
+ v_fx.vect = vaddq_s32(v_fx.vect, v_fdx);
+ }
+ fx = v_fx.i[0];
#endif
+ }
+
while (b < end) {
int x1 = (fx >> 16);
int x2;
diff --git a/src/s60main/newallocator_hook.cpp b/src/s60main/newallocator_hook.cpp
index 9ea2ef0..3e259c2 100644
--- a/src/s60main/newallocator_hook.cpp
+++ b/src/s60main/newallocator_hook.cpp
@@ -69,6 +69,16 @@ TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
// So the function is found and called dynamically, by library lookup. If it is not found, we
// use the OS allocator creation functions instead.
+#if defined(QT_LIBINFIX)
+# define QT_LSTRING2(x) L##x
+# define QT_LSTRING(x) QT_LSTRING2(x)
+# define QT_LIBINFIX_UNICODE QT_LSTRING(QT_LIBINFIX)
+#else
+# define QT_LIBINFIX_UNICODE L""
+#endif
+
+_LIT(QtCoreLibName, "qtcore" QT_LIBINFIX_UNICODE L".dll");
+
struct SThreadCreateInfo
{
TAny* iHandle;
@@ -106,7 +116,7 @@ TInt UserHeap::SetupThreadHeap(TBool aNotFirst, SStdEpocThreadCreateInfo& aInfo)
#ifndef __WINS__
// attempt to create the fast allocator through a known export ordinal in qtcore.dll
RLibrary qtcore;
- if (qtcore.Load(_L("qtcore.dll")) == KErrNone)
+ if (qtcore.Load(QtCoreLibName) == KErrNone)
{
const int qt_symbian_SetupThreadHeap_eabi_ordinal = 3713;
TLibraryFunction libFunc = qtcore.Lookup(qt_symbian_SetupThreadHeap_eabi_ordinal);