Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qsgdefaultpainternode_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QSGDEFAULTPAINTERNODE_P_H
5#define QSGDEFAULTPAINTERNODE_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <private/qsgadaptationlayer_p.h>
19#include "qsgtexturematerial.h"
20#include "qsgplaintexture_p.h"
21
22#include <QtQuick/qquickpainteditem.h>
23
24#include <QtGui/qcolor.h>
25
27
29
30class Q_QUICK_EXPORT QSGPainterTexture : public QSGPlainTexture
31{
32public:
34
35 void setDirtyRect(const QRect &rect) { m_dirty_rect = rect; }
36
37 void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override;
38
39private:
40 QRect m_dirty_rect;
41};
42
43class Q_QUICK_EXPORT QSGDefaultPainterNode : public QSGPainterNode
44{
45public:
47 virtual ~QSGDefaultPainterNode();
48
49 void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override;
50
51 void setSize(const QSize &size) override;
52 QSize size() const { return m_size; }
53
54 void setDirty(const QRect &dirtyRect = QRect()) override;
55
56 void setOpaquePainting(bool opaque) override;
57 bool opaquePainting() const { return m_opaquePainting; }
58
59 void setLinearFiltering(bool linearFiltering) override;
60 bool linearFiltering() const { return m_linear_filtering; }
61
62 void setMipmapping(bool mipmapping) override;
63 bool mipmapping() const { return m_mipmapping; }
64
65 void setSmoothPainting(bool s) override;
66 bool smoothPainting() const { return m_smoothPainting; }
67
68 void setFillColor(const QColor &c) override;
69 QColor fillColor() const { return m_fillColor; }
70
71 void setContentsScale(qreal s) override;
72 qreal contentsScale() const { return m_contentsScale; }
73
74 void setFastFBOResizing(bool fastResizing) override;
75 bool fastFBOResizing() const { return m_fastFBOResizing; }
76
77 void setTextureSize(const QSize &textureSize) override;
78 QSize textureSize() const { return m_textureSize; }
79
80 QImage toImage() const override;
81 void update() override;
82
83 void paint();
84
85 QSGTexture *texture() const override { return m_texture; }
86
87private:
88 void updateTexture();
89 void updateGeometry();
90 void updateRenderTarget();
91
92 QSGDefaultRenderContext *m_context;
93
94 QQuickPaintedItem::RenderTarget m_preferredRenderTarget;
95 QQuickPaintedItem::RenderTarget m_actualRenderTarget;
96
97 QQuickPaintedItem *m_item;
98
99 QImage m_image;
100
101 QSGOpaqueTextureMaterial m_material;
102 QSGTextureMaterial m_materialO;
103 QSGGeometry m_geometry;
104 QSGPainterTexture *m_texture;
105
106 QSize m_size;
107 QSize m_textureSize;
108 QRect m_dirtyRect;
109 QColor m_fillColor;
110 qreal m_contentsScale;
111
112 bool m_dirtyContents : 1;
113 bool m_opaquePainting : 1;
114 bool m_linear_filtering : 1;
115 bool m_mipmapping : 1;
116 bool m_smoothPainting : 1;
117 bool m_multisamplingSupported : 1;
118 bool m_fastFBOResizing : 1;
119 bool m_dirtyGeometry : 1;
120 bool m_dirtyRenderTarget : 1;
121 bool m_dirtyTexture : 1;
122};
123
125
126#endif // QSGDEFAULTPAINTERNODE_P_H
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
\inmodule QtGui
Definition qimage.h:37
The QQuickPaintedItem class provides a way to use the QPainter API in the QML Scene Graph.
RenderTarget
This enum describes QQuickPaintedItem's render targets.
\inmodule QtCore\reentrant
Definition qrect.h:30
\inmodule QtGui
Definition qrhi.h:1731
\inmodule QtGuiPrivate \inheaderfile rhi/qrhi.h
Definition qrhi.h:1804
QSGTexture * texture() const override
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
Definition qsggeometry.h:15
The QSGOpaqueTextureMaterial class provides a convenient way of rendering textured geometry in the sc...
void setDirtyRect(const QRect &rect)
The QSGTextureMaterial class provides a convenient way of rendering textured geometry in the scene gr...
\inmodule QtQuick
Definition qsgtexture.h:20
\inmodule QtCore
Definition qsize.h:25
QPainter paint
rect
[4]
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum target
GLdouble s
[6]
Definition qopenglext.h:235
const GLubyte * c
double qreal
Definition qtypes.h:187
QGraphicsItem * item