diff options
Diffstat (limited to 'src/quick/util/qquickanimatorjob.cpp')
-rw-r--r-- | src/quick/util/qquickanimatorjob.cpp | 32 |
1 files changed, 15 insertions, 17 deletions
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 |