diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-04-15 20:58:38 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-04-15 20:58:38 +0300 |
commit | 9ff91fa38d4f6944fb6c14ecc935365231dd4432 (patch) | |
tree | 599c3446211089f0e71af85536908b828fea8faf /src | |
parent | 7b26645c1b28b212c011f98a5420c0989a7f0adc (diff) | |
download | manaverse-9ff91fa38d4f6944fb6c14ecc935365231dd4432.tar.gz manaverse-9ff91fa38d4f6944fb6c14ecc935365231dd4432.tar.bz2 manaverse-9ff91fa38d4f6944fb6c14ecc935365231dd4432.tar.xz manaverse-9ff91fa38d4f6944fb6c14ecc935365231dd4432.zip |
improve imageset class.
Diffstat (limited to 'src')
-rw-r--r-- | src/resources/imageset.cpp | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 3eead85f2..a8c9af5ef 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -40,11 +40,13 @@ ImageSet::ImageSet(Image *const img, const int width, const int height, { if (img) { + const int hAdd = height + spacing; + const int wAdd = width + spacing; for (int y = margin; y + height <= img->getHeight() - margin; - y += height + spacing) + y += hAdd) { for (int x = margin; x + width <= img->getWidth() - margin; - x += width + spacing) + x += wAdd) { mImages.push_back(img->getSubImage(x, y, width, height)); } @@ -55,16 +57,6 @@ ImageSet::ImageSet(Image *const img, const int width, const int height, ImageSet::~ImageSet() { delete_all(mImages); -/* - for (std::vector<Image*>::iterator it = mImages.begin(), - it_end = mImages.end(); it != it_end; ++ it) - { - Image *image = *it; - if (image) - image->decRef(); - } - mImages.clear(); -*/ } Image* ImageSet::get(const size_type i) const |