summaryrefslogtreecommitdiff
path: root/src/resources/image.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-18 14:34:32 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2005-02-18 14:34:32 +0000
commitb7d7883ff0f662836b69e132759c78142d1488c4 (patch)
treeab157ae850d682779c9b668b0321f9bc9cc68af5 /src/resources/image.cpp
parent3ac7f63f4ccc7c6dcd6c1b29b4da958c0ef863a6 (diff)
downloadmana-client-b7d7883ff0f662836b69e132759c78142d1488c4.tar.gz
mana-client-b7d7883ff0f662836b69e132759c78142d1488c4.tar.bz2
mana-client-b7d7883ff0f662836b69e132759c78142d1488c4.tar.xz
mana-client-b7d7883ff0f662836b69e132759c78142d1488c4.zip
Improve window borders and speed up alpha property by not setting alpha each
time the images are drawn.
Diffstat (limited to 'src/resources/image.cpp')
-rw-r--r--src/resources/image.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/resources/image.cpp b/src/resources/image.cpp
index efd126b1..2ec867ec 100644
--- a/src/resources/image.cpp
+++ b/src/resources/image.cpp
@@ -252,9 +252,6 @@ bool Image::draw(SDL_Surface *screen, int srcX, int srcY, int dstX, int dstY,
// Check that preconditions for blitting are met.
if (screen == NULL || image == NULL) return false;
- // Set the alpha value this image is drawn at
- SDL_SetAlpha(image, SDL_SRCALPHA, (int)(255 * alpha));
-
SDL_Rect dstRect;
SDL_Rect srcRect;
dstRect.x = dstX; dstRect.y = dstY;
@@ -330,6 +327,11 @@ void Image::drawPattern(SDL_Surface *screen, int x, int y, int w, int h)
void Image::setAlpha(float alpha)
{
this->alpha = alpha;
+
+#ifndef USE_OPENGL
+ // Set the alpha value this image is drawn at
+ SDL_SetAlpha(image, SDL_SRCALPHA | SDL_RLEACCEL, (int)(255 * alpha));
+#endif
}
float Image::getAlpha()
@@ -391,9 +393,6 @@ bool SubImage::draw(SDL_Surface *screen, int srcX, int srcY,
// Check that preconditions for blitting are met.
if (screen == NULL || image == NULL) return false;
- // Set the alpha value this image is drawn at
- SDL_SetAlpha(image, SDL_SRCALPHA, (int)(255 * alpha));
-
SDL_Rect dstRect;
SDL_Rect srcRect;
dstRect.x = dstX; dstRect.y = dstY;