From 182826c0a1c53534bc83513b7e13d957611730a9 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Thu, 27 Sep 2012 06:49:57 +0200 Subject: compatibility with older SDL_gfx versions --- layer_video.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'layer_video.cpp') diff --git a/layer_video.cpp b/layer_video.cpp index 192bb73..f59bc8d 100644 --- a/layer_video.cpp +++ b/layer_video.cpp @@ -4,6 +4,9 @@ #include #include #include + +/* HACK: older SDL_gfx version defines GFX_ALPHA_ADJUST in the header */ +#define GFX_ALPHA_ADJUST LAYER_VIDEO_GFX_ALPHA_ADJUST #include #include @@ -241,10 +244,14 @@ LayerVideo::frame(SDL_Surface *target) SMOOTHING_ON); SDL_UnlockMutex(mutex); - if (surf_scaled->format->Amask) - SDL_gfxMultiplyAlpha(surf_scaled, alpha); - else if (alpha < SDL_ALPHA_OPAQUE) - SDL_SetAlpha(surf_scaled, SDL_SRCALPHA | SDL_RLEACCEL, alpha); + if (alpha < SDL_ALPHA_OPAQUE) { + if (surf_scaled->format->Amask) + SDL_gfxSetAlpha(surf_scaled, alpha); + else + SDL_SetAlpha(surf_scaled, + SDL_SRCALPHA | SDL_RLEACCEL, + alpha); + } SDL_BlitSurface(surf_scaled, NULL, target, &geov); SDL_FreeSurface(surf_scaled); -- cgit v1.2.3