diff options
| author | Andy Nichols <andy.nichols@theqtcompany.com> | 2016-03-15 13:39:41 +0100 |
|---|---|---|
| committer | Laszlo Agocs <laszlo.agocs@theqtcompany.com> | 2016-03-22 09:51:54 +0000 |
| commit | 90d98e1330bd46b5defafd5d6b86fa8fe157b48d (patch) | |
| tree | 722e2b1d371c6b58144d51b8167faa9d1c86e7f0 /src/quick/util | |
| parent | e32fb877ec0662dfda41ce490d77d8bf35a377f1 (diff) | |
Enable building Qt Quick module with QT_NO_OPENGL defined
Currently the Qt Quick module depends on either the OpenGL or OpenGLES
headers being available at build time. Since we are adding support for
adaptations that do not depend on OpenGL, it should be possible to build
Qt Quick in environments that do not have OpenGL development headers.
This does present many challenges though because in some cases GL types,
and classes that require OpenGL are part of the public APIs. However
since these classes were never available when QT_NO_OPENGL was defined,
it should be possible to redefine the function signatures under this
scenario, since it's not possible to break binary compatibility if there
never were any binaries to break compatibility with.
One of the bigger changes that was necessary to facilitate this change
is creating interfaces out of QSGContext and QSGRenderContext. Here the
default behavior was usage of OpenGL directly, even though subclasses
could override all OpenGL usage. Making them interfaces should bring
QSGContext and QSGRenderContext more in line with the other classes
present in the adaptation layer.
Change-Id: Iaa54dc0f6cfd18d2da1d059548abf509bd71f200
Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
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 | 22 | ||||
| -rw-r--r-- | src/quick/util/qquickanimatorjob_p.h | 3 | ||||
| -rw-r--r-- | src/quick/util/qquickutilmodule.cpp | 3 |
5 files changed, 27 insertions, 10 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 d7be237a39..b7e0d6437a 100644 --- a/src/quick/util/qquickanimatorjob.cpp +++ b/src/quick/util/qquickanimatorjob.cpp @@ -43,8 +43,9 @@ #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/qquickshadereffectnode_p.h> +#endif #include <private/qanimationgroupjob_p.h> #include <qcoreapplication.h> @@ -386,8 +387,9 @@ void QQuickXAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; +#ifndef QT_NO_OPENGL Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - +#endif m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); m_helper->dx = m_value; m_helper->wasChanged = true; @@ -403,8 +405,9 @@ void QQuickYAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; +#ifndef QT_NO_OPENGL Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - +#endif m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); m_helper->dy = m_value; m_helper->wasChanged = true; @@ -473,7 +476,9 @@ void QQuickOpacityAnimatorJob::updateCurrentTime(int time) { if (!m_controller || !m_opacityNode) return; +#ifndef QT_NO_OPENGL Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); +#endif m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); m_opacityNode->setOpacity(m_value); @@ -489,7 +494,9 @@ void QQuickScaleAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; +#ifndef QT_NO_OPENGL Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); +#endif m_value = m_from + (m_to - m_from) * m_easing.valueForProgress(time / (qreal) m_duration); m_helper->scale = m_value; @@ -509,7 +516,9 @@ void QQuickRotationAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; +#ifndef QT_NO_OPENGL Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); +#endif float t = m_easing.valueForProgress(time / (qreal) m_duration); switch (m_direction) { @@ -541,6 +550,7 @@ void QQuickRotationAnimatorJob::writeBack() m_target->setRotation(value()); } +#ifndef QT_NO_OPENGL QQuickUniformAnimatorJob::QQuickUniformAnimatorJob() : m_node(0) , m_uniformIndex(-1) @@ -589,8 +599,9 @@ void QQuickUniformAnimatorJob::updateCurrentTime(int time) { if (!m_controller) return; +#ifndef QT_NO_OPENGL Q_ASSERT(!m_controller->m_window->openglContext() || m_controller->m_window->openglContext()->thread() == QThread::currentThread()); - +#endif if (!m_node || m_uniformIndex == -1 || m_uniformType == -1) return; @@ -610,5 +621,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 71c1e93746..75d2b962a5 100644 --- a/src/quick/util/qquickanimatorjob_p.h +++ b/src/quick/util/qquickanimatorjob_p.h @@ -275,7 +275,7 @@ public: private: QSGOpacityNode *m_opacityNode; }; - +#ifndef QT_NO_OPENGL class Q_QUICK_PRIVATE_EXPORT QQuickUniformAnimatorJob : public QQuickAnimatorJob { public: @@ -299,6 +299,7 @@ private: 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); |
