aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJustin McPherson <justin.mcpherson@nokia.com>2012-03-02 16:24:04 +1000
committerQt by Nokia <qt-info@nokia.com>2012-03-06 06:34:29 +0100
commitbe4c74948371ddf6f1ed260783b43b5a3d9e60a7 (patch)
tree4bf6a349816a68f90a744d3bce1851cfbc34465e /src
parentc2e5141af3fda37d50fd014074077139de05d2b8 (diff)
Remove QQuickCanvasItemNode.
A custom SGNode is not necessary. Change-Id: Ibde71dd502bc782503dbd7d98e6ad8b811b7aedb Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/quick/items/context2d/context2d.pri2
-rw-r--r--src/quick/items/context2d/qquickcanvasitem.cpp9
-rw-r--r--src/quick/items/context2d/qquickcanvasitemnode.cpp112
-rw-r--r--src/quick/items/context2d/qquickcanvasitemnode_p.h87
4 files changed, 4 insertions, 206 deletions
diff --git a/src/quick/items/context2d/context2d.pri b/src/quick/items/context2d/context2d.pri
index 84346f68c6..c73d58b020 100644
--- a/src/quick/items/context2d/context2d.pri
+++ b/src/quick/items/context2d/context2d.pri
@@ -2,7 +2,6 @@ SOURCES += \
$$PWD/qquickcanvasitem.cpp \
$$PWD/qquickcanvascontext.cpp \
$$PWD/qquickcontext2d.cpp \
- $$PWD/qquickcanvasitemnode.cpp \
$$PWD/qquickcontext2dtile.cpp \
$$PWD/qquickcontext2dtexture.cpp \
$$PWD/qquickcontext2dcommandbuffer.cpp \
@@ -11,7 +10,6 @@ HEADERS += \
$$PWD/qquickcanvasitem_p.h \
$$PWD/qquickcanvascontext_p.h \
$$PWD/qquickcontext2d_p.h \
- $$PWD/qquickcanvasitemnode_p.h \
$$PWD/qquickcontext2dtile_p.h \
$$PWD/qquickcontext2dtexture_p.h \
$$PWD/qquickcontext2dcommandbuffer_p.h \
diff --git a/src/quick/items/context2d/qquickcanvasitem.cpp b/src/quick/items/context2d/qquickcanvasitem.cpp
index 550ab20403..3d520d22e7 100644
--- a/src/quick/items/context2d/qquickcanvasitem.cpp
+++ b/src/quick/items/context2d/qquickcanvasitem.cpp
@@ -44,7 +44,7 @@
#include <private/qquickitem_p.h>
#include <private/qquickcanvascontext_p.h>
#include <private/qquickcontext2d_p.h>
-#include <private/qquickcanvasitemnode_p.h>
+#include <qsgsimpletexturenode.h>
#include <QtQuick/private/qquickpixmapcache_p.h>
#include <qqmlinfo.h>
@@ -560,17 +560,16 @@ QSGNode *QQuickCanvasItem::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData
if (!d->contextInitialized)
return 0;
- QQuickCanvasItemNode *node = static_cast<QQuickCanvasItemNode*>(oldNode);
+ QSGSimpleTextureNode *node = static_cast<QSGSimpleTextureNode*>(oldNode);
if (!node) {
- node = new QQuickCanvasItemNode;
+ node = new QSGSimpleTextureNode;
}
if (d->renderStrategy == QQuickCanvasItem::Cooperative)
d->context->sync();
node->setTexture(d->context->texture());
- node->setSize(d->canvasWindow.size());
- node->update();
+ node->setRect(QRectF(QPoint(0, 0), d->canvasWindow.size()));
return node;
}
diff --git a/src/quick/items/context2d/qquickcanvasitemnode.cpp b/src/quick/items/context2d/qquickcanvasitemnode.cpp
deleted file mode 100644
index 5a2dd80ff1..0000000000
--- a/src/quick/items/context2d/qquickcanvasitemnode.cpp
+++ /dev/null
@@ -1,112 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#include "qquickcanvasitemnode_p.h"
-
-#include <QtQuick/private/qsgcontext_p.h>
-#include <QtCore/qmath.h>
-
-QT_BEGIN_NAMESPACE
-
-
-QQuickCanvasItemNode::QQuickCanvasItemNode()
- : QSGGeometryNode()
- , m_geometry(QSGGeometry::defaultAttributes_TexturedPoint2D(), 4)
- , m_texture(0)
- , m_size(1, 1)
- , m_dirtyGeometry(false)
- , m_dirtyTexture(false)
-{
- setMaterial(&m_materialO);
- setOpaqueMaterial(&m_material);
- setGeometry(&m_geometry);
-}
-
-QQuickCanvasItemNode::~QQuickCanvasItemNode()
-{
- delete m_texture;
-}
-
-void QQuickCanvasItemNode::setSize(const QSizeF& size)
-{
- if (m_size != size) {
- m_dirtyGeometry = true;
- m_size = size;
- }
-}
-
-void QQuickCanvasItemNode::setTexture(QSGDynamicTexture* texture)
-{
- if (texture != m_texture) {
- m_dirtyTexture = true;
- m_texture = texture;
- }
-}
-
-void QQuickCanvasItemNode::update()
-{
- if (m_dirtyGeometry)
- updateGeometry();
- if (m_dirtyTexture)
- updateTexture();
-
- m_dirtyGeometry = false;
- m_dirtyTexture = false;
-}
-
-void QQuickCanvasItemNode::updateTexture()
-{
- m_material.setTexture(m_texture);
- m_materialO.setTexture(m_texture);
- markDirty(DirtyMaterial);
-}
-
-void QQuickCanvasItemNode::updateGeometry()
-{
- QRectF source = m_texture->normalizedTextureSubRect();
- QSGGeometry::updateTexturedRectGeometry(&m_geometry,
- QRectF(0, 0, m_size.width(), m_size.height()),
- source);
- markDirty(DirtyGeometry);
-}
-
-QT_END_NAMESPACE
-
diff --git a/src/quick/items/context2d/qquickcanvasitemnode_p.h b/src/quick/items/context2d/qquickcanvasitemnode_p.h
deleted file mode 100644
index 7eb7d2aec5..0000000000
--- a/src/quick/items/context2d/qquickcanvasitemnode_p.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies).
-** Contact: http://www.qt-project.org/
-**
-** This file is part of the QtQml module of the Qt Toolkit.
-**
-** $QT_BEGIN_LICENSE:LGPL$
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation and
-** appearing in the file LICENSE.LGPL included in the packaging of this
-** file. Please review the following information to ensure the GNU Lesser
-** General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** In addition, as a special exception, Nokia gives you certain additional
-** rights. These rights are described in the Nokia Qt LGPL Exception
-** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU General
-** Public License version 3.0 as published by the Free Software Foundation
-** and appearing in the file LICENSE.GPL included in the packaging of this
-** file. Please review the following information to ensure the GNU General
-** Public License version 3.0 requirements will be met:
-** http://www.gnu.org/copyleft/gpl.html.
-**
-** Other Usage
-** Alternatively, this file may be used in accordance with the terms and
-** conditions contained in a signed written agreement between you and Nokia.
-**
-**
-**
-**
-**
-**
-** $QT_END_LICENSE$
-**
-****************************************************************************/
-
-#ifndef QQUICKCONTEXT2DNODE_P_H
-#define QQUICKCONTEXT2DNODE_P_H
-
-#include <QtQuick/qsgnode.h>
-#include <QtQuick/qsgtexturematerial.h>
-
-#include "qquickcanvasitem_p.h"
-#include "qquickcontext2dtexture_p.h"
-#include "qquickcontext2d_p.h"
-
-QT_BEGIN_HEADER
-
-QT_BEGIN_NAMESPACE
-
-
-class QSGDynamicTexture;
-
-class QQuickCanvasItemNode : public QSGGeometryNode
-{
-public:
- QQuickCanvasItemNode();
- ~QQuickCanvasItemNode();
-
- void setTexture(QSGDynamicTexture *texture);
- void update();
- void setSize(const QSizeF& size);
-
-private:
- void updateTexture();
- void updateGeometry();
-
- QSGOpaqueTextureMaterial m_material;
- QSGTextureMaterial m_materialO;
- QSGGeometry m_geometry;
- QSGTexture* m_texture;
- QSizeF m_size;
-
- bool m_dirtyGeometry;
- bool m_dirtyTexture;
-};
-
-QT_END_HEADER
-
-QT_END_NAMESPACE
-
-#endif // QQUICKCONTEXT2DNODE_P_H