aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--softwarecontext/painternode.cpp11
-rw-r--r--softwarecontext/painternode.h3
-rw-r--r--softwarecontext/pixmaptexture.cpp5
-rw-r--r--softwarecontext/pixmaptexture.h1
4 files changed, 20 insertions, 0 deletions
diff --git a/softwarecontext/painternode.cpp b/softwarecontext/painternode.cpp
index 714368b675..bf5ec5f202 100644
--- a/softwarecontext/painternode.cpp
+++ b/softwarecontext/painternode.cpp
@@ -18,6 +18,7 @@
**
****************************************************************************/
#include "painternode.h"
+#include "pixmaptexture.h"
#include <qmath.h>
PainterNode::PainterNode(QQuickPaintedItem *item)
@@ -25,6 +26,7 @@ PainterNode::PainterNode(QQuickPaintedItem *item)
, m_preferredRenderTarget(QQuickPaintedItem::Image)
, m_actualRenderTarget(QQuickPaintedItem::Image)
, m_item(item)
+ , m_texture(0)
, m_dirtyContents(false)
, m_opaquePainting(false)
, m_linear_filtering(false)
@@ -41,6 +43,11 @@ PainterNode::PainterNode(QQuickPaintedItem *item)
setGeometry((QSGGeometry*)1);
}
+PainterNode::~PainterNode()
+{
+ delete m_texture;
+}
+
void PainterNode::setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target)
{
if (m_preferredRenderTarget == target)
@@ -132,6 +139,10 @@ void PainterNode::update()
m_pixmap = QPixmap(m_size);
if (!m_opaquePainting)
m_pixmap.fill(Qt::transparent);
+
+ if (m_texture)
+ delete m_texture;
+ m_texture = new PixmapTexture(m_pixmap);
}
if (m_dirtyContents)
diff --git a/softwarecontext/painternode.h b/softwarecontext/painternode.h
index 046ae93d15..db0d03e28a 100644
--- a/softwarecontext/painternode.h
+++ b/softwarecontext/painternode.h
@@ -29,6 +29,7 @@ class PainterNode : public QSGPainterNode
{
public:
PainterNode(QQuickPaintedItem *item);
+ ~PainterNode();
void setPreferredRenderTarget(QQuickPaintedItem::RenderTarget target);
@@ -60,6 +61,7 @@ public:
QImage toImage() const;
void update();
+ QSGTexture *texture() const { return m_texture; }
void paint(QPainter *painter);
@@ -73,6 +75,7 @@ private:
QQuickPaintedItem *m_item;
QPixmap m_pixmap;
+ QSGTexture *m_texture;
QSize m_size;
bool m_dirtyContents;
diff --git a/softwarecontext/pixmaptexture.cpp b/softwarecontext/pixmaptexture.cpp
index 25fb41a880..d3dd747a9e 100644
--- a/softwarecontext/pixmaptexture.cpp
+++ b/softwarecontext/pixmaptexture.cpp
@@ -24,6 +24,11 @@ PixmapTexture::PixmapTexture(const QImage &image)
{
}
+PixmapTexture::PixmapTexture(const QPixmap &pixmap)
+ : m_pixmap(pixmap)
+{
+}
+
int PixmapTexture::textureId() const
{
diff --git a/softwarecontext/pixmaptexture.h b/softwarecontext/pixmaptexture.h
index 9337376f41..c3ee09dfe1 100644
--- a/softwarecontext/pixmaptexture.h
+++ b/softwarecontext/pixmaptexture.h
@@ -27,6 +27,7 @@ class PixmapTexture : public QSGTexture
Q_OBJECT
public:
PixmapTexture(const QImage &image);
+ PixmapTexture(const QPixmap &pixmap);
virtual int textureId() const;
virtual QSize textureSize() const;