6#include <QtQuick/private/qquickpainteditem_p.h>
8#include <QtQuick/private/qsgdefaultrendercontext_p.h>
9#include <QtQuick/private/qsgcontext_p.h>
15#define QT_MINIMUM_DYNAMIC_FBO_SIZE 64U
25 if (!m_dirty_rect.
isNull()) {
27 m_dirty_rect =
QRect();
37 , m_geometry(
QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
39 , m_fillColor(
Qt::transparent)
40 , m_contentsScale(1.0)
41 , m_dirtyContents(
false)
42 , m_opaquePainting(
false)
43 , m_linear_filtering(
false)
45 , m_smoothPainting(
false)
46 , m_multisamplingSupported(
false)
47 , m_fastFBOResizing(
false)
48 , m_dirtyGeometry(
false)
49 , m_dirtyRenderTarget(
false)
50 , m_dirtyTexture(
false)
59#ifdef QSG_RUNTIME_DESCRIPTION
79 if (m_smoothPainting) {
84 QRect dirtyTextureRect;
86 if (m_contentsScale == 1) {
91 dirtyTextureRect =
QRectF(dirtyRect.
x() * scaleX,
92 dirtyRect.
y() * scaleY,
93 dirtyRect.
width() * scaleX,
98 qFloor(dirtyRect.
y()/m_contentsScale),
99 qCeil(dirtyRect.
width()/m_contentsScale+dirtyRect.
x()/m_contentsScale-
qFloor(dirtyRect.
x()/m_contentsScale)),
100 qCeil(dirtyRect.
height()/m_contentsScale+dirtyRect.
y()/m_contentsScale-
qFloor(dirtyRect.
y()/m_contentsScale)));
102 dirtyTextureRect = dirtyRect;
106 if (!m_dirtyRect.
isNull()) {
121 m_dirtyRect =
QRect();
126 if (m_dirtyRenderTarget)
127 updateRenderTarget();
136 m_dirtyGeometry =
false;
137 m_dirtyRenderTarget =
false;
138 m_dirtyTexture =
false;
139 m_dirtyContents =
false;
142void QSGDefaultPainterNode::updateTexture()
151void QSGDefaultPainterNode::updateGeometry()
163void QSGDefaultPainterNode::updateRenderTarget()
165 m_dirtyContents =
true;
168 if (!m_image.
isNull() && !m_dirtyGeometry)
183 if (m_preferredRenderTarget ==
target)
186 m_preferredRenderTarget =
target;
188 m_dirtyRenderTarget =
true;
189 m_dirtyGeometry =
true;
190 m_dirtyTexture =
true;
199 m_dirtyGeometry =
true;
204 if (
size == m_textureSize)
207 m_textureSize =
size;
208 m_dirtyRenderTarget =
true;
209 m_dirtyGeometry =
true;
210 m_dirtyTexture =
true;
215 m_dirtyContents =
true;
216 m_dirtyRect = dirtyRect;
219 m_dirtyTexture =
true;
226 if (opaque == m_opaquePainting)
229 m_opaquePainting = opaque;
230 m_dirtyTexture =
true;
253 m_dirtyTexture =
true;
258 if (
s == m_smoothPainting)
261 m_smoothPainting =
s;
262 m_dirtyRenderTarget =
true;
267 if (
c == m_fillColor)
276 if (
s == m_contentsScale)
285 if (m_fastFBOResizing == fastResizing)
288 m_fastFBOResizing = fastResizing;
The QColor class provides colors based on RGB, HSV or CMYK values.
bool isValid() const noexcept
Returns true if the color is valid; otherwise returns false.
bool isNull() const
Returns true if it is a null image, otherwise returns false.
@ Format_RGBA8888_Premultiplied
void fill(uint pixel)
Fills the entire image with the given pixelValue.
static QObjectPrivate * get(QObject *o)
The QPainter class performs low-level painting on widgets and other paint devices.
void setClipRect(const QRectF &, Qt::ClipOperation op=Qt::ReplaceClip)
Enables clipping, and sets the clip region to the given rectangle using the given clip operation.
bool begin(QPaintDevice *)
Begins painting the paint device and returns true if successful; otherwise returns false.
void scale(qreal sx, qreal sy)
Scales the coordinate system by ({sx}, {sy}).
void setCompositionMode(CompositionMode mode)
Sets the composition mode to the given mode.
@ CompositionMode_SourceOver
void setRenderHints(RenderHints hints, bool on=true)
void fillRect(const QRectF &, const QBrush &)
Fills the given rectangle with the brush specified.
\inmodule QtCore\reentrant
The QQuickPaintedItem class provides a way to use the QPainter API in the QML Scene Graph.
virtual void paint(QPainter *painter)=0
This function, which is usually called by the QML Scene Graph, paints the contents of an item in loca...
RenderTarget
This enum describes QQuickPaintedItem's render targets.
@ InvertedYFramebufferObject
\inmodule QtCore\reentrant
QRect toAlignedRect() const noexcept
\inmodule QtCore\reentrant
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr int x() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int y() const noexcept
Returns the y-coordinate of the rectangle's top edge.
void setGeometry(QSGGeometry *geometry)
Sets the geometry of this node to geometry.
void setSize(const QSize &size) override
bool linearFiltering() const
QImage toImage() const override
void setSmoothPainting(bool s) override
void setFillColor(const QColor &c) override
void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) override
void setContentsScale(qreal s) override
void setTextureSize(const QSize &textureSize) override
virtual ~QSGDefaultPainterNode()
void setLinearFiltering(bool linearFiltering) override
void setOpaquePainting(bool opaque) override
void setDirty(const QRect &dirtyRect=QRect()) override
void setFastFBOResizing(bool fastResizing) override
void setMipmapping(bool mipmapping) override
QSGDefaultPainterNode(QQuickPaintedItem *item)
void setMaterial(QSGMaterial *material)
Sets the material of this geometry node to material.
void setOpaqueMaterial(QSGMaterial *material)
Sets the opaque material of this geometry to material.
The QSGGeometry class provides low-level storage for graphics primitives in the \l{Qt Quick Scene Gra...
static void updateTexturedRectGeometry(QSGGeometry *g, const QRectF &rect, const QRectF &sourceRect)
Updates the geometry g with the coordinates in rect and texture coordinates from textureRect.
void markDirty(DirtyState bits)
Notifies all connected renderers that the node has dirty bits.
void setFiltering(QSGTexture::Filtering filteringType)
Sets the filtering to filtering.
void setMipmapFiltering(QSGTexture::Filtering filteringType)
Sets the mipmap mode to filtering.
void setTexture(QSGTexture *texture)
Sets the texture of this material to texture.
void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override
Call this function to enqueue image upload operations to resourceUpdates, in case there are any pendi...
void setDirtyRect(const QRect &rect)
void setTextureSize(const QSize &size)
void setImage(const QImage &image)
void commitTextureOperations(QRhi *rhi, QRhiResourceUpdateBatch *resourceUpdates) override
Call this function to enqueue image upload operations to resourceUpdates, in case there are any pendi...
void setOwnsTexture(bool owns)
void setHasAlphaChannel(bool alpha)
constexpr int height() const noexcept
Returns the height.
constexpr int width() const noexcept
Returns the width.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Combined button and popup list for selecting options.
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLsizei GLsizei GLchar * source
void qsgnode_set_description(QSGNode *node, const QString &description)