summaryrefslogtreecommitdiff
path: root/src/resources
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-11-06 00:01:13 +0300
committerAndrei Karas <akaras@inbox.ru>2013-11-06 00:01:13 +0300
commitaee026ac48406044306cf89eb74f072606b17a0d (patch)
treea44d58161d9f56169719dedd10e0b81fcdf1d046 /src/resources
parent102a7d4fe6e8874ad7dcdfe085a22b51de22999b (diff)
downloadmv-aee026ac48406044306cf89eb74f072606b17a0d.tar.gz
mv-aee026ac48406044306cf89eb74f072606b17a0d.tar.bz2
mv-aee026ac48406044306cf89eb74f072606b17a0d.tar.xz
mv-aee026ac48406044306cf89eb74f072606b17a0d.zip
improve images loading speed in software mode with SDL1.2
Diffstat (limited to 'src/resources')
-rw-r--r--src/resources/sdlimagehelper.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/resources/sdlimagehelper.cpp b/src/resources/sdlimagehelper.cpp
index fa63517fc..f39ecf4cd 100644
--- a/src/resources/sdlimagehelper.cpp
+++ b/src/resources/sdlimagehelper.cpp
@@ -213,12 +213,15 @@ Image *SDLImageHelper::_SDLload(SDL_Surface *tmpImage) const
const SDL_PixelFormat *const fmt = tmpImage->format;
if (fmt->Amask)
{
+ const uint32_t amask = fmt->Amask;
+ const uint8_t ashift = fmt->Ashift;
+ const uint8_t aloss = fmt->Aloss;
+ const uint32_t *pixels = static_cast<uint32_t*>(tmpImage->pixels);
for (int i = 0; i < sz; ++ i)
{
- const unsigned v = ((static_cast<uint32_t*>(
- tmpImage->pixels))[i] & fmt->Amask) >> fmt->Ashift;
- const uint8_t a = static_cast<const uint8_t>((v << fmt->Aloss)
- + (v >> (8 - (fmt->Aloss << 1))));
+ const unsigned v = (pixels[i] & amask) >> ashift;
+ const uint8_t a = static_cast<const uint8_t>((v << aloss)
+ + (v >> (8 - (aloss << 1))));
if (a != 255)
hasAlpha = true;