[Scummvm-devel] Mac OS X Problems in gsoc2009-16bit Branch

Max Horn max at quendi.de
Mon Jul 13 17:30:04 CEST 2009


Am 10.07.2009 um 14:42 schrieb Willem Jan Palenstijn:

> On Fri, Jul 10, 2009 at 08:23:29AM -0400, Matthew Hoops wrote:
>> Hi Jody, all,
>>
>> Currently in the gsoc2009-16bit branch, the "best" PixelFormat is
>> chosen by creating a PixelFormat using parameters taken from
>> _hwscreen->format. However, on Mac OS X (RGB565), I'm getting
>> _hwscreen->format->Aloss and Ashift to be equal to 0. Since the
>> PixelFormat the screen uses has the same *loss and *shift values as
>> _hwscreen, the aLoss remains 0 which results in the alpha bleeding
>> into the blue (bShift == 0) and turns whatever I copy to the screen
>> very blueish. The easiest way to fix the problem for me was set aLoss
>> to be equal to 8. However, this probably won't work for all systems.
>>
>> I had thought of something like this:
>>
>> if (format.bShift == format.aShift && format.aLoss == 0)
>>    format.aLoss = 8;
>
> An alternative might be to check if SDL_PixelFormat::Amask is 0 when
> converting from SDL_PixelFormat to PixelFormat, and if so, set aLoss  
> to 8.

Indeed, that needs to be done in any case. In addition, we should add  
a "PixelFormat::validate()" method which performs some extra checks to  
ensure that a given PixelFormat makes sense -- e.g. verify that the  
various components do not overlap (which is easy to do -- just compute  
the bitmasks for each, and then AND them pairwise, if the result is  
not 0 you overlap).

This validate() method then can be checked in assert() calls in  
strategic place

Bye,
Max




More information about the Scummvm-devel mailing list