summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2007-06-03 16:52:06 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2007-06-03 16:52:06 +0000
commit6276c1ff96e449e73e84977110334cd8957c31b6 (patch)
tree66988ea8a28fd9de6c2f31d20a38a4efafee9a99 /src/resources/image.cpp
parent9b53cd51fdf193c8748909479ec6c356fa7a1731 (diff)
downloadmana-6276c1ff96e449e73e84977110334cd8957c31b6.tar.gz
mana-6276c1ff96e449e73e84977110334cd8957c31b6.tar.bz2
mana-6276c1ff96e449e73e84977110334cd8957c31b6.tar.xz
mana-6276c1ff96e449e73e84977110334cd8957c31b6.zip
Fixed image loading in software mode to not check for alpha layer with images
aren't 32-bit and removed drawImageTransparent from Graphics class, should be set on image.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp25
1 files changed, 14 insertions, 11 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index 393c443c..31e38d6d 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -187,19 +187,22 @@ Image* Image::load(void *buffer, unsigned int bufferSize,
bool hasAlpha = false;
- // Figure out whether the image uses its alpha layer
- for (int i = 0; i < tmpImage->w * tmpImage->h; ++i)
+ if (tmpImage->format->BitsPerPixel == 32)
{
- Uint8 r, g, b, a;
- SDL_GetRGBA(
- ((char*) tmpImage->pixels)[i * tmpImage->format->BitsPerPixel],
- tmpImage->format,
- &r, &g, &b, &a);
-
- if (a != 255)
+ // Figure out whether the image uses its alpha layer
+ for (int i = 0; i < tmpImage->w * tmpImage->h; ++i)
{
- hasAlpha = true;
- break;
+ Uint8 r, g, b, a;
+ SDL_GetRGBA(
+ ((Uint32*) tmpImage->pixels)[i],
+ tmpImage->format,
+ &r, &g, &b, &a);
+
+ if (a != 255)
+ {
+ hasAlpha = true;
+ break;
+ }
}
}