#include "qquickpainteditem.h"
#include <private/qquickpainteditem_p.h>
-#include <QtQuick/private/qsgpainternode_p.h>
+#include <QtQuick/private/qsgdefaultpainternode_p.h>
#include <QtQuick/private/qsgcontext_p.h>
#include <private/qsgadaptationlayer_p.h>
QSGPainterNode *node = static_cast<QSGPainterNode *>(oldNode);
if (!node) {
- node = new QSGPainterNode(this);
+ node = d->sceneGraphContext()->createPainterNode(this);
d->node = node;
}
class QSGDistanceFieldGlyphNode;
class QOpenGLContext;
class QSGImageNode;
+class QSGPainterNode;
class QSGRectangleNode;
class QSGGlyphNode;
class QSGNinePatchNode;
virtual void endVisit(QSGOpacityNode *) = 0;
virtual bool visit(QSGImageNode *) = 0;
virtual void endVisit(QSGImageNode *) = 0;
+ virtual bool visit(QSGPainterNode *) = 0;
+ virtual void endVisit(QSGPainterNode *) = 0;
virtual bool visit(QSGRectangleNode *) = 0;
virtual void endVisit(QSGRectangleNode *) = 0;
virtual bool visit(QSGGlyphNode *) = 0;
virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
};
+class Q_QUICK_PRIVATE_EXPORT QSGPainterNode : public QSGVisitableNode
+{
+public:
+
+ virtual void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target) = 0;
+ virtual void setSize(const QSize &size) = 0;
+ virtual void setDirty(const QRect &dirtyRect = QRect()) = 0;
+ virtual void setOpaquePainting(bool opaque) = 0;
+ virtual void setLinearFiltering(bool linearFiltering) = 0;
+ virtual void setMipmapping(bool mipmapping) = 0;
+ virtual void setSmoothPainting(bool s) = 0;
+ virtual void setFillColor(const QColor &c) = 0;
+ virtual void setContentsScale(qreal s) = 0;
+ virtual void setFastFBOResizing(bool dynamic) = 0;
+
+ virtual QImage toImage() const = 0;
+ virtual void update() = 0;
+ virtual QSGTexture *texture() const = 0;
+
+ virtual void accept(QSGNodeVisitorEx *visitor) { if (visitor->visit(this)) visitor->visitChildren(this); visitor->endVisit(this); }
+};
+
class Q_QUICK_PRIVATE_EXPORT QSGNinePatchNode : public QSGVisitableNode
{
public:
#include <QtQuick/private/qsgdefaultdistancefieldglyphcache_p.h>
#include <QtQuick/private/qsgdefaultrectanglenode_p.h>
#include <QtQuick/private/qsgdefaultimagenode_p.h>
+#include <QtQuick/private/qsgdefaultpainternode_p.h>
#include <QtQuick/private/qsgdefaultglyphnode_p.h>
#include <QtQuick/private/qsgdistancefieldglyphnode_p.h>
#include <QtQuick/private/qsgdistancefieldglyphnode_p_p.h>
}
/*!
+ Factory function for scene graph backends of Painter elements
+ */
+QSGPainterNode *QSGContext::createPainterNode(QQuickPaintedItem *item)
+{
+ return new QSGDefaultPainterNode(item);
+}
+
+/*!
Factory function for scene graph backends of the Text elements;
*/
QSGGlyphNode *QSGContext::createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode)
class QSGContextPrivate;
class QSGRectangleNode;
class QSGImageNode;
+class QSGPainterNode;
class QSGGlyphNode;
class QSGNinePatchNode;
class QSGRenderer;
class QQuickTextureFactory;
class QSGDistanceFieldGlyphCacheManager;
class QSGContext;
+class QQuickPaintedItem;
Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_RENDERLOOP)
Q_DECLARE_LOGGING_CATEGORY(QSG_LOG_TIME_COMPILATION)
QSGRectangleNode *createRectangleNode(const QRectF &rect, const QColor &c);
virtual QSGRectangleNode *createRectangleNode();
virtual QSGImageNode *createImageNode();
+ virtual QSGPainterNode *createPainterNode(QQuickPaintedItem *item);
virtual QSGGlyphNode *createGlyphNode(QSGRenderContext *rc, bool preferNativeGlyphNode);
virtual QSGNinePatchNode *createNinePatchNode();
virtual QSGLayer *createLayer(QSGRenderContext *renderContext);
$$PWD/util/qsgtexture.h \
$$PWD/util/qsgtexture_p.h \
$$PWD/util/qsgtextureprovider.h \
- $$PWD/util/qsgpainternode_p.h \
+ $$PWD/util/qsgdefaultpainternode_p.h \
$$PWD/util/qsgdistancefieldutil_p.h \
$$PWD/util/qsgshadersourcebuilder_p.h
$$PWD/util/qsgvertexcolormaterial.cpp \
$$PWD/util/qsgtexture.cpp \
$$PWD/util/qsgtextureprovider.cpp \
- $$PWD/util/qsgpainternode.cpp \
+ $$PWD/util/qsgdefaultpainternode.cpp \
$$PWD/util/qsgdistancefieldutil.cpp \
$$PWD/util/qsgsimplematerial.cpp \
$$PWD/util/qsgshadersourcebuilder.cpp
**
****************************************************************************/
-#include "qsgpainternode_p.h"
+#include "qsgdefaultpainternode_p.h"
#include <QtQuick/private/qquickpainteditem_p.h>
m_dirty_rect = QRect();
}
-QSGPainterNode::QSGPainterNode(QQuickPaintedItem *item)
- : QSGGeometryNode()
+QSGDefaultPainterNode::QSGDefaultPainterNode(QQuickPaintedItem *item)
+ : QSGPainterNode()
, m_preferredRenderTarget(QQuickPaintedItem::Image)
, m_actualRenderTarget(QQuickPaintedItem::Image)
, m_item(item)
#endif
}
-QSGPainterNode::~QSGPainterNode()
+QSGDefaultPainterNode::~QSGDefaultPainterNode()
{
delete m_texture;
delete m_fbo;
delete m_gl_device;
}
-void QSGPainterNode::paint()
+void QSGDefaultPainterNode::paint()
{
QRect dirtyRect = m_dirtyRect.isNull() ? QRect(0, 0, m_size.width(), m_size.height()) : m_dirtyRect;
m_dirtyRect = QRect();
}
-void QSGPainterNode::update()
+void QSGDefaultPainterNode::update()
{
if (m_dirtyRenderTarget)
updateRenderTarget();
m_dirtyContents = false;
}
-void QSGPainterNode::updateTexture()
+void QSGDefaultPainterNode::updateTexture()
{
m_texture->setHasAlphaChannel(!m_opaquePainting);
m_material.setTexture(m_texture);
markDirty(DirtyMaterial);
}
-void QSGPainterNode::updateGeometry()
+void QSGDefaultPainterNode::updateGeometry()
{
QRectF source;
if (m_actualRenderTarget == QQuickPaintedItem::Image)
markDirty(DirtyGeometry);
}
-void QSGPainterNode::updateRenderTarget()
+void QSGDefaultPainterNode::updateRenderTarget()
{
if (!m_extensionsChecked) {
const QSet<QByteArray> extensions = m_context->openglContext()->extensions();
m_texture = texture;
}
-void QSGPainterNode::updateFBOSize()
+void QSGDefaultPainterNode::updateFBOSize()
{
int fboWidth;
int fboHeight;
m_fboSize = QSize(fboWidth, fboHeight);
}
-void QSGPainterNode::setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target)
+void QSGDefaultPainterNode::setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target)
{
if (m_preferredRenderTarget == target)
return;
m_dirtyTexture = true;
}
-void QSGPainterNode::setSize(const QSize &size)
+void QSGDefaultPainterNode::setSize(const QSize &size)
{
if (size == m_size)
return;
m_dirtyTexture = true;
}
-void QSGPainterNode::setDirty(const QRect &dirtyRect)
+void QSGDefaultPainterNode::setDirty(const QRect &dirtyRect)
{
m_dirtyContents = true;
m_dirtyRect = dirtyRect;
markDirty(DirtyMaterial);
}
-void QSGPainterNode::setOpaquePainting(bool opaque)
+void QSGDefaultPainterNode::setOpaquePainting(bool opaque)
{
if (opaque == m_opaquePainting)
return;
m_dirtyTexture = true;
}
-void QSGPainterNode::setLinearFiltering(bool linearFiltering)
+void QSGDefaultPainterNode::setLinearFiltering(bool linearFiltering)
{
if (linearFiltering == m_linear_filtering)
return;
markDirty(DirtyMaterial);
}
-void QSGPainterNode::setMipmapping(bool mipmapping)
+void QSGDefaultPainterNode::setMipmapping(bool mipmapping)
{
if (mipmapping == m_mipmapping)
return;
m_dirtyTexture = true;
}
-void QSGPainterNode::setSmoothPainting(bool s)
+void QSGDefaultPainterNode::setSmoothPainting(bool s)
{
if (s == m_smoothPainting)
return;
m_dirtyRenderTarget = true;
}
-void QSGPainterNode::setFillColor(const QColor &c)
+void QSGDefaultPainterNode::setFillColor(const QColor &c)
{
if (c == m_fillColor)
return;
markDirty(DirtyMaterial);
}
-void QSGPainterNode::setContentsScale(qreal s)
+void QSGDefaultPainterNode::setContentsScale(qreal s)
{
if (s == m_contentsScale)
return;
markDirty(DirtyMaterial);
}
-void QSGPainterNode::setFastFBOResizing(bool dynamic)
+void QSGDefaultPainterNode::setFastFBOResizing(bool dynamic)
{
m_fastFBOResizing = dynamic;
}
-QImage QSGPainterNode::toImage() const
+QImage QSGDefaultPainterNode::toImage() const
{
if (m_actualRenderTarget == QQuickPaintedItem::Image)
return m_image;
**
****************************************************************************/
-#ifndef QSGPAINTERNODE_P_H
-#define QSGPAINTERNODE_P_H
+#ifndef QSGDEFAULTPAINTERNODE_P_H
+#define QSGDEFAULTPAINTERNODE_P_H
-#include <QtQuick/qsgnode.h>
+#include <private/qsgadaptationlayer_p.h>
#include "qsgtexturematerial.h"
#include "qsgtexture_p.h"
QRect m_dirty_rect;
};
-class Q_QUICK_PRIVATE_EXPORT QSGPainterNode : public QSGGeometryNode
+class Q_QUICK_PRIVATE_EXPORT QSGDefaultPainterNode : public QSGPainterNode
{
public:
- QSGPainterNode(QQuickPaintedItem *item);
- virtual ~QSGPainterNode();
+ QSGDefaultPainterNode(QQuickPaintedItem *item);
+ virtual ~QSGDefaultPainterNode();
void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target);
QT_END_NAMESPACE
-#endif // QSGPAINTERNODE_P_H
+#endif // QSGDEFAULTPAINTERNODE_P_H
#include <QtQuick/private/qsggeometry_p.h>
#include <QtQuick/private/qsgnode_p.h>
#include <QtQuick/private/qsgnodeupdater_p.h>
-#include <QtQuick/private/qsgpainternode_p.h>
+#include <QtQuick/private/qsgdefaultpainternode_p.h>
#include <QtQuick/private/qsgrenderer_p.h>
#include <QtQuick/private/qsgrenderloop_p.h>
#include <QtQuick/private/qsgrendernode_p.h>
#include <QtQuick/qquickview.h>
#include <private/qquickitem_p.h>
-#include <private/qsgpainternode_p.h>
+#include <private/qsgdefaultpainternode_p.h>
class tst_QQuickPaintedItem: public QObject
{
QSGNode *updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
- paintNode = static_cast<QSGPainterNode *>(QQuickPaintedItem::updatePaintNode(oldNode, data));
+ paintNode = static_cast<QSGDefaultPainterNode *>(QQuickPaintedItem::updatePaintNode(oldNode, data));
return paintNode;
}
- QSGPainterNode *paintNode;
+ QSGDefaultPainterNode *paintNode;
int paintRequests;
QRectF clipRect;
};