RE: [AD] Extra byte in 24 bit bitmaps

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


> I need to read pixels in a 24 bit memory bitmap. It is then much faster to
> read 32 bits at a time and shift out the components than to read one byte
> three times (according to a test it's somewhat more than twice as fast on
> my P133). However, this will read one byte outside the allocated memory on
> the last pixel in the bitmap. Would it be possible to allocate one extra
> byte at the end of 24 bit bitmaps for this purpose? I attach a patch that
> does this. A better solution would of course be if someone could
> prove that
> it is harmless to read an extra unallocated byte on all platforms...
Harmless .... Hmmm :)
Anyway, you'd better allocate one byte at the end of each *line* so it
is more likely to work with all kinds of BITMAPs (this obviously involves
a little line pointer switching, and maybe get sure no other function
relies on bitmap->w==line[n]-line[n-1])
Just wanted to point this out...
Going back to silent mode ;)

--
Lyrian



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