aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/declarative/imageelements/content/Bear0.pngbin15163 -> 0 bytes
-rw-r--r--examples/declarative/imageelements/content/Bear1.pngbin99378 -> 0 bytes
-rw-r--r--examples/declarative/imageelements/content/Bear2.pngbin80759 -> 0 bytes
-rw-r--r--examples/declarative/imageelements/content/Bear3.pngbin21122 -> 0 bytes
-rw-r--r--examples/declarative/imageelements/content/BearB.pngbin18667 -> 0 bytes
-rw-r--r--examples/declarative/imageelements/content/BearSheet.pngbin0 -> 406337 bytes
-rw-r--r--examples/declarative/imageelements/spriteimage.qml17
-rw-r--r--src/quick/items/qquicksprite.cpp1
-rw-r--r--src/quick/items/qquicksprite_p.h1
-rw-r--r--src/quick/items/qquickspriteengine.cpp5
10 files changed, 17 insertions, 7 deletions
diff --git a/examples/declarative/imageelements/content/Bear0.png b/examples/declarative/imageelements/content/Bear0.png
deleted file mode 100644
index 64a02cec8e..0000000000
--- a/examples/declarative/imageelements/content/Bear0.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/imageelements/content/Bear1.png b/examples/declarative/imageelements/content/Bear1.png
deleted file mode 100644
index 3b88f3b32e..0000000000
--- a/examples/declarative/imageelements/content/Bear1.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/imageelements/content/Bear2.png b/examples/declarative/imageelements/content/Bear2.png
deleted file mode 100644
index 337b636070..0000000000
--- a/examples/declarative/imageelements/content/Bear2.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/imageelements/content/Bear3.png b/examples/declarative/imageelements/content/Bear3.png
deleted file mode 100644
index f0e68590f4..0000000000
--- a/examples/declarative/imageelements/content/Bear3.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/imageelements/content/BearB.png b/examples/declarative/imageelements/content/BearB.png
deleted file mode 100644
index c9a84ae1d4..0000000000
--- a/examples/declarative/imageelements/content/BearB.png
+++ /dev/null
Binary files differ
diff --git a/examples/declarative/imageelements/content/BearSheet.png b/examples/declarative/imageelements/content/BearSheet.png
new file mode 100644
index 0000000000..a084bf0f1e
--- /dev/null
+++ b/examples/declarative/imageelements/content/BearSheet.png
Binary files differ
diff --git a/examples/declarative/imageelements/spriteimage.qml b/examples/declarative/imageelements/spriteimage.qml
index bace7ef7e2..d64589aea9 100644
--- a/examples/declarative/imageelements/spriteimage.qml
+++ b/examples/declarative/imageelements/spriteimage.qml
@@ -62,7 +62,7 @@ Item {
goalSprite: ""
Sprite{
name: "still"
- source: "content/Bear0.png"
+ source: "content/BearSheet.png"
frames: 1
frameWidth: 256
frameHeight: 256
@@ -71,8 +71,10 @@ Item {
}
Sprite{
name: "blink"
- source: "content/BearB.png"
+ source: "content/BearSheet.png"
frames: 3
+ frameX: 256
+ frameY: 1536
frameWidth: 256
frameHeight: 256
frameDuration: 100
@@ -80,8 +82,10 @@ Item {
}
Sprite{
name: "floating"
- source: "content/Bear1.png"
+ source: "content/BearSheet.png"
frames: 9
+ frameX: 0
+ frameY: 0
frameWidth: 256
frameHeight: 256
frameDuration: 160
@@ -89,8 +93,10 @@ Item {
}
Sprite{
name: "flailing"
- source: "content/Bear2.png"
+ source: "content/BearSheet.png"
frames: 8
+ frameX: 0
+ frameY: 768
frameWidth: 256
frameHeight: 256
frameDuration: 160
@@ -98,8 +104,9 @@ Item {
}
Sprite{
name: "falling"
- source: "content/Bear3.png"
+ source: "content/BearSheet.png"
frames: 5
+ frameY: 1280
frameWidth: 256
frameHeight: 256
frameDuration: 160
diff --git a/src/quick/items/qquicksprite.cpp b/src/quick/items/qquicksprite.cpp
index 8b5369d3f6..fc7f0894c4 100644
--- a/src/quick/items/qquicksprite.cpp
+++ b/src/quick/items/qquicksprite.cpp
@@ -191,6 +191,7 @@ QQuickSprite::QQuickSprite(QObject *parent)
, m_generatedCount(0)
, m_framesPerRow(0)
, m_rowY(0)
+ , m_rowStartX(0)
, m_reverse(false)
, m_frameHeight(0)
, m_frameWidth(0)
diff --git a/src/quick/items/qquicksprite_p.h b/src/quick/items/qquicksprite_p.h
index 6aab74f8dd..2ec2380ea8 100644
--- a/src/quick/items/qquicksprite_p.h
+++ b/src/quick/items/qquicksprite_p.h
@@ -280,6 +280,7 @@ private:
int m_generatedCount;
int m_framesPerRow;
int m_rowY;
+ int m_rowStartX;
QUrl m_source;
bool m_reverse;
diff --git a/src/quick/items/qquickspriteengine.cpp b/src/quick/items/qquickspriteengine.cpp
index 470aa6d160..42904b2fb5 100644
--- a/src/quick/items/qquickspriteengine.cpp
+++ b/src/quick/items/qquickspriteengine.cpp
@@ -322,13 +322,14 @@ QImage QQuickSpriteEngine::assembledImage()
if (img.height() == frameHeight && img.width() < maxSize){//Simple case
p.drawImage(0,y,img);
state->m_rowY = y;
+ state->m_rowStartX = state->m_frameX;//In case it was offset, but we took the simple route of not chopping out the other bits
y += frameHeight;
}else{//Chopping up image case
state->m_framesPerRow = image.width()/frameWidth;
state->m_rowY = y;
int x = 0;
- int curX = 0;
- int curY = 0;
+ int curX = state->m_frameX;
+ int curY = state->m_frameY;
int framesLeft = state->frames();
while (framesLeft > 0){
if (image.width() - x + curX <= img.width()){//finish a row in image (dest)