summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index ee2736d4..51899d3f 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -282,14 +282,16 @@ Image *Image::getSubImage(int x, int y, int width, int height)
void Image::setAlpha(float a)
{
- mAlpha = a;
-
- if (!mImage) {
+ if (mAlpha == a) {
return;
}
- // Set the alpha value this image is drawn at
- SDL_SetAlpha(mImage, SDL_SRCALPHA | SDL_RLEACCEL, (int)(255 * mAlpha));
+ mAlpha = a;
+
+ if (mImage) {
+ // Set the alpha value this image is drawn at
+ SDL_SetAlpha(mImage, SDL_SRCALPHA | SDL_RLEACCEL, (int)(255 * mAlpha));
+ }
}
float Image::getAlpha()