[Scummvm-devel] setMouseCursor() keycolor

Johannes Schickel lordhoto at scummvm.org
Thu Jan 7 00:07:05 CET 2010


Marcus Comstedt wrote:
> Johannes Schickel <lordhoto at scummvm.org> writes:
>
>   
>> I guess (albeit undocumented, or I missed something...) the backends
>> should do clipping to the parameter, that it fits the setup bit
>> depth.
>>     
>
> Why should they?  It makes no sense.
>   

Probably the default value was changed to 0xFFFFFFFF, so that an engine 
author has not as many nasty surprises as with a default value of 255 
(which would be always a different color in RGB bit depths). So to work 
around the problem with being too big for the classic indexed mode it 
should just be handled by the backend. I'm not arguing that this makes 
any sense, but it's at least what probably is the rationale behind this. 
In any case you might have to agree that it's usual that we tend to make 
things for engine authors easier/not as surprising than for people 
writing the OSystem, since there are many less people working on OSystem 
than on engines... :-) (Whether such surprises for OSystem authors are 
good or bad, is not the point here).

>> Actually I'm in favor in removing the default parameter and changing
>> the documentation, so it is known that the value shouldn't exceed the
>> maximum value for the set up bit depth.
>>     
>
> Except you could use a value exceeding the maximum value for the
> bit depth to mean "no transparency", since there will be no pixels
> with that value.  That's how it works now in the DC backend.
>   

Well we need a big enough type to allow the function to be used for 
generic bit depths. In the end when the user violates that it it should 
be undefined what is happening (like your backend does now ;-). If we 
really need cursor without a transparency color, we should use some bool 
to indicate that. Now thinking of any cursor which doesn't have any 
transparency looks weird.... thus just stating that the color should fit 
in the format set up is sane and non-surprising. We might just make the 
SDL backend assert, in case it's violated to enforce this on the usual 
development platforms.

// Johannes




More information about the Scummvm-devel mailing list