Fixed bug 1346 SDL-1.2
authorSam Lantinga <slouken@libsdl.org>
Thu, 29 Dec 2011 04:57:42 -0500
branchSDL-1.2
changeset 61112280c0954104
parent 6110 676a54593bc4
child 6112 60dfd25009b0
Fixed bug 1346

alarantalara@gmail.com 2011-12-19 20:43:13 PST

On little endian systems using the Quartz code, an unusual set of RBGA masks is
used when using the windowed video mode.
This set is not taken into account in SDL_DisplayFormatAlpha and so it converts
the supplied surface to a format that does not match the video surface,
preventing fast blitting.

This was observed in recent builds of Battle for Wesnoth when SDL was updated
to cover the problem when switching to full screen in Lion
(https://gna.org/bugs/?18319).

You can observe the performance issue if you download Wesnoth 1.9.13 for OS X
at
http://sourceforge.net/projects/wesnoth/files/wesnoth/wesnoth-1.9.13/Wesnoth_1.9.13.dmg/download
and replace the included SDL library with any build of SDL 1.2.14 or later. (I
have already patched the included version, so the problem is not observable
without replacement.)

A patch resolving the issue is attached.
src/video/SDL_video.c
     1.1 --- a/src/video/SDL_video.c	Thu Dec 29 04:29:53 2011 -0500
     1.2 +++ b/src/video/SDL_video.c	Thu Dec 29 04:57:42 2011 -0500
     1.3 @@ -979,6 +979,11 @@
     1.4  		if ( (vf->Rmask == 0xff) && (vf->Bmask == 0xff0000) ) {
     1.5  			rmask = 0xff;
     1.6  			bmask = 0xff0000;
     1.7 +		} else if ( vf->Rmask == 0xFF00 && (vf->Bmask = 0xFF000000) ) {
     1.8 +			amask = 0x000000FF;
     1.9 +			rmask = 0x0000FF00;
    1.10 +			gmask = 0x00FF0000;
    1.11 +			bmask = 0xFF000000;
    1.12  		}
    1.13  		break;
    1.14