diff options
author | Andrei Karas <akaras@inbox.ru> | 2012-07-23 00:10:43 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2012-07-23 00:10:43 +0300 |
commit | d97189f055798b5b2051c1c5770a3def62747461 (patch) | |
tree | d66a891dba33d2ce1c882e0de7d6145bb2e0326b /src/resources | |
parent | 25dce1399e40f24809842303d48ef090439de1e5 (diff) | |
download | ManaVerse-d97189f055798b5b2051c1c5770a3def62747461.tar.gz ManaVerse-d97189f055798b5b2051c1c5770a3def62747461.tar.bz2 ManaVerse-d97189f055798b5b2051c1c5770a3def62747461.tar.xz ManaVerse-d97189f055798b5b2051c1c5770a3def62747461.zip |
Improve perfomance in some object constructors.
Diffstat (limited to 'src/resources')
-rw-r--r-- | src/resources/image.cpp | 12 | ||||
-rw-r--r-- | src/resources/imageset.cpp | 4 | ||||
-rw-r--r-- | src/resources/imageset.h | 2 | ||||
-rw-r--r-- | src/resources/wallpaper.cpp | 3 |
4 files changed, 11 insertions, 10 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp index 4b5fa4f40..7cfb11822 100644 --- a/src/resources/image.cpp +++ b/src/resources/image.cpp @@ -51,15 +51,15 @@ Image::Image(SDL_Surface *image, bool hasAlphaChannel0, uint8_t *alphaChannel): mHasAlphaChannel(hasAlphaChannel0), mSDLSurface(image), mAlphaChannel(alphaChannel), + mUseAlphaCache(SDLImageHelper::mEnableAlphaCache), mIsAlphaVisible(hasAlphaChannel0), - mIsAlphaCalculated(false) -{ #ifdef USE_OPENGL - mGLImage = 0; + mIsAlphaCalculated(false), + mGLImage(0) +#else + mIsAlphaCalculated(false) #endif - - mUseAlphaCache = SDLImageHelper::mEnableAlphaCache; - +{ mBounds.x = 0; mBounds.y = 0; diff --git a/src/resources/imageset.cpp b/src/resources/imageset.cpp index 9e3513e91..4b63d0883 100644 --- a/src/resources/imageset.cpp +++ b/src/resources/imageset.cpp @@ -32,6 +32,8 @@ ImageSet::ImageSet(Image *img, int width, int height, int margin, int spacing) : + mWidth(width), + mHeight(height), mOffsetX(0), mOffsetY(0) { @@ -47,8 +49,6 @@ ImageSet::ImageSet(Image *img, int width, int height, } } } - mWidth = width; - mHeight = height; } ImageSet::~ImageSet() diff --git a/src/resources/imageset.h b/src/resources/imageset.h index edfc4b123..aef4bf694 100644 --- a/src/resources/imageset.h +++ b/src/resources/imageset.h @@ -78,8 +78,8 @@ class ImageSet : public Resource private: std::vector<Image*> mImages; - int mHeight; /**< Height of the images in the image set. */ int mWidth; /**< Width of the images in the image set. */ + int mHeight; /**< Height of the images in the image set. */ int mOffsetX; int mOffsetY; }; diff --git a/src/resources/wallpaper.cpp b/src/resources/wallpaper.cpp index 2f5fd9dca..316419627 100644 --- a/src/resources/wallpaper.cpp +++ b/src/resources/wallpaper.cpp @@ -33,6 +33,7 @@ #include <algorithm> #include <cstring> #include <time.h> +#include <iostream> #include "debug.h" @@ -84,7 +85,7 @@ bool wallpaperCompare(WallpaperData a, WallpaperData b) return (aa > ab || (aa == ab && a.width > b.width)); } -#include <iostream> + void Wallpaper::loadWallpapers() { wallpaperData.clear(); |