From 9ff91fa38d4f6944fb6c14ecc935365231dd4432 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Mon, 15 Apr 2013 20:58:38 +0300 Subject: improve imageset class. --- src/resources/imageset.cpp | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) (limited to 'src/resources') 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::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 -- cgit v1.2.3-70-g09d2