12#if QT_CONFIG(quick_sprite)
18#include <private/qsgrendernode_p.h>
19#include <private/qsgplaintexture_p.h>
40 return r.toAlignedRect();
47 , m_hasClipRegion(
false)
76 m_handle.simpleImageNode =
static_cast<QSGImageNode*
>(node);
78#if QT_CONFIG(quick_sprite)
79 case QSGSoftwareRenderableNode::SpriteNode:
87 m_handle.simpleRectNode =
nullptr;
105 switch (m_nodeType) {
107 if (m_handle.simpleRectNode->color().alpha() == 255)
113 if (!m_handle.simpleTextureNode->texture()->hasAlphaChannel())
119 m_isOpaque = !m_handle.imageNode->pixmap().hasAlphaChannel();
124 if (m_handle.painterNode->opaquePainting())
127 boundingRect =
QRectF(0, 0, m_handle.painterNode->size().width(), m_handle.painterNode->size().height());
130 if (m_handle.rectangleNode->isOpaque())
140 m_isOpaque = m_handle.ninePatchNode->isOpaque();
145 if (m_handle.simpleRectangleNode->color().alpha() == 255)
151 if (!m_handle.simpleImageNode->texture()->hasAlphaChannel())
156#if QT_CONFIG(quick_sprite)
157 case QSGSoftwareRenderableNode::SpriteNode:
158 m_isOpaque = m_handle.spriteNode->isOpaque();
176 m_boundingRectMin =
toRectMin(transformedRect);
177 m_boundingRectMax =
toRectMax(transformedRect);
179 if (m_hasClipRegion && m_clipRegion.
rectCount() <= 1) {
182 m_boundingRectMin =
QRect();
183 m_boundingRectMax =
QRect();
185 const auto rects = m_clipRegion.
begin();
186 m_boundingRectMin = m_boundingRectMin.
intersected(rects[0]);
187 m_boundingRectMax = m_boundingRectMax.
intersected(rects[0]);
192 if (m_opacity < 1.0f)
195 m_dirtyRegion =
QRegion(m_boundingRectMax);
228 rd->m_localMatrix = m_transform;
229 rd->m_matrix = &
rd->m_localMatrix;
230 rd->m_opacity = m_opacity;
240 m_handle.renderNode->render(&rs);
246 m_previousDirtyRegion =
QRegion(br);
263 if (forceOpaquePainting || m_isOpaque)
266 switch (m_nodeType) {
268 painter->
fillRect(m_handle.simpleRectNode->rect(), m_handle.simpleRectNode->color());
274 const QPixmap &pm = pt->pixmap();
275 painter->
drawPixmap(m_handle.simpleTextureNode->rect(), pm, m_handle.simpleTextureNode->sourceRect());
277 const QImage &im = pt->image();
278 painter->
drawImage(m_handle.simpleTextureNode->rect(), im, m_handle.simpleTextureNode->sourceRect());
283 m_handle.imageNode->paint(
painter);
286 m_handle.painterNode->paint(
painter);
289 m_handle.rectangleNode->paint(
painter);
292 m_handle.glpyhNode->paint(
painter);
295 m_handle.ninePatchNode->paint(
painter);
303#if QT_CONFIG(quick_sprite)
304 case QSGSoftwareRenderableNode::SpriteNode:
314 QRegion areaToBeFlushed = m_dirtyRegion;
315 m_previousDirtyRegion =
QRegion(m_boundingRectMax);
319 return areaToBeFlushed;
324 return m_dirtyRegion.
isEmpty();
337 if (m_clipRegion == clipRect && m_hasClipRegion == hasClipRegion)
340 m_clipRegion = clipRect;
341 m_hasClipRegion = hasClipRegion;
373 qCDebug(lcRenderable) <<
"addDirtyRegion: " <<
dirtyRegion <<
"old dirtyRegion: " << prev <<
"new dirtyRegion: " << m_dirtyRegion;
387 qCDebug(lcRenderable) <<
"subtractDirtyRegion: " <<
dirtyRegion <<
"old dirtyRegion" << prev <<
"new dirtyRegion: " << m_dirtyRegion;
395 return m_previousDirtyRegion;
402 return m_dirtyRegion;
The QMatrix4x4 class represents a 4x4 transformation matrix in 3D space.
The QPainter class performs low-level painting on widgets and other paint devices.
QPaintDevice * device() const
Returns the paint device on which this painter is currently painting, or \nullptr if the painter is n...
void restore()
Restores the current painter state (pops a saved state off the stack).
void setOpacity(qreal opacity)
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
void save()
Saves the current painter state (pushes the state onto a stack).
void drawImage(const QRectF &targetRect, const QImage &image, const QRectF &sourceRect, Qt::ImageConversionFlags flags=Qt::AutoColor)
Draws the rectangular portion source of the given image into the target rectangle in the paint device...
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
void setClipRegion(const QRegion &, Qt::ClipOperation op=Qt::ReplaceClip)
Sets the clip region to the given region using the specified clip operation.
void setTransform(const QTransform &transform, bool combine=false)
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
QRect intersected(const QRect &other) const noexcept
The QRegion class specifies a clip region for a painter.
int rectCount() const noexcept
bool intersects(const QRegion &r) const
bool isEmpty() const
Returns true if the region is empty; otherwise returns false.
const_iterator begin() const noexcept
QRegion intersected(const QRegion &r) const
QRegion subtracted(const QRegion &r) const
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
\group qtquick-scenegraph-nodes \title Qt Quick Scene Graph Node classes
The QSGRectangleNode class is a convenience class for drawing solid filled rectangles using scenegrap...
static QSGRenderNodePrivate * get(QSGRenderNode *node)
The QSGRenderNode class represents a set of custom rendering commands targeting the graphics API that...
The QSGSimpleRectNode class is a convenience class for drawing solid filled rectangles using scenegra...
The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the ...
void setClipRegion(const QRegion &clipRegion, bool hasClipRegion=true)
void setOpacity(float opacity)
~QSGSoftwareRenderableNode()
void setTransform(const QTransform &transform)
QSGSoftwareRenderableNode(NodeType type, QSGNode *node)
void subtractDirtyRegion(const QRegion &dirtyRegion)
QRegion renderNode(QPainter *painter, bool forceOpaquePainting=false)
QRegion previousDirtyRegion(bool wasRemoved=false) const
QTransform transform() const
QRegion dirtyRegion() const
void addDirtyRegion(const QRegion &dirtyRegion, bool forceDirty=true)
bool isDirtyRegionEmpty() const
Combined button and popup list for selecting options.
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
bool qFuzzyIsNull(qfloat16 f) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCDebug(category,...)
GLuint GLfloat GLfloat GLfloat GLfloat y1
GLuint GLfloat GLfloat GLfloat x1
GLuint GLenum GLenum transform
GLfixed GLfixed GLfixed y2
static const QRectF boundingRect(const QPointF *points, int pointCount)
QT_BEGIN_NAMESPACE QRect toRectMin(const QRectF &r)
QRect toRectMax(const QRectF &r)
QRandomGenerator64 rd
[10]
const QRegion * clipRegion() const override
bool scissorEnabled() const override
const QMatrix4x4 * projectionMatrix() const override
bool stencilEnabled() const override
QRect scissorRect() const override
int stencilValue() const override