diff options
Diffstat (limited to 'src/quickshapes/qquickshapegenericrenderer_p.h')
-rw-r--r-- | src/quickshapes/qquickshapegenericrenderer_p.h | 65 |
1 files changed, 18 insertions, 47 deletions
diff --git a/src/quickshapes/qquickshapegenericrenderer_p.h b/src/quickshapes/qquickshapegenericrenderer_p.h index 9cdf44546e..6877b674e0 100644 --- a/src/quickshapes/qquickshapegenericrenderer_p.h +++ b/src/quickshapes/qquickshapegenericrenderer_p.h @@ -1,41 +1,5 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtQuick module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ +// Copyright (C) 2016 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QQUICKSHAPEGENERICRENDERER_P_H #define QQUICKSHAPEGENERICRENDERER_P_H @@ -53,6 +17,7 @@ #include <QtQuickShapes/private/qquickshapesglobal_p.h> #include <QtQuickShapes/private/qquickshape_p_p.h> +#include <QtQuick/private/qsggradientcache_p.h> #include <qsgnode.h> #include <qsggeometry.h> #include <qsgmaterial.h> @@ -99,6 +64,7 @@ public: void setStrokeStyle(int index, QQuickShapePath::StrokeStyle strokeStyle, qreal dashOffset, const QVector<qreal> &dashPattern) override; void setFillGradient(int index, QQuickShapeGradient *gradient) override; + void setTriangulationScale(qreal scale) override; void endSync(bool async) override; void setAsyncCallback(void (*)(void *), void *) override; Flags flags() const override { return SupportsAsync; } @@ -116,12 +82,14 @@ public: VertexContainerType *fillVertices, IndexContainerType *fillIndices, QSGGeometry::Type *indexType, - bool supportsElementIndexUint); + bool supportsElementIndexUint, + qreal triangulationScale); static void triangulateStroke(const QPainterPath &path, const QPen &pen, const Color4ub &strokeColor, VertexContainerType *strokeVertices, - const QSize &clipSize); + const QSize &clipSize, + qreal triangulationScale); private: void maybeUpdateAsyncItem(); @@ -129,12 +97,12 @@ private: struct ShapePathData { float strokeWidth; QPen pen; - Color4ub strokeColor; - Color4ub fillColor; + Color4ub strokeColor = { uchar(0), uchar(0), uchar(0), uchar(0) }; + Color4ub fillColor = { uchar(0), uchar(0), uchar(0), uchar(0) }; Qt::FillRule fillRule; QPainterPath path; FillGradientType fillGradientActive; - GradientDesc fillGradient; + QSGGradientCache::GradientDesc fillGradient; VertexContainerType fillVertices; IndexContainerType fillIndices; QSGGeometry::Type indexType; @@ -156,6 +124,7 @@ private: int m_accDirty; void (*m_asyncCallback)(void *); void *m_asyncCallbackData; + float m_triangulationScale = 1.0; }; class QQuickShapeFillRunnable : public QObject, public QRunnable @@ -171,6 +140,7 @@ public: QPainterPath path; QQuickShapeGenericRenderer::Color4ub fillColor; bool supportsElementIndexUint; + qreal triangulationScale; // output QQuickShapeGenericRenderer::VertexContainerType fillVertices; @@ -195,6 +165,7 @@ public: QPen pen; QQuickShapeGenericRenderer::Color4ub strokeColor; QSize clipSize; + qreal triangulationScale; // output QQuickShapeGenericRenderer::VertexContainerType strokeVertices; @@ -218,7 +189,7 @@ public: void activateMaterial(QQuickWindow *window, Material m); // shadow data for custom materials - QQuickAbstractPathRenderer::GradientDesc m_fillGradient; + QSGGradientCache::GradientDesc m_fillGradient; private: QScopedPointer<QSGMaterial> m_material; @@ -246,7 +217,7 @@ public: class QQuickShapeLinearGradientRhiShader : public QSGMaterialShader { public: - QQuickShapeLinearGradientRhiShader(); + QQuickShapeLinearGradientRhiShader(int viewCount); bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; @@ -285,7 +256,7 @@ private: class QQuickShapeRadialGradientRhiShader : public QSGMaterialShader { public: - QQuickShapeRadialGradientRhiShader(); + QQuickShapeRadialGradientRhiShader(int viewCount); bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; @@ -321,7 +292,7 @@ private: class QQuickShapeConicalGradientRhiShader : public QSGMaterialShader { public: - QQuickShapeConicalGradientRhiShader(); + QQuickShapeConicalGradientRhiShader(int viewCount); bool updateUniformData(RenderState &state, QSGMaterial *newMaterial, QSGMaterial *oldMaterial) override; |