aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKim Motoyoshi Kalland <kim.kalland@nokia.com>2011-11-04 13:57:14 +0100
committerQt by Nokia <qt-info@nokia.com>2011-11-07 15:21:19 +0100
commit29e0b656e8e2854146ce81e44d377c475aeb6152 (patch)
treeb1b28e3586cc962680d7148eca3f8ad009bdf4be /src
parentaa6d47e9c45bbff074cc43596b2d5d4150aebb8b (diff)
Minor improvements to some of the node implementations.
Change-Id: I05c7c4810b37d8f808e812eac7b2128d21de36c8 Reviewed-by: Yoann Lopes <yoann.lopes@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/declarative/scenegraph/qsgdefaultglyphnode.cpp2
-rw-r--r--src/declarative/scenegraph/qsgdefaultrectanglenode.cpp28
-rw-r--r--src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp2
3 files changed, 12 insertions, 20 deletions
diff --git a/src/declarative/scenegraph/qsgdefaultglyphnode.cpp b/src/declarative/scenegraph/qsgdefaultglyphnode.cpp
index b8cd247908..f41fbe486a 100644
--- a/src/declarative/scenegraph/qsgdefaultglyphnode.cpp
+++ b/src/declarative/scenegraph/qsgdefaultglyphnode.cpp
@@ -65,7 +65,7 @@ void QSGDefaultGlyphNode::setColor(const QColor &color)
m_color = color;
if (m_material != 0) {
m_material->setColor(color);
- setMaterial(m_material); // Indicate the material state has changed
+ markDirty(DirtyMaterial);
}
}
diff --git a/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp b/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp
index 922459063d..4753b6021e 100644
--- a/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp
+++ b/src/declarative/scenegraph/qsgdefaultrectanglenode.cpp
@@ -77,13 +77,8 @@ QSGDefaultRectangleNode::QSGDefaultRectangleNode(QSGContext *context)
QSGDefaultRectangleNode::~QSGDefaultRectangleNode()
{
- switch (m_material_type) {
- case TypeFlat:
- break;
- case TypeVertexGradient:
+ if (m_material_type == TypeVertexGradient)
delete material();
- break;
- }
delete m_border;
}
@@ -111,10 +106,10 @@ void QSGDefaultRectangleNode::setColor(const QColor &color)
{
if (color == m_fill_material.color())
return;
+ m_fill_material.setColor(color);
if (m_gradient_stops.isEmpty()) {
Q_ASSERT(m_material_type == TypeFlat);
- m_fill_material.setColor(color);
- setMaterial(&m_fill_material); // Indicate that the material state has changed.
+ markDirty(DirtyMaterial);
}
}
@@ -123,7 +118,8 @@ void QSGDefaultRectangleNode::setPenColor(const QColor &color)
if (color == m_border_material.color())
return;
m_border_material.setColor(color);
- border()->setMaterial(&m_border_material); // Indicate that the material state has changed.
+ if (m_border)
+ m_border->markDirty(DirtyMaterial);
}
void QSGDefaultRectangleNode::setPenWidth(qreal width)
@@ -131,11 +127,10 @@ void QSGDefaultRectangleNode::setPenWidth(qreal width)
if (width == m_pen_width)
return;
m_pen_width = width;
- QSGNode *b = border();
- if (m_pen_width <= 0 && b->parent())
- removeChildNode(b);
- else if (m_pen_width > 0 && !b->parent())
- appendChildNode(b);
+ if (m_pen_width <= 0 && m_border && m_border->parent())
+ removeChildNode(m_border);
+ else if (m_pen_width > 0 && !border()->parent())
+ appendChildNode(m_border);
m_dirty_geometry = true;
}
@@ -154,10 +149,7 @@ void QSGDefaultRectangleNode::setGradientStops(const QGradientStops &stops)
if (stops.isEmpty()) {
// No gradient specified, use flat color.
if (m_material_type != TypeFlat) {
-
delete material();
- delete opaqueMaterial();
- setOpaqueMaterial(0);
setMaterial(&m_fill_material);
m_material_type = TypeFlat;
@@ -253,7 +245,7 @@ void QSGDefaultRectangleNode::updateGeometry()
QSGGeometry *borderGeometry = 0;
if (m_border) {
- borderGeometry = border()->geometry();
+ borderGeometry = m_border->geometry();
Q_ASSERT(borderGeometry->sizeOfVertex() == sizeof(Vertex));
}
diff --git a/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp b/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
index 5426c3b40a..e25b1520a1 100644
--- a/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
+++ b/src/declarative/scenegraph/qsgdistancefieldglyphnode.cpp
@@ -79,7 +79,7 @@ void QSGDistanceFieldGlyphNode::setColor(const QColor &color)
m_color = color;
if (m_material != 0) {
m_material->setColor(color);
- setMaterial(m_material); // Indicate the material state has changed
+ markDirty(DirtyMaterial);
}
}