Re: [AD] BeOS sound driver

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


Peter Wang <tjaden@xxxxxxxxxx> writes:

> In xwin.c, you have functions like _xwin_private_fast_palette_X_to_Y, 
> where Y is a high- or truecolour depth, and _xwin_private_fast_truecolor_X_to_8.
> 
> When are these ever used?  On exotic hardware where you have 16 bit
> paletted modes and 8 bit truecolour?  I just want to know because
> I'm pulling a lot of stuff from the file :-)

X means Allegro depth and Y is a destination color depth.

In these functions, if color in visual is a combination of red, green,
blue components with all bits of red, green and blue packed together
then this mode is truecolor, otherwise it is treated as palette mode.

For truecolor destination modes pixel value is calculated by shifting
and ORing red, green and blue components, in palette destination modes
pixel value is calculated by lookup table.

It is possible to create truecolor mode from any palette mode with
writtable palette (with at least 8 cells in palette), by setting
palette entries in a special way (for example, palette[RRRGGGBB] =
{ RRR000, GGG000, BB0000 }).  XFree86 X-server supports several visual
types for 8 bit color depth, one of which is truecolor.

I have not encountered 16 bit palette modes, but for completeness I
added partial support for these.  16 bit here means that each pixel is
aligned on sizeof(unsigned short), palette means that pixel value will
be calculated with lookup table in _xwin.cmap (which is 12 bits, so it
may not use all colors supported by hardware).

These functions use four lookup tables for reducing calculations.

_xwin.rmap (_xwin.gmap, _xwin.bmap) may contain lookup table for
converting red (green, blue) from Allegro pixel to red (green, blue)
in destination pixel (they should be ORed together).  Or they may
contain lookup tables for converting 8 bit Allegro pixel to red
(green, blue) component in destination pixel (they should be ORed
together).  Or they may contain lookup tables for converting 8 bit
Allegro pixel to red (green, blue) component and ORed together they
are used as index for _xwin.cmap.

_xwin.cmap may contain lookup table with index calculated from red,
green, blue components of Allegro pixel (4 bits for each component -
RRRRGGGGBBBB).

-- 
Michael Bukin



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