[AD] getpixel conflict with alpha blended sprites

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Having just added some alpha blended sprites to my application, I've come
across a problem.

The call to getpixel returns -1 if the co-ordinates are out of range (which
is how it should be, and how I'm using it).

However, if the bitmap has an alpha channel and happens to be fully opaque
and white (ie 32-bit colour value 0xFFFFFFFF) then it looks like -1 to the
code and aborts my function, thinking it's out of the bitmap's area.

So what I'm asking is, would it be ok to modify _linear_getpixel32 in
igfx32.s to automatically AND its return value with 0x00FFFFFF, to
effectively strip out the alpha channel? Or is there a better way around
this?

I'd rather not end up doing it manually with a switch statement for each
colour depth and then _getpixelXX, because that would be slower than using
the vtable as at present.

Cheers,
Chris





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/