— Bob Pendleton wrote:
Are you perhaps thinking that the "F"s in the mask represent bytes?
If
so, they do not, they represent nybbles (4 bits) not bytes (8) bits.
Or
was that just a typo?
:oD It was a bit late where I am, fortunately the code I’ve done so far
doesn’t make thie mistake.
Anyway, it is possible to have a pixel laid out with the RGB masks
you
listed. Not common, but possible.
Gack. I’ll have to see if the screen blitting functions would accept
such a format, I’d rather avoid having to check the dest/source masks
every time. If the format is reasonably predictable then the worst I
have to do is use some ifdefs to use the appropriate formatting per
platform rather than having to use runtime detection. I’m mainly trying
to avoid doing anything unnecessary that would slow things down.
— matt hull wrote:
i suggest you use the pixel mask and not hard code it. i tried to
base my application on endianness and it fails when tested on a
graphics driver that uses a different format. sure you could specify
that you want a certain format i think, but then SDL will internally
convert it during run time, which my be a speed hit.
Well, that’s why I’m trying to find this out, I’m trying to move data
around fast while sticking as much as I can to what SDL will expect to
be there, hence I’m bothering to use the masks at all, using the SDL
function analogues (SDL_malloc, SDL_memset, etc) and the SDL functions
for creating and freeing surfaces (which do all the checking for you).
However, when it comes to the masks, I sometimes need to know where the
data as a whole is going to be in a 32 bit integer to be separated and
applied to 1-3 bytes (in order) and I want to do that with the least
number of operations possible so if I can do it without having to check
the exact position of the RGB mask than that’s a few less operations
and one less branch.
As it is, I already know that an Alpha mask will only be accepted in
the first or last byte of the pixel for 32 bit and I’m fairly certain
that the pixel applied as-is to the pixels array (at the correct
position) will work so long as it’s all applied in the order that it’s
read and the masks are the same.
I think I’ll look some more into exactly what it is that SDL itself expects.> On Wed, 2007-10-03 at 00:35 +0100, Paul Duffy wrote:
____________________________________________________________________________________
Don’t let your dream ride pass you by. Make it a reality with Yahoo! Autos.
http://autos.yahoo.com/index.html