diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2012-05-29 20:44:14 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-06-05 03:22:18 +0200 |
commit | 751c1ca09305a15acc37cb28cb4687e1bb32e1d2 (patch) | |
tree | 30be75374c86a84742ed321d110a25d4b5b71516 | |
parent | 5e6d1afb124c364d6c52aaed376930858aef05ac (diff) |
Use the texture coordinates provided by QSGTexture
Change-Id: I24e377ba69b2108f3bc4f6aca3ed910fbbf77caf
Reviewed-by: Glenn Watson <glenn.watson@nokia.com>
Reviewed-by: Yunqiao Yin <charles.yin@nokia.com>
-rw-r--r-- | src/quick/items/qquickanimatedsprite.cpp | 17 | ||||
-rw-r--r-- | src/quick/items/qquickspritesequence.cpp | 17 |
2 files changed, 18 insertions, 16 deletions
diff --git a/src/quick/items/qquickanimatedsprite.cpp b/src/quick/items/qquickanimatedsprite.cpp index 0e370202cf..724ae75d6b 100644 --- a/src/quick/items/qquickanimatedsprite.cpp +++ b/src/quick/items/qquickanimatedsprite.cpp @@ -526,18 +526,19 @@ QSGGeometryNode* QQuickAnimatedSprite::buildNode() AnimatedSpriteVertices *p = (AnimatedSpriteVertices *) g->vertexData(); - p->v1.tx = 0; - p->v1.ty = 0; + QRectF texRect = m_material->texture->normalizedTextureSubRect(); - p->v2.tx = 1.0; - p->v2.ty = 0; + p->v1.tx = texRect.topLeft().x(); + p->v1.ty = texRect.topLeft().y(); - p->v3.tx = 0; - p->v3.ty = 1.0; + p->v2.tx = texRect.topRight().x(); + p->v2.ty = texRect.topRight().y(); - p->v4.tx = 1.0; - p->v4.ty = 1.0; + p->v3.tx = texRect.bottomLeft().x(); + p->v3.ty = texRect.bottomLeft().y(); + p->v4.tx = texRect.bottomRight().x(); + p->v4.ty = texRect.bottomRight().y(); quint16 *indices = g->indexDataAsUShort(); indices[0] = 0; diff --git a/src/quick/items/qquickspritesequence.cpp b/src/quick/items/qquickspritesequence.cpp index 1112cf9301..69daab7e75 100644 --- a/src/quick/items/qquickspritesequence.cpp +++ b/src/quick/items/qquickspritesequence.cpp @@ -385,18 +385,19 @@ QSGGeometryNode* QQuickSpriteSequence::buildNode() g->setDrawingMode(GL_TRIANGLES); SpriteVertices *p = (SpriteVertices *) g->vertexData(); + QRectF texRect = m_material->texture->normalizedTextureSubRect(); - p->v1.tx = 0; - p->v1.ty = 0; + p->v1.tx = texRect.topLeft().x(); + p->v1.ty = texRect.topLeft().y(); - p->v2.tx = 1.0; - p->v2.ty = 0; + p->v2.tx = texRect.topRight().x(); + p->v2.ty = texRect.topRight().y(); - p->v3.tx = 0; - p->v3.ty = 1.0; + p->v3.tx = texRect.bottomLeft().x(); + p->v3.ty = texRect.bottomLeft().y(); - p->v4.tx = 1.0; - p->v4.ty = 1.0; + p->v4.tx = texRect.bottomRight().x(); + p->v4.ty = texRect.bottomRight().y(); quint16 *indices = g->indexDataAsUShort(); indices[0] = 0; |