summaryrefslogtreecommitdiff
path: root/src/compoundsprite.h
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-01 21:05:48 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-02 18:38:14 +0300
commitaac238cec9cab9efe7319d8397b95e7a77bdb5cd (patch)
tree3298f3b604d4d45cc6d04f871f6a1abb29cdd554 /src/compoundsprite.h
parent4e7096f15eba73e6ea28066df6ab389aab3f052c (diff)
downloadManaVerse-aac238cec9cab9efe7319d8397b95e7a77bdb5cd.tar.gz
ManaVerse-aac238cec9cab9efe7319d8397b95e7a77bdb5cd.tar.bz2
ManaVerse-aac238cec9cab9efe7319d8397b95e7a77bdb5cd.tar.xz
ManaVerse-aac238cec9cab9efe7319d8397b95e7a77bdb5cd.zip
Fix perfomance issue with caching complex sprites.
Diffstat (limited to 'src/compoundsprite.h')
-rw-r--r--src/compoundsprite.h27
1 files changed, 26 insertions, 1 deletions
diff --git a/src/compoundsprite.h b/src/compoundsprite.h
index 834ccd835..0841bcfb8 100644
--- a/src/compoundsprite.h
+++ b/src/compoundsprite.h
@@ -24,10 +24,26 @@
#include "sprite.h"
+#include <list>
#include <vector>
class Image;
+typedef std::list <void*> VectorPointers;
+
+class CompoundItem
+{
+ public:
+ CompoundItem();
+
+ ~CompoundItem();
+
+// float alpha;
+ VectorPointers data;
+ Image *image;
+ Image *alphaImage;
+};
+
class CompoundSprite : public Sprite, private std::vector<Sprite*>
{
public:
@@ -101,9 +117,18 @@ public:
virtual void setAlpha(float alpha);
private:
-
void redraw() const;
+ void updateImages() const;
+
+ bool updateFromCache() const;
+
+ void initCurrentCacheItem() const;
+
+ typedef std::list<CompoundItem*> ImagesCache;
+ mutable ImagesCache imagesCache;
+ mutable CompoundItem *mCacheItem;
+
mutable Image *mImage;
mutable Image *mAlphaImage;