14 , m_context(renderContext)
16 , m_device_pixel_ratio(1)
17 , m_mirrorHorizontal(
false)
18 , m_mirrorVertical(true)
22 , m_dirtyTexture(true)
39 return m_pixmap.
size();
54 bool doGrab = (m_live || m_grab) && m_dirtyTexture;
69 if (m_live && !m_item)
89 if (m_live && m_size.
isNull())
100 if (m_dirtyTexture) {
116 if (m_live && (!m_item || m_size.
isNull()))
124 m_recursive = recursive;
137 m_device_pixel_ratio = ratio;
142 if (m_mirrorHorizontal == mirror)
144 m_mirrorHorizontal = mirror;
150 if (m_mirrorVertical == mirror)
152 m_mirrorVertical = mirror;
158 m_dirtyTexture =
true;
159 if (m_live || m_grab) {
167 m_renderer =
nullptr;
170void QSGSoftwareLayer::grab()
172 if (!m_item || m_size.
isNull()) {
174 m_dirtyTexture =
false;
190 if (m_pixmap.
size() != m_size) {
199 m_dirtyTexture =
false;
203 QRect mirrored(m_mirrorHorizontal ? m_rect.
right() * m_device_pixel_ratio : m_rect.
left() * m_device_pixel_ratio,
204 m_mirrorVertical ? m_rect.
bottom() * m_device_pixel_ratio : m_rect.
top() * m_device_pixel_ratio,
205 m_mirrorHorizontal ? -m_rect.
width() * m_device_pixel_ratio : m_rect.
width() * m_device_pixel_ratio,
206 m_mirrorVertical ? -m_rect.
height() * m_device_pixel_ratio : m_rect.
height() * m_device_pixel_ratio);
211 m_renderer->
render(&m_pixmap);
221#include "moc_qsgsoftwarelayer_p.cpp"
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
QImage toImage() const
Converts the pixmap to a QImage.
QSize size() const
Returns the size of the pixmap.
void setDevicePixelRatio(qreal scaleFactor)
Sets the device pixel ratio for the pixmap.
bool hasAlphaChannel() const
\inmodule QtCore\reentrant
constexpr qreal right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
\inmodule QtCore\reentrant
void setViewportRect(const QRect &rect)
Sets rect as the geometry of the viewport to render on the surface.
void setDeviceRect(const QRect &rect)
Sets rect as the geometry of the surface being rendered to.
void setClearColor(const QColor &color)
Use color to clear the framebuffer when clearMode() is set to QSGAbstractRenderer::ClearColorBuffer.
void setRootNode(QSGRootNode *node)
Sets the node as the root of the QSGNode scene that you want to render.
void nodeChanged(QSGNode *node, QSGNode::DirtyState state) override
void scheduledUpdateCompleted()
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
QSGNode * firstChild() const
Returns the first child of this node.
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
NodeType type() const
Returns the type of this node.
void setDevicePixelRatio(qreal ratio)
The QSGRootNode is the toplevel root of any scene graph.
void setItem(QSGNode *item) override
QSize textureSize() const override
Returns the size of the texture in pixels.
void setMirrorHorizontal(bool mirror) override
void setMirrorVertical(bool mirror) override
void setRecursive(bool recursive) override
qint64 comparisonKey() const override
Returns a key suitable for comparing textures.
QImage toImage() const override
void setDevicePixelRatio(qreal ratio) override
bool hasAlphaChannel() const override
Returns true if the texture data contains an alpha channel.
void scheduleUpdate() override
bool updateTexture() override
Call this function to explicitly update the dynamic texture.
void invalidated() override
bool hasMipmaps() const override
Returns true if the texture data contains mipmap levels.
QSGSoftwareLayer(QSGRenderContext *renderContext)
void setSize(const QSize &size) override
void setFormat(Format) override
void setRect(const QRectF &rect) override
void markDirtyTexture() override
void setLive(bool live) override
void setHasMipmaps(bool) override
void renderScene() final
Renders the scene.
void setProjectionRect(const QRect &projectionRect)
constexpr bool isNull() const noexcept
Returns true if both the width and height is 0; otherwise returns false.
Combined button and popup list for selecting options.
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLdouble GLdouble GLdouble GLdouble top
connect(quitButton, &QPushButton::clicked, &app, &QCoreApplication::quit, Qt::QueuedConnection)