aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/scenegraph
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-09-01 12:29:17 +0200
committerKim M. Kalland <kim.kalland@nokia.com>2011-09-01 15:25:18 +0200
commit6343aea363d2bd885f55339a9aa2f82fb8ec7bf2 (patch)
tree2d58d9d5140dccc2dc728249f6823b3f06ecf09b /src/declarative/scenegraph
parent1fc32268c840ca9fa3f6882af0c3e27c611c1232 (diff)
Add QSGFlatColorMaterial::compare for better sorting
Change-Id: Ic6229c777a30191ba131b3896984da4f3fecc9d5 Reviewed-on: http://codereview.qt.nokia.com/4066 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Kim M. Kalland <kim.kalland@nokia.com>
Diffstat (limited to 'src/declarative/scenegraph')
-rw-r--r--src/declarative/scenegraph/util/qsgflatcolormaterial.cpp8
-rw-r--r--src/declarative/scenegraph/util/qsgflatcolormaterial.h2
2 files changed, 10 insertions, 0 deletions
diff --git a/src/declarative/scenegraph/util/qsgflatcolormaterial.cpp b/src/declarative/scenegraph/util/qsgflatcolormaterial.cpp
index 06ca28aff5..affdcadd3b 100644
--- a/src/declarative/scenegraph/util/qsgflatcolormaterial.cpp
+++ b/src/declarative/scenegraph/util/qsgflatcolormaterial.cpp
@@ -189,4 +189,12 @@ QSGMaterialShader *QSGFlatColorMaterial::createShader() const
return new FlatColorMaterialShader;
}
+
+int QSGFlatColorMaterial::compare(const QSGMaterial *other) const
+{
+ const QSGFlatColorMaterial *flat = static_cast<const QSGFlatColorMaterial *>(other);
+ return m_color.rgba() - flat->color().rgba();
+
+}
+
QT_END_NAMESPACE
diff --git a/src/declarative/scenegraph/util/qsgflatcolormaterial.h b/src/declarative/scenegraph/util/qsgflatcolormaterial.h
index fb0411089a..f6345b6483 100644
--- a/src/declarative/scenegraph/util/qsgflatcolormaterial.h
+++ b/src/declarative/scenegraph/util/qsgflatcolormaterial.h
@@ -61,6 +61,8 @@ public:
void setColor(const QColor &color);
const QColor &color() const { return m_color; }
+ int compare(const QSGMaterial *other) const;
+
private:
QColor m_color;
};