summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-06-26 09:23:11 +0200
committerSimon Hausmann <simon.hausmann@qt.io>2017-06-26 09:23:50 +0000
commit4beee1a6dcc1be57aa6fb2a175dadc6ff298545d (patch)
treeb6973a72fa88ef2a0aa5e31ed4cdfaa9164258d5
parent21fd17d7c1fca77e802ba2d3fd5aeebcdef157e4 (diff)
shapes: Convert QT_NO_OPENGL to QT_CONFIG(opengl)
Also guard fillGradient for now. Task-number: QTBUG-61632 Change-Id: I5fa2607cc1ede0922519258afd455bee4d0187c7 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
-rw-r--r--src/imports/shapes/qquicknvprfunctions.cpp4
-rw-r--r--src/imports/shapes/qquicknvprfunctions_p.h4
-rw-r--r--src/imports/shapes/qquickshape.cpp8
-rw-r--r--src/imports/shapes/qquickshape_p_p.h4
-rw-r--r--src/imports/shapes/qquickshapegenericrenderer.cpp20
-rw-r--r--src/imports/shapes/qquickshapegenericrenderer_p.h8
-rw-r--r--src/imports/shapes/qquickshapenvprrenderer_p.h4
7 files changed, 32 insertions, 20 deletions
diff --git a/src/imports/shapes/qquicknvprfunctions.cpp b/src/imports/shapes/qquicknvprfunctions.cpp
index e9b93cf4a1..0b92d4b4c0 100644
--- a/src/imports/shapes/qquicknvprfunctions.cpp
+++ b/src/imports/shapes/qquicknvprfunctions.cpp
@@ -39,7 +39,7 @@
#include "qquicknvprfunctions_p.h"
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QOpenGLContext>
#include <QOffscreenSurface>
@@ -274,4 +274,4 @@ bool QQuickNvprFunctionsPrivate::resolve()
QT_END_NAMESPACE
-#endif // QT_NO_OPENGL
+#endif // QT_CONFIG(opengl)
diff --git a/src/imports/shapes/qquicknvprfunctions_p.h b/src/imports/shapes/qquicknvprfunctions_p.h
index dd45dd7daa..342e92cbc3 100644
--- a/src/imports/shapes/qquicknvprfunctions_p.h
+++ b/src/imports/shapes/qquicknvprfunctions_p.h
@@ -54,7 +54,7 @@
#include <qopengl.h>
#include <QtGui/qsurfaceformat.h>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QT_BEGIN_NAMESPACE
@@ -395,6 +395,6 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_OPENGL
+#endif // QT_CONFIG(opengl)
#endif // QQUICKNVPRFUNCTIONS_P_H
diff --git a/src/imports/shapes/qquickshape.cpp b/src/imports/shapes/qquickshape.cpp
index 4e6896621e..1054af30de 100644
--- a/src/imports/shapes/qquickshape.cpp
+++ b/src/imports/shapes/qquickshape.cpp
@@ -921,7 +921,7 @@ void QQuickShapePrivate::createRenderer()
return;
switch (ri->graphicsApi()) {
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
case QSGRendererInterface::OpenGL:
if (enableVendorExts && QQuickShapeNvprRenderNode::isSupported()) {
rendererType = QQuickShape::NvprRenderer;
@@ -954,7 +954,7 @@ QSGNode *QQuickShapePrivate::createNode()
return node;
switch (ri->graphicsApi()) {
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
case QSGRendererInterface::OpenGL:
if (enableVendorExts && QQuickShapeNvprRenderNode::isSupported()) {
node = new QQuickShapeNvprRenderNode;
@@ -1199,7 +1199,7 @@ void QQuickShapeLinearGradient::setY2(qreal v)
}
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
// contexts sharing with each other get the same cache instance
class QQuickShapeGradientCacheWrapper
@@ -1324,7 +1324,7 @@ QSGTexture *QQuickShapeGradientCache::get(const GradientDesc &grad)
return tx;
}
-#endif // QT_NO_OPENGL
+#endif // QT_CONFIG(opengl)
QT_END_NAMESPACE
diff --git a/src/imports/shapes/qquickshape_p_p.h b/src/imports/shapes/qquickshape_p_p.h
index a8a5675ccb..888488efcd 100644
--- a/src/imports/shapes/qquickshape_p_p.h
+++ b/src/imports/shapes/qquickshape_p_p.h
@@ -234,7 +234,7 @@ private:
QV4::PersistentValue m_v4value;
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class QQuickShapeGradientCache : public QOpenGLSharedResource
{
@@ -274,7 +274,7 @@ inline uint qHash(const QQuickShapeGradientCache::GradientDesc &v, uint seed = 0
return h;
}
-#endif // QT_NO_OPENGL
+#endif // QT_CONFIG(opengl)
QT_END_NAMESPACE
diff --git a/src/imports/shapes/qquickshapegenericrenderer.cpp b/src/imports/shapes/qquickshapegenericrenderer.cpp
index 4a4176793f..ca5f2a0e91 100644
--- a/src/imports/shapes/qquickshapegenericrenderer.cpp
+++ b/src/imports/shapes/qquickshapegenericrenderer.cpp
@@ -42,7 +42,7 @@
#include <QtGui/private/qtriangulatingstroker_p.h>
#include <QThreadPool>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
#include <QSGVertexColorMaterial>
#include <QOpenGLContext>
#include <QOffscreenSurface>
@@ -118,7 +118,7 @@ void QQuickShapeGenericStrokeFillNode::activateMaterial(Material m)
static bool q_supportsElementIndexUint(QSGRendererInterface::GraphicsApi api)
{
static bool elementIndexUint = true;
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (api == QSGRendererInterface::OpenGL) {
static bool elementIndexUintChecked = false;
if (!elementIndexUintChecked) {
@@ -246,6 +246,7 @@ void QQuickShapeGenericRenderer::setFillGradient(int index, QQuickShapeGradient
{
ShapePathData &d(m_sp[index]);
d.fillGradientActive = gradient != nullptr;
+#if QT_CONFIG(opengl)
if (gradient) {
d.fillGradient.stops = gradient->gradientStops(); // sorted
d.fillGradient.spread = gradient->spread();
@@ -256,6 +257,7 @@ void QQuickShapeGenericRenderer::setFillGradient(int index, QQuickShapeGradient
Q_UNREACHABLE();
}
}
+#endif
d.syncDirty |= DirtyFillGradient;
}
@@ -559,8 +561,12 @@ void QQuickShapeGenericRenderer::updateNode()
void QQuickShapeGenericRenderer::updateShadowDataInNode(ShapePathData *d, QQuickShapeGenericStrokeFillNode *n)
{
if (d->fillGradientActive) {
+#if QT_CONFIG(opengl)
if (d->effectiveDirty & DirtyFillGradient)
n->m_fillGradient = d->fillGradient;
+#else
+ Q_UNUSED(n);
+#endif
}
}
@@ -665,7 +671,7 @@ QSGMaterial *QQuickShapeGenericMaterialFactory::createVertexColor(QQuickWindow *
{
QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (api == QSGRendererInterface::OpenGL) // ### so much for "generic"...
return new QSGVertexColorMaterial;
#endif
@@ -679,16 +685,18 @@ QSGMaterial *QQuickShapeGenericMaterialFactory::createLinearGradient(QQuickWindo
{
QSGRendererInterface::GraphicsApi api = window->rendererInterface()->graphicsApi();
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
if (api == QSGRendererInterface::OpenGL) // ### so much for "generic"...
return new QQuickShapeLinearGradientMaterial(node);
+#else
+ Q_UNUSED(node);
#endif
qWarning("Linear gradient material: Unsupported graphics API %d", api);
return nullptr;
}
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QSGMaterialType QQuickShapeLinearGradientShader::type;
@@ -771,6 +779,6 @@ int QQuickShapeLinearGradientMaterial::compare(const QSGMaterial *other) const
return 0;
}
-#endif // QT_NO_OPENGL
+#endif // QT_CONFIG(opengl)
QT_END_NAMESPACE
diff --git a/src/imports/shapes/qquickshapegenericrenderer_p.h b/src/imports/shapes/qquickshapegenericrenderer_p.h
index ad2427f00a..1f36e3decf 100644
--- a/src/imports/shapes/qquickshapegenericrenderer_p.h
+++ b/src/imports/shapes/qquickshapegenericrenderer_p.h
@@ -133,7 +133,9 @@ private:
Qt::FillRule fillRule;
QPainterPath path;
bool fillGradientActive;
+#if QT_CONFIG(opengl)
QQuickShapeGradientCache::GradientDesc fillGradient;
+#endif
VertexContainerType fillVertices;
IndexContainerType fillIndices;
QSGGeometry::Type indexType;
@@ -218,7 +220,9 @@ public:
QQuickWindow *window() const { return m_window; }
// shadow data for custom materials
+#if QT_CONFIG(opengl)
QQuickShapeGradientCache::GradientDesc m_fillGradient;
+#endif
private:
QSGGeometry *m_geometry;
@@ -245,7 +249,7 @@ public:
static QSGMaterial *createLinearGradient(QQuickWindow *window, QQuickShapeGenericStrokeFillNode *node);
};
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
class QQuickShapeLinearGradientShader : public QSGMaterialShader
{
@@ -297,7 +301,7 @@ private:
QQuickShapeGenericStrokeFillNode *m_node;
};
-#endif // QT_NO_OPENGL
+#endif // QT_CONFIG(opengl)
QT_END_NAMESPACE
diff --git a/src/imports/shapes/qquickshapenvprrenderer_p.h b/src/imports/shapes/qquickshapenvprrenderer_p.h
index 159bf79493..ec7ba498f9 100644
--- a/src/imports/shapes/qquickshapenvprrenderer_p.h
+++ b/src/imports/shapes/qquickshapenvprrenderer_p.h
@@ -58,7 +58,7 @@
#include <QVector4D>
#include <QDebug>
-#ifndef QT_NO_OPENGL
+#if QT_CONFIG(opengl)
QT_BEGIN_NAMESPACE
@@ -232,6 +232,6 @@ private:
QT_END_NAMESPACE
-#endif // QT_NO_OPENGL
+#endif // QT_CONFIG(opengl)
#endif // QQUICKSHAPENVPRRENDERER_P_H