Allegro.cc - Online Community

Allegro.cc Forums » Allegro Development » [5.1] al_put_pixel and bitmap pitch

This thread is locked; no one can reply to it. rss feed Print
[5.1] al_put_pixel and bitmap pitch
pmprog
Member #11,579
January 2010
avatar

I'm writing a game using a build of Allegro 5.1.5/6 (One for my desktop, the other for the Pandora handheld).

I've written a software "shader" system to get around some of the Pandora build's setup. All it basically does is lock the surface in a fixed format, I loop through each pixel and unlock it.

My loop basically used the pixels void* and editted memory, which ran quick and worked fine on the desktop. However, it segfaulted the Pandora; This is due to that bitmaps are loaded upside down on the Pandora (negative pitch).

So I changed my code to use al_put_pixel, and whilst it worked (well, there was some dodgy refreshing problem, but I don't think that's related), it made the desktop version amazingly slow.

I can't find any functions in the API to tell me the pitch of the locked surfaces. Am I missing something, or isn't there one? I might just hardcode, but thought I'd check if there was a proper solution first.

Thanks

Max Savenkov
Member #4,613
May 2004
avatar

ALLEGRO_LOCKED_REGION returned by al_lock_bitmap has pitch.

pmprog
Member #11,579
January 2010
avatar

Thank you! I didn't think to look there, but makes sense

Cheers

Go to: