aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-20 13:36:33 +0100
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2013-11-20 13:36:53 +0100
commit79ba800108e53b4012e66bbfa93ee12db4815c75 (patch)
tree3d7794ebbef03c86fb4619b7e514ad64230650a3 /src/quick/items
parentc8a688a56da4404397cb0579715f9db5c53c3540 (diff)
parent8ae390e75bf589b1591cdf5caa77b254b9ac0d8a (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'src/quick/items')
-rw-r--r--src/quick/items/context2d/qquickcontext2d.cpp4
-rw-r--r--src/quick/items/items.pri8
-rw-r--r--src/quick/items/items.qrc6
-rw-r--r--src/quick/items/qquickitem.cpp7
-rw-r--r--src/quick/items/qquickscreen.cpp35
-rw-r--r--src/quick/items/qquickwindow.cpp46
-rw-r--r--src/quick/items/shaders/shadereffect_core.frag13
-rw-r--r--src/quick/items/shaders/shadereffect_core.vert14
-rw-r--r--src/quick/items/shaders/shadereffectfallback_core.frag8
-rw-r--r--src/quick/items/shaders/shadereffectfallback_core.vert10
-rw-r--r--src/quick/items/shaders/sprite_core.frag16
-rw-r--r--src/quick/items/shaders/sprite_core.vert24
12 files changed, 150 insertions, 41 deletions
diff --git a/src/quick/items/context2d/qquickcontext2d.cpp b/src/quick/items/context2d/qquickcontext2d.cpp
index 908e0c91a4..2a9e0f2ac2 100644
--- a/src/quick/items/context2d/qquickcontext2d.cpp
+++ b/src/quick/items/context2d/qquickcontext2d.cpp
@@ -1660,7 +1660,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_createConicalGradient(QV4:
QV8Engine *engine = ctx->engine->v8Engine;
- if (ctx->callData->argc == 6) {
+ if (ctx->callData->argc == 3) {
qreal x = ctx->callData->args[0].toNumber();
qreal y = ctx->callData->args[1].toNumber();
qreal angle = DEGREES(ctx->callData->args[2].toNumber());
@@ -2981,7 +2981,7 @@ QV4::ReturnedValue QQuickJSContext2DPrototype::method_drawImage(QV4::CallContext
} else if (arg->isObject()) {
if (QV4::Referenced<QV4::QObjectWrapper> qobjectWrapper = arg->asRef<QV4::QObjectWrapper>()) {
if (QQuickImage *imageItem = qobject_cast<QQuickImage*>(qobjectWrapper->object())) {
- pixmap.take(r->context->createPixmap(imageItem->source()));
+ pixmap = r->context->createPixmap(imageItem->source());
} else if (QQuickCanvasItem *canvas = qobject_cast<QQuickCanvasItem*>(qobjectWrapper->object())) {
QImage img = canvas->toImage();
if (!img.isNull())
diff --git a/src/quick/items/items.pri b/src/quick/items/items.pri
index d0ebbcfcdb..3996512f9d 100644
--- a/src/quick/items/items.pri
+++ b/src/quick/items/items.pri
@@ -145,7 +145,13 @@ OTHER_FILES += \
$$PWD/shaders/shadereffect.vert \
$$PWD/shaders/shadereffect.frag \
$$PWD/shaders/shadereffectfallback.vert \
- $$PWD/shaders/shadereffectfallback.frag
+ $$PWD/shaders/shadereffectfallback.frag \
+ $$PWD/shaders/sprite_core.vert \
+ $$PWD/shaders/sprite_core.frag \
+ $$PWD/shaders/shadereffect_core.vert \
+ $$PWD/shaders/shadereffect_core.frag \
+ $$PWD/shaders/shadereffectfallback_core.vert \
+ $$PWD/shaders/shadereffectfallback_core.frag
RESOURCES += \
$$PWD/items.qrc
diff --git a/src/quick/items/items.qrc b/src/quick/items/items.qrc
index 837cffb65a..671d8acdbb 100644
--- a/src/quick/items/items.qrc
+++ b/src/quick/items/items.qrc
@@ -6,5 +6,11 @@
<file>shaders/shadereffect.frag</file>
<file>shaders/shadereffectfallback.frag</file>
<file>shaders/shadereffectfallback.vert</file>
+ <file>shaders/shadereffect_core.frag</file>
+ <file>shaders/shadereffect_core.vert</file>
+ <file>shaders/shadereffectfallback_core.frag</file>
+ <file>shaders/shadereffectfallback_core.vert</file>
+ <file>shaders/sprite_core.frag</file>
+ <file>shaders/sprite_core.vert</file>
</qresource>
</RCC>
diff --git a/src/quick/items/qquickitem.cpp b/src/quick/items/qquickitem.cpp
index 55ba25c63f..c11bf904be 100644
--- a/src/quick/items/qquickitem.cpp
+++ b/src/quick/items/qquickitem.cpp
@@ -3827,7 +3827,12 @@ void QQuickItem::setBaselineOffset(qreal offset)
void QQuickItem::update()
{
Q_D(QQuickItem);
- Q_ASSERT(flags() & ItemHasContents);
+ if (!(flags() & ItemHasContents)) {
+#ifndef QT_NO_DEBUG
+ qWarning() << metaObject()->className() << ": Update called for a item without content";
+#endif
+ return;
+ }
d->dirty(QQuickItemPrivate::Content);
}
diff --git a/src/quick/items/qquickscreen.cpp b/src/quick/items/qquickscreen.cpp
index e32f31308e..48c0f8e084 100644
--- a/src/quick/items/qquickscreen.cpp
+++ b/src/quick/items/qquickscreen.cpp
@@ -52,7 +52,7 @@ QT_BEGIN_NAMESPACE
/*!
\qmltype Screen
\instantiates QQuickScreenAttached
- \inqmlmodule QtQuick.Window 2
+ \inqmlmodule QtQuick.Window
\ingroup qtquick-visual-utility
\brief The Screen attached object provides information about the Screen an Item or Window is displayed on.
@@ -80,26 +80,26 @@ QT_BEGIN_NAMESPACE
*/
/*!
- \qmlattachedproperty String QtQuick.Window::Screen::name
+ \qmlattachedproperty string Screen::name
\readonly
\since 5.1
The name of the screen.
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::width
+ \qmlattachedproperty int Screen::width
\readonly
This contains the width of the screen in pixels.
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::height
+ \qmlattachedproperty int Screen::height
\readonly
This contains the height of the screen in pixels.
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::desktopAvailableWidth
+ \qmlattachedproperty int Screen::desktopAvailableWidth
\readonly
\since 5.1
@@ -113,7 +113,7 @@ QT_BEGIN_NAMESPACE
\endqml
*/
/*!
- \qmlattachedproperty int QtQuick.Window::Screen::desktopAvailableHeight
+ \qmlattachedproperty int Screen::desktopAvailableHeight
\readonly
\since 5.1
@@ -127,23 +127,30 @@ QT_BEGIN_NAMESPACE
\endqml
*/
/*!
- \qmlattachedproperty real QtQuick.Window::Screen::logicalPixelDensity
+ \qmlattachedproperty real Screen::logicalPixelDensity
\readonly
\since 5.1
+ \deprecated
- The number of logical pixels per millimeter. Logical pixels are the
- usual units in QML; on some systems they may be different than physical
- pixels.
+ The number of logical pixels per millimeter. This is the effective pixel
+ density provided by the platform to use in image scaling calculations.
+
+ Due to inconsistencies in how logical pixel density is handled across
+ the various platforms Qt supports, it is recommended to
+ use physical pixels instead (via the \c pixelDensity property) for
+ portability.
+
+ \sa pixelDensity
*/
/*!
- \qmlattachedproperty real QtQuick.Window::Screen::pixelDensity
+ \qmlattachedproperty real Screen::pixelDensity
\readonly
\since 5.2
The number of physical pixels per millimeter.
*/
/*!
- \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window::Screen::primaryOrientation
+ \qmlattachedproperty Qt::ScreenOrientation Screen::primaryOrientation
\readonly
This contains the primary orientation of the screen. If the
@@ -160,7 +167,7 @@ QT_BEGIN_NAMESPACE
automatically, so again you will see the primaryOrientation change.
*/
/*!
- \qmlattachedproperty Qt::ScreenOrientation QtQuick.Window::Screen::orientation
+ \qmlattachedproperty Qt::ScreenOrientation Screen::orientation
\readonly
This contains the current orientation of the screen, from the accelerometer
@@ -174,7 +181,7 @@ QT_BEGIN_NAMESPACE
\l Item.transform to rotate your content.
*/
/*!
- \qmlattachedmethod int QtQuick.Window::Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
+ \qmlattachedmethod int Screen::angleBetween(Qt::ScreenOrientation a, Qt::ScreenOrientation b)
Returns the rotation angle, in degrees, between the two specified angles.
*/
diff --git a/src/quick/items/qquickwindow.cpp b/src/quick/items/qquickwindow.cpp
index 28a5df789f..41a1781394 100644
--- a/src/quick/items/qquickwindow.cpp
+++ b/src/quick/items/qquickwindow.cpp
@@ -865,7 +865,7 @@ void QQuickWindowPrivate::cleanup(QSGNode *n)
/*!
\qmltype Window
\instantiates QQuickWindow
- \inqmlmodule QtQuick.Window 2
+ \inqmlmodule QtQuick.Window
\ingroup qtquick-visual
\brief Creates a new top-level window
@@ -2114,7 +2114,7 @@ bool QQuickWindowPrivate::dragOverThreshold(qreal d, Qt::Axis axis, QMouseEvent
}
/*!
- \qmlproperty list<Object> QtQuick.Window::Window::data
+ \qmlproperty list<Object> Window::data
\default
The data property allows you to freely mix visual children, resources
@@ -2631,7 +2631,7 @@ QOpenGLContext *QQuickWindow::openglContext() const
/*!
\qmltype CloseEvent
\instantiates QQuickCloseEvent
- \inqmlmodule QtQuick.Window 2
+ \inqmlmodule QtQuick.Window
\ingroup qtquick-visual
\brief Notification that a \l Window is about to be closed
\since 5.1
@@ -2644,7 +2644,7 @@ QOpenGLContext *QQuickWindow::openglContext() const
*/
/*!
- \qmlproperty bool QtQuick.Window::CloseEvent::accepted
+ \qmlproperty bool CloseEvent::accepted
This property indicates whether the application will allow the user to
close the window. It is true by default.
@@ -2659,7 +2659,7 @@ QOpenGLContext *QQuickWindow::openglContext() const
*/
/*!
- \qmlsignal QtQuick.Window::closing(CloseEvent close)
+ \qmlsignal closing(CloseEvent close)
\since 5.1
This signal is emitted when the user tries to close the window.
@@ -3019,7 +3019,7 @@ QSGTexture *QQuickWindow::createTextureFromId(uint id, const QSize &size, Create
}
/*!
- \qmlproperty color QtQuick.Window::Window::color
+ \qmlproperty color Window::color
The background color for the window.
@@ -3148,7 +3148,7 @@ void QQuickWindow::resetOpenGLState()
}
/*!
- \qmlproperty string QtQuick.Window::Window::title
+ \qmlproperty string Window::title
The window's title in the windowing system.
@@ -3159,7 +3159,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Qt::WindowModality QtQuick.Window::Window::modality
+ \qmlproperty Qt::WindowModality Window::modality
The modality of the window.
@@ -3169,7 +3169,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Qt::WindowFlags QtQuick.Window::Window::flags
+ \qmlproperty Qt::WindowFlags Window::flags
The window flags of the window.
@@ -3182,10 +3182,10 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty int QtQuick.Window::Window::x
- \qmlproperty int QtQuick.Window::Window::y
- \qmlproperty int QtQuick.Window::Window::width
- \qmlproperty int QtQuick.Window::Window::height
+ \qmlproperty int Window::x
+ \qmlproperty int Window::y
+ \qmlproperty int Window::width
+ \qmlproperty int Window::height
Defines the window's position and size.
@@ -3200,8 +3200,8 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty int QtQuick.Window::Window::minimumWidth
- \qmlproperty int QtQuick.Window::Window::minimumHeight
+ \qmlproperty int Window::minimumWidth
+ \qmlproperty int Window::minimumHeight
\since 5.1
Defines the window's minimum size.
@@ -3211,8 +3211,8 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty int QtQuick.Window::Window::maximumWidth
- \qmlproperty int QtQuick.Window::Window::maximumHeight
+ \qmlproperty int Window::maximumWidth
+ \qmlproperty int Window::maximumHeight
\since 5.1
Defines the window's maximum size.
@@ -3222,7 +3222,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty bool QtQuick.Window::Window::visible
+ \qmlproperty bool Window::visible
Whether the window is visible on the screen.
@@ -3232,7 +3232,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty QWindow::Visibility QtQuick.Window::Window::visibility
+ \qmlproperty QWindow::Visibility Window::visibility
The screen-occupation state of the window.
@@ -3252,7 +3252,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Qt::ScreenOrientation QtQuick.Window::Window::contentOrientation
+ \qmlproperty Qt::ScreenOrientation Window::contentOrientation
This is a hint to the window manager in case it needs to display
additional content like popups, dialogs, status bars, or similar
@@ -3273,7 +3273,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty real QtQuick.Window::Window::opacity
+ \qmlproperty real Window::opacity
The opacity of the window.
@@ -3290,7 +3290,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty Item QtQuick.Window::Window::activeFocusItem
+ \qmlproperty Item Window::activeFocusItem
\since 5.1
The item which currently has active focus or \c null if there is
@@ -3298,7 +3298,7 @@ void QQuickWindow::resetOpenGLState()
*/
/*!
- \qmlproperty QtQuick.Window::Window::active
+ \qmlproperty Window::active
\since 5.1
The active status of the window.
diff --git a/src/quick/items/shaders/shadereffect_core.frag b/src/quick/items/shaders/shadereffect_core.frag
new file mode 100644
index 0000000000..2163753edc
--- /dev/null
+++ b/src/quick/items/shaders/shadereffect_core.frag
@@ -0,0 +1,13 @@
+#version 150 core
+
+in vec2 qt_TexCoord0;
+
+out vec4 fragColor;
+
+uniform sampler2D source;
+uniform float qt_Opacity;
+
+void main()
+{
+ fragColor = texture(source, qt_TexCoord0) * qt_Opacity;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffect_core.vert b/src/quick/items/shaders/shadereffect_core.vert
new file mode 100644
index 0000000000..2ed2d47b5f
--- /dev/null
+++ b/src/quick/items/shaders/shadereffect_core.vert
@@ -0,0 +1,14 @@
+#version 150 core
+
+in vec4 qt_Vertex;
+in vec2 qt_MultiTexCoord0;
+
+out vec2 qt_TexCoord0;
+
+uniform mat4 qt_Matrix;
+
+void main()
+{
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ gl_Position = qt_Matrix * qt_Vertex;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffectfallback_core.frag b/src/quick/items/shaders/shadereffectfallback_core.frag
new file mode 100644
index 0000000000..4abf124737
--- /dev/null
+++ b/src/quick/items/shaders/shadereffectfallback_core.frag
@@ -0,0 +1,8 @@
+#version 150 core
+
+out vec4 fragColor;
+
+void main()
+{
+ fragColor = vec4(1., 0., 1., 1.);
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/shadereffectfallback_core.vert b/src/quick/items/shaders/shadereffectfallback_core.vert
new file mode 100644
index 0000000000..b1ca84cc6d
--- /dev/null
+++ b/src/quick/items/shaders/shadereffectfallback_core.vert
@@ -0,0 +1,10 @@
+#version 150 core
+
+in vec4 v;
+
+uniform mat4 qt_Matrix;
+
+void main()
+{
+ gl_Position = qt_Matrix * v;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/sprite_core.frag b/src/quick/items/shaders/sprite_core.frag
new file mode 100644
index 0000000000..c1087a8754
--- /dev/null
+++ b/src/quick/items/shaders/sprite_core.frag
@@ -0,0 +1,16 @@
+#version 150 core
+
+in vec4 fTexS;
+in float progress;
+
+out vec4 fragColor;
+
+uniform sampler2D _qt_texture;
+uniform float qt_Opacity;
+
+void main()
+{
+ fragColor = mix(texture(_qt_texture, fTexS.xy),
+ texture(_qt_texture, fTexS.zw),
+ progress) * qt_Opacity;
+} \ No newline at end of file
diff --git a/src/quick/items/shaders/sprite_core.vert b/src/quick/items/shaders/sprite_core.vert
new file mode 100644
index 0000000000..5027bf03fc
--- /dev/null
+++ b/src/quick/items/shaders/sprite_core.vert
@@ -0,0 +1,24 @@
+#version 150 core
+
+in vec2 vPos;
+in vec2 vTex;
+
+out vec4 fTexS;
+out float progress;
+
+uniform vec3 animData; // w,h(premultiplied of anim), interpolation progress
+uniform vec4 animPos; // x,y, x,y (two frames for interpolation)
+uniform mat4 qt_Matrix;
+
+void main()
+{
+ progress = animData.z;
+
+ // Calculate frame location in texture
+ fTexS.xy = animPos.xy + vTex.xy * animData.xy;
+
+ // Next frame is also passed, for interpolation
+ fTexS.zw = animPos.zw + vTex.xy * animData.xy;
+
+ gl_Position = qt_Matrix * vec4(vPos.x, vPos.y, 0, 1);
+} \ No newline at end of file