aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsgninepatchnode.cpp
diff options
context:
space:
mode:
authorMartin Jones <martin.jones@nokia.com>2011-05-23 17:09:58 +1000
committerMartin Jones <martin.jones@nokia.com>2011-05-25 11:03:22 +1000
commitdc641323e2f82873908aa55ce3bd4ac46f2112c5 (patch)
tree7d75021e677b90147e79b99d578dd8bb8f21f589 /src/declarative/items/qsgninepatchnode.cpp
parent2d69163a2819f72c5b18c5dd483976a54c797b81 (diff)
Implement "mirror" property for BorderImage.
Change-Id: Iee5b252ce1b0d39da42f553cf2ae782ad14d297f Reviewed-by: Gunnar
Diffstat (limited to 'src/declarative/items/qsgninepatchnode.cpp')
-rw-r--r--src/declarative/items/qsgninepatchnode.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/declarative/items/qsgninepatchnode.cpp b/src/declarative/items/qsgninepatchnode.cpp
index 045dd6c94f..eaa97178f4 100644
--- a/src/declarative/items/qsgninepatchnode.cpp
+++ b/src/declarative/items/qsgninepatchnode.cpp
@@ -48,6 +48,7 @@ QSGNinePatchNode::QSGNinePatchNode()
, m_horizontalTileMode(QSGBorderImage::Stretch)
, m_verticalTileMode(QSGBorderImage::Stretch)
, m_dirtyGeometry(false)
+ , m_mirror(false)
{
setOpaqueMaterial(&m_material);
setMaterial(&m_materialO);
@@ -118,6 +119,15 @@ QSGTexture *QSGNinePatchNode::texture() const
return m_material.texture();
}
+void QSGNinePatchNode::setMirror(bool m)
+{
+ if (m_mirror == m)
+ return;
+ m_mirror = m;
+ m_dirtyGeometry = true;
+}
+
+
void QSGNinePatchNode::update()
{
if (!m_dirtyGeometry)
@@ -210,6 +220,13 @@ void QSGNinePatchNode::update()
fillRow(v, m_targetRect.height() - bottomBorder, yTexChunk2, xChunkCount, xChunkSize);
fillRow(v, m_targetRect.height(), 1, xChunkCount, xChunkSize);
+ if (m_mirror) {
+ v = m_geometry.vertexDataAsTexturedPoint2D();
+ for (int i=0; i<m_geometry.vertexCount(); ++i) {
+ v->x = m_targetRect.width() - v->x;
+ ++v;
+ }
+ }
// v = m_geometry.vertexDataAsTexturedPoint2D();
// for (int i=0; i<m_geometry.vertexCount(); ++i) {