aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/scenegraph/qsgadaptationlayer_p.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/quick/scenegraph/qsgadaptationlayer_p.h')
-rw-r--r--src/quick/scenegraph/qsgadaptationlayer_p.h120
1 files changed, 52 insertions, 68 deletions
diff --git a/src/quick/scenegraph/qsgadaptationlayer_p.h b/src/quick/scenegraph/qsgadaptationlayer_p.h
index 284239e3c7..117e810411 100644
--- a/src/quick/scenegraph/qsgadaptationlayer_p.h
+++ b/src/quick/scenegraph/qsgadaptationlayer_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 QSGADAPTATIONLAYER_P_H
#define QSGADAPTATIONLAYER_P_H
@@ -53,6 +17,7 @@
#include <QtQuick/qsgnode.h>
#include <QtQuick/qsgtexture.h>
+#include <QtQuick/qquickpainteditem.h>
#include <QtCore/qobject.h>
#include <QtCore/qrect.h>
#include <QtGui/qbrush.h>
@@ -66,7 +31,7 @@
#include <QtGui/private/qdatabuffer_p.h>
#include <private/qdistancefield_p.h>
#include <private/qintrusivelist_p.h>
-#include <QtGui/private/qshader_p.h>
+#include <rhi/qshader.h>
// ### remove
#include <QtQuick/private/qquicktext_p.h>
@@ -87,10 +52,10 @@ class QSGRenderNode;
class QSGRenderContext;
class QRhiTexture;
-class Q_QUICK_PRIVATE_EXPORT QSGNodeVisitorEx
+class Q_QUICK_EXPORT QSGNodeVisitorEx
{
public:
- virtual ~QSGNodeVisitorEx() {}
+ virtual ~QSGNodeVisitorEx();
// visit(...) returns true if the children are supposed to be
// visisted and false if they're supposed to be skipped by the visitor.
@@ -124,17 +89,20 @@ public:
};
-class Q_QUICK_PRIVATE_EXPORT QSGVisitableNode : public QSGGeometryNode
+class Q_QUICK_EXPORT QSGVisitableNode : public QSGGeometryNode
{
public:
QSGVisitableNode() { setFlag(IsVisitableNode); }
+ ~QSGVisitableNode() override;
virtual void accept(QSGNodeVisitorEx *) = 0;
};
-class Q_QUICK_PRIVATE_EXPORT QSGInternalRectangleNode : public QSGVisitableNode
+class Q_QUICK_EXPORT QSGInternalRectangleNode : public QSGVisitableNode
{
public:
+ ~QSGInternalRectangleNode() override;
+
virtual void setRect(const QRectF &rect) = 0;
virtual void setColor(const QColor &color) = 0;
virtual void setPenColor(const QColor &color) = 0;
@@ -142,6 +110,10 @@ public:
virtual void setGradientStops(const QGradientStops &stops) = 0;
virtual void setGradientVertical(bool vertical) = 0;
virtual void setRadius(qreal radius) = 0;
+ virtual void setTopLeftRadius(qreal radius) = 0;
+ virtual void setTopRightRadius(qreal radius) = 0;
+ virtual void setBottomLeftRadius(qreal radius) = 0;
+ virtual void setBottomRightRadius(qreal radius) = 0;
virtual void setAntialiasing(bool antialiasing) { Q_UNUSED(antialiasing); }
virtual void setAligned(bool aligned) = 0;
@@ -151,9 +123,11 @@ public:
};
-class Q_QUICK_PRIVATE_EXPORT QSGInternalImageNode : public QSGVisitableNode
+class Q_QUICK_EXPORT QSGInternalImageNode : public QSGVisitableNode
{
public:
+ ~QSGInternalImageNode() override;
+
virtual void setTargetRect(const QRectF &rect) = 0;
virtual void setInnerTargetRect(const QRectF &rect) = 0;
virtual void setInnerSourceRect(const QRectF &rect) = 0;
@@ -163,7 +137,7 @@ public:
virtual void setSubSourceRect(const QRectF &rect) = 0;
virtual void setTexture(QSGTexture *texture) = 0;
virtual void setAntialiasing(bool antialiasing) { Q_UNUSED(antialiasing); }
- virtual void setMirror(bool mirror) = 0;
+ virtual void setMirror(bool horizontally, bool vertically) = 0;
virtual void setMipmapFiltering(QSGTexture::Filtering filtering) = 0;
virtual void setFiltering(QSGTexture::Filtering filtering) = 0;
virtual void setHorizontalWrapMode(QSGTexture::WrapMode wrapMode) = 0;
@@ -174,9 +148,10 @@ public:
void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
};
-class Q_QUICK_PRIVATE_EXPORT QSGPainterNode : public QSGVisitableNode
+class Q_QUICK_EXPORT QSGPainterNode : public QSGVisitableNode
{
public:
+ ~QSGPainterNode() override;
virtual void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) = 0;
virtual void setSize(const QSize &size) = 0;
@@ -201,14 +176,21 @@ class Q_QUICK_EXPORT QSGLayer : public QSGDynamicTexture
{
Q_OBJECT
public:
+ ~QSGLayer() override;
+
+ enum Format {
+ RGBA8 = 1,
+ RGBA16F,
+ RGBA32F
+ };
virtual void setItem(QSGNode *item) = 0;
- virtual void setRect(const QRectF &rect) = 0;
- virtual void setSize(const QSize &size) = 0;
+ virtual void setRect(const QRectF &logicalRect) = 0;
+ virtual void setSize(const QSize &pixelSize) = 0;
virtual void scheduleUpdate() = 0;
virtual QImage toImage() const = 0;
virtual void setLive(bool live) = 0;
virtual void setRecursive(bool recursive) = 0;
- virtual void setFormat(uint format) = 0;
+ virtual void setFormat(Format format) = 0;
virtual void setHasMipmaps(bool mipmap) = 0;
virtual void setDevicePixelRatio(qreal ratio) = 0;
virtual void setMirrorHorizontal(bool mirror) = 0;
@@ -227,9 +209,11 @@ protected:
#if QT_CONFIG(quick_sprite)
-class Q_QUICK_PRIVATE_EXPORT QSGSpriteNode : public QSGVisitableNode
+class Q_QUICK_EXPORT QSGSpriteNode : public QSGVisitableNode
{
public:
+ ~QSGSpriteNode() override;
+
virtual void setTexture(QSGTexture *texture) = 0;
virtual void setTime(float time) = 0;
virtual void setSourceA(const QPoint &source) = 0;
@@ -246,11 +230,13 @@ public:
#endif
-class Q_QUICK_PRIVATE_EXPORT QSGGuiThreadShaderEffectManager : public QObject
+class Q_QUICK_EXPORT QSGGuiThreadShaderEffectManager : public QObject
{
Q_OBJECT
public:
+ ~QSGGuiThreadShaderEffectManager() override;
+
enum Status {
Compiled,
Uncompiled,
@@ -274,7 +260,6 @@ public:
Texture // for APIs with separate texture and sampler objects
};
struct Variable {
- Variable() {}
VariableType type = Constant;
QByteArray name;
uint offset = 0; // for cbuffer members
@@ -286,7 +271,6 @@ public:
QShader rhiShader;
Type type;
QVector<Variable> variables;
- uint constantDataSize;
// Vertex inputs are not tracked here as QSGGeometry::AttributeSet
// hardwires that anyways so it is up to the shader to provide
@@ -302,14 +286,16 @@ Q_SIGNALS:
};
#ifndef QT_NO_DEBUG_STREAM
-Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug debug, const QSGGuiThreadShaderEffectManager::ShaderInfo::Variable &v);
+Q_QUICK_EXPORT QDebug operator<<(QDebug debug, const QSGGuiThreadShaderEffectManager::ShaderInfo::Variable &v);
#endif
-class Q_QUICK_PRIVATE_EXPORT QSGShaderEffectNode : public QObject, public QSGVisitableNode
+class Q_QUICK_EXPORT QSGShaderEffectNode : public QObject, public QSGVisitableNode
{
Q_OBJECT
public:
+ ~QSGShaderEffectNode() override;
+
enum DirtyShaderFlag {
DirtyShaders = 0x01,
DirtyShaderConstant = 0x02,
@@ -353,6 +339,8 @@ public:
};
ShaderSyncData vertex;
ShaderSyncData fragment;
+ void *materialTypeCacheKey;
+ qint8 viewCount;
};
// Each ShaderEffect item has one node (render thread) and one manager (gui thread).
@@ -369,10 +357,10 @@ Q_SIGNALS:
Q_DECLARE_OPERATORS_FOR_FLAGS(QSGShaderEffectNode::DirtyShaderFlags)
#ifndef QT_NO_DEBUG_STREAM
-Q_QUICK_PRIVATE_EXPORT QDebug operator<<(QDebug debug, const QSGShaderEffectNode::VariableData &vd);
+Q_QUICK_EXPORT QDebug operator<<(QDebug debug, const QSGShaderEffectNode::VariableData &vd);
#endif
-class Q_QUICK_PRIVATE_EXPORT QSGGlyphNode : public QSGVisitableNode
+class Q_QUICK_EXPORT QSGGlyphNode : public QSGVisitableNode
{
public:
enum AntialiasingMode
@@ -384,6 +372,7 @@ public:
};
QSGGlyphNode() {}
+ ~QSGGlyphNode() override;
virtual void setGlyphs(const QPointF &position, const QGlyphRun &glyphs) = 0;
virtual void setColor(const QColor &color) = 0;
@@ -399,26 +388,22 @@ public:
virtual void update() = 0;
- void setOwnerElement(QQuickItem *ownerElement) { m_ownerElement = ownerElement; }
- QQuickItem *ownerElement() const { return m_ownerElement; }
-
void accept(QSGNodeVisitorEx *visitor) override { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
protected:
QRectF m_bounding_rect;
- QQuickItem *m_ownerElement = nullptr;
};
-class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphConsumer
+class Q_QUICK_EXPORT QSGDistanceFieldGlyphConsumer
{
public:
- virtual ~QSGDistanceFieldGlyphConsumer() {}
+ virtual ~QSGDistanceFieldGlyphConsumer();
virtual void invalidateGlyphs(const QVector<quint32> &glyphs) = 0;
QIntrusiveListNode node;
};
typedef QIntrusiveList<QSGDistanceFieldGlyphConsumer, &QSGDistanceFieldGlyphConsumer::node> QSGDistanceFieldGlyphConsumerList;
-class Q_QUICK_PRIVATE_EXPORT QSGDistanceFieldGlyphCache
+class Q_QUICK_EXPORT QSGDistanceFieldGlyphCache
{
public:
QSGDistanceFieldGlyphCache(const QRawFont &font,
@@ -463,9 +448,9 @@ public:
{
return pixelSize / baseFontSize();
}
- int distanceFieldRadius() const
+ qreal distanceFieldRadius() const
{
- return QT_DISTANCEFIELD_RADIUS(m_doubleGlyphResolution) / QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution);
+ return QT_DISTANCEFIELD_RADIUS(m_doubleGlyphResolution) / qreal(QT_DISTANCEFIELD_SCALE(m_doubleGlyphResolution));
}
int glyphCount() const { return m_glyphCount; }
bool doubleGlyphResolution() const { return m_doubleGlyphResolution; }
@@ -483,12 +468,11 @@ public:
void registerGlyphNode(QSGDistanceFieldGlyphConsumer *node) { m_registeredNodes.insert(node); }
void unregisterGlyphNode(QSGDistanceFieldGlyphConsumer *node) { m_registeredNodes.remove(node); }
- virtual void registerOwnerElement(QQuickItem *ownerElement);
- virtual void unregisterOwnerElement(QQuickItem *ownerElement);
virtual void processPendingGlyphs();
virtual bool eightBitFormatIsAlphaSwizzled() const = 0;
virtual bool screenSpaceDerivativesSupported() const = 0;
+ virtual bool isActive() const;
protected:
struct GlyphPosition {