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)
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) {
274 const QPixmap &pm = pt->pixmap();
277 const QImage &im = pt->image();
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;
int alpha() const noexcept
Returns the alpha color component of this color.
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...
bool hasAlphaChannel() const
\inmodule QtCore\reentrant
constexpr QRect toRect() const noexcept
Returns a QRect based on the values of this rectangle.
\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
virtual QRectF boundingRect() const
The QSGImageNode class is provided for convenience to easily draw textured content using the QML scen...
virtual QRectF rect() const =0
Returns the target rect of this image node.
virtual QSGTexture * texture() const =0
Returns the texture for this image node.
\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...
virtual QRectF rect() const =0
Returns the rectangle that this rect node covers.
virtual QColor color() const =0
Returns the color of this rectangle.
static QSGRenderNodePrivate * get(QSGRenderNode *node)
The QSGRenderNode class represents a set of custom rendering commands targeting the graphics API that...
virtual void render(const RenderState *state)=0
This function is called by the renderer and should paint this node with directly invoking commands in...
virtual RenderingFlags flags() const
virtual QRectF rect() const
The QSGSimpleRectNode class is a convenience class for drawing solid filled rectangles using scenegra...
QRectF rect() const
Returns the rectangle that this rect node covers.
QColor color() const
Returns the color of this rectangle.
The QSGSimpleTextureNode class is provided for convenience to easily draw textured content using the ...
QSGTexture * texture() const
Returns the texture for this texture node.
QRectF rect() const
Returns the target rect of this texture node.
QRectF sourceRect() const
Returns the source rect of this texture node.
void paint(QPainter *painter)
void paint(QPainter *painter)
const QPixmap & pixmap() const
void paint(QPainter *painter)
void paint(QPainter *painter)
bool opaquePainting() const
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
virtual bool hasAlphaChannel() const =0
Returns true if the texture data contains an alpha channel.
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
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