diff options
Diffstat (limited to 'src/quick/util')
-rw-r--r-- | src/quick/util/qquickanimator.cpp | 3 | ||||
-rw-r--r-- | src/quick/util/qquickanimator_p.h | 6 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob.cpp | 32 | ||||
-rw-r--r-- | src/quick/util/qquickanimatorjob_p.h | 7 | ||||
-rw-r--r-- | src/quick/util/qquickutilmodule.cpp | 3 |
5 files changed, 27 insertions, 24 deletions
diff --git a/src/quick/util/qquickanimator.cpp b/src/quick/util/qquickanimator.cpp index abae6321b0..100b7bd402 100644 --- a/src/quick/util/qquickanimator.cpp +++ b/src/quick/util/qquickanimator.cpp @@ -502,7 +502,7 @@ QQuickRotationAnimator::RotationDirection QQuickRotationAnimator::direction() co Q_D(const QQuickRotationAnimator); return d->direction; } - +#ifndef QT_NO_OPENGL /*! \qmltype UniformAnimator \instantiates QQuickUniformAnimator @@ -580,5 +580,6 @@ QQuickAnimatorJob *QQuickUniformAnimator::createJob() const job->setUniform(u.toLatin1()); return job; } +#endif QT_END_NAMESPACE diff --git a/src/quick/util/qquickanimator_p.h b/src/quick/util/qquickanimator_p.h index c23aa0a7e9..f1e2d4e1d9 100644 --- a/src/quick/util/qquickanimator_p.h +++ b/src/quick/util/qquickanimator_p.h @@ -169,7 +169,7 @@ protected: QQuickAnimatorJob *createJob() const; QString propertyName() const { return QStringLiteral("rotation"); } }; - +#ifndef QT_NO_OPENGL class QQuickUniformAnimatorPrivate; class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimator : public QQuickAnimator { @@ -190,6 +190,7 @@ protected: QQuickAnimatorJob *createJob() const; QString propertyName() const; }; +#endif QT_END_NAMESPACE @@ -199,6 +200,7 @@ QML_DECLARE_TYPE(QQuickYAnimator) QML_DECLARE_TYPE(QQuickScaleAnimator) QML_DECLARE_TYPE(QQuickRotationAnimator) QML_DECLARE_TYPE(QQuickOpacityAnimator) +#ifndef QT_NO_OPENGL QML_DECLARE_TYPE(QQuickUniformAnimator) - +#endif #endif // QQUICKANIMATOR_P_H diff --git a/src/quick/util/qquickanimatorjob.cpp b/src/quick/util/qquickanimatorjob.cpp index 8d5ecadab5..a0c787dae5 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -43,8 +43,10 @@ #include "qquickanimator_p_p.h" #include <private/qquickwindow_p.h> #include <private/qquickitem_p.h> -#include <private/qquickshadereffectnode_p.h> - +#ifndef QT_NO_OPENGL +# include <private/qquickopenglshadereffectnode_p.h> +# include <private/qquickopenglshadereffect_p.h> +#endif #include <private/qanimationgroupjob_p.h> #include <qcoreapplication.h> @@ -173,7 +175,7 @@ void QQuickAnimatorProxyJob::setWindow(QQuickWindow *window) } else if (!m_controller && m_job) { m_controller = QQuickWindowPrivate::get(window)->animationController; - if (window->openglContext()) + if (window->isSceneGraphInitialized()) readyToAnimate(); else connect(window, SIGNAL(sceneGraphInitialized()), this, SLOT(sceneGraphInitialized())); @@ -390,7 +392,6 @@ void QQuickXAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_helper->dx = m_value; @@ -407,7 +408,6 @@ void QQuickYAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_helper->dy = m_value; @@ -477,7 +477,6 @@ void QQuickOpacityAnimatorJob::updateCurrentTime(int time) { if (!m_controller || !m_opacityNode) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_opacityNode->setOpacity(m_value); @@ -493,7 +492,6 @@ void QQuickScaleAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); m_value = m_from + (m_to - m_from) * progress(time); m_helper->scale = m_value; @@ -513,7 +511,6 @@ void QQuickRotationAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); float t = progress(time); @@ -546,6 +543,7 @@ void QQuickRotationAnimatorJob::writeBack() m_target->setRotation(value()); } +#ifndef QT_NO_OPENGL QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() : m_node(0) , m_uniformIndex(-1) @@ -556,7 +554,7 @@ QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() void QQuickUniformAnimatorJob::setTarget(QQuickItem *target) { - if (qobject_cast<QQuickShaderEffect *>(target) != 0) + if (qobject_cast<QQuickOpenGLShaderEffect *>(target) != 0) m_target = target; } @@ -569,14 +567,14 @@ void QQuickUniformAnimatorJob::nodeWasDestroyed() void QQuickUniformAnimatorJob::afterNodeSync() { - m_node = static_cast<QQuickShaderEffectNode *>(QQuickItemPrivate::get(m_target)->paintNode); + m_node = static_cast<QQuickOpenGLShaderEffectNode *>(QQuickItemPrivate::get(m_target)->paintNode); if (m_node && m_uniformIndex == -1 && m_uniformType == -1) { - QQuickShaderEffectMaterial *material = - static_cast<QQuickShaderEffectMaterial *>(m_node->material()); + QQuickOpenGLShaderEffectMaterial *material = + static_cast<QQuickOpenGLShaderEffectMaterial *>(m_node->material()); bool found = false; - for (int t=0; !found && t<QQuickShaderEffectMaterialKey::ShaderTypeCount; ++t) { - const QVector<QQuickShaderEffectMaterial::UniformData> &uniforms = material->uniforms[t]; + for (int t=0; !found && t<QQuickOpenGLShaderEffectMaterialKey::ShaderTypeCount; ++t) { + const QVector<QQuickOpenGLShaderEffectMaterial::UniformData> &uniforms = material->uniforms[t]; for (int i=0; i<uniforms.size(); ++i) { if (uniforms.at(i).name == m_uniform) { m_uniformIndex = i; @@ -594,15 +592,14 @@ void QQuickUniformAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; - Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); if (!m_node || m_uniformIndex == -1 || m_uniformType == -1) return; m_value = m_from + (m_to - m_from) * progress(time); - QQuickShaderEffectMaterial *material = - static_cast<QQuickShaderEffectMaterial *>(m_node->material()); + QQuickOpenGLShaderEffectMaterial *material = + static_cast<QQuickOpenGLShaderEffectMaterial *>(m_node->material()); material->uniforms[m_uniformType][m_uniformIndex].value = m_value; // As we're not touching the nodes, we need to explicitly mark it dirty. // Otherwise, the renderer will abort repainting if this was the only @@ -615,5 +612,6 @@ void QQuickUniformAnimatorJob::writeBack() if (m_target) m_target->setProperty(m_uniform, value()); } +#endif QT_END_NAMESPACE diff --git a/src/quick/util/qquickanimatorjob_p.h b/src/quick/util/qquickanimatorjob_p.h index 2b910d3737..64e849d322 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -68,7 +68,7 @@ class QQuickAbstractAnimation; class QQuickAnimatorController; class QQuickAnimatorProxyJobPrivate; -class QQuickShaderEffectNode; +class QQuickOpenGLShaderEffectNode; class QSGOpacityNode; @@ -277,7 +277,7 @@ public: private: QSGOpacityNode *m_opacityNode; }; - +#ifndef QT_NO_OPENGL class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimatorJob : public QQuickAnimatorJob { public: @@ -296,11 +296,12 @@ public: private: QByteArray m_uniform; - QQuickShaderEffectNode *m_node; + QQuickOpenGLShaderEffectNode *m_node; int m_uniformIndex : 8; int m_uniformType : 8; }; +#endif QT_END_NAMESPACE diff --git a/src/quick/util/qquickutilmodule.cpp b/src/quick/util/qquickutilmodule.cpp index f5d11c6230..66994e22ba 100644 --- a/src/quick/util/qquickutilmodule.cpp +++ b/src/quick/util/qquickutilmodule.cpp @@ -107,8 +107,9 @@ void QQuickUtilModule::defineModule() qmlRegisterType<QQuickScaleAnimator>("QtQuick", 2, 2, "ScaleAnimator"); qmlRegisterType<QQuickRotationAnimator>("QtQuick", 2, 2, "RotationAnimator"); qmlRegisterType<QQuickOpacityAnimator>("QtQuick", 2, 2, "OpacityAnimator"); +#ifndef QT_NO_OPENGL qmlRegisterType<QQuickUniformAnimator>("QtQuick", 2, 2, "UniformAnimator"); - +#endif qmlRegisterType<QQuickStateOperation>(); qmlRegisterCustomType<QQuickPropertyChanges>("QtQuick",2,0,"PropertyChanges", new QQuickPropertyChangesParser); |