Re: [AD] SF.net SVN: alleg:[12120] allegro/branches/4.9/addons/iio/png.c |
[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]
Evert Glebbeek wrote:
On 24 Apr 2009, at 18:33 , elias@xxxxxxxxxx wrote:Log Message: -----------Replaced al_map_rgba/al_put_pixel with direct memory access in png.c, faster and easier to read.[snip]- al_put_pixel(i, y, c); + *(rgba++) = pal[pix].r; + *(rgba++) = pal[pix].g; + *(rgba++) = pal[pix].b;This doesn't look like it's endianesse safe (as described in the lock_bitmap example). Haven't tested it; I can test on my iBook later.
I wouldn't be sure in the 24-bit case, but for the 32-bit case you're right. Probably. Maybe we should add one additional endian-safe bitmap formats, like OpenGL? Something like:
ALLEGRO_PIXEL_FORMAT_RGBA_8888_LEAnd it would make sure that in memory, the pixels are laid out as first red, then green, then blue, then alpha? It certainly would be less error-prone to use when doing lots of direct-access pixel manipulation. And it also would emphasize the endianness of (most of) the other formants.
The real problem I tried to solve was that in my game I can't allow al_set_target_bitmap to be called on my bitmaps else the performance drops horrendously (because 1000ds of FBOs for tiny bitmaps somehow kill the NVidia drivers) - but Trent's most recent commit gives me an idea how to fix that in a different way...
-- Elias Pschernig <elias@xxxxxxxxxx>
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |