Re: [AD] al_convert_bitmap

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


On Tue, Jun 7, 2011 at 8:16 AM, allefant <info@xxxxxxxxxx> wrote:
> On Mon, Jun 6, 2011 at 5:50 PM, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
>> Do you still have to call al_convert_all_video_bitmaps() to upload
>> that video bitmap?
>
> Yes and no, see your second scenario below. However, curiously enough, if
> you first create the new display and then destroy the old one, it seems the
> bitmaps are (sometimes?) transferred already and stay display bitmaps.
>
There's another scenario:

1) Create large video bitmap (e.g., 5000x5000)
Allegro implicitly creates it as a memory bitmap because no display exists.
2) Create a display
3) Convert bitmaps
The memory bitmap cannot be converted because it is too big, but it
remains valid.

However, in this situation:

1) Create display
2) Create large video bitmap
Allegro returns NULL because the bitmap is too big

So now you have different behaviors. I think it should be made
consistent. Either:

a) the video bitmap flag (if present) is always a requirement: video
bitmaps fail if no display is available

b) the video bitmap flag (if present) is always a hint: memory bitmaps
are created if no display is available or the bitmap is too large

As-is, I think it is confusing. I would prefer option B... the flag is
only a hint. Generally speaking, I think people would prefer a memory
failback.

A different flag could be used to return NULL on failure. e.g.,
ALLEGRO_REQUIRE_VIDEO_BITMAP. You still, though, have the situation
where the display is destroyed after such a bitmap has been created.
But I think it would be appropriate to downgrade these "required"
video bitmaps to memory bitmaps at that time... That is, the require
flag simply means it must be a video bitmap at time of _initial_
creation.

All that said, the behavior I would prefer then is that Allegro keeps
track of vector of memory bitmaps that should be converted to video
bitmaps when one makes the request. Those bitmaps are the
ALLEGRO_VIDEO_BITMAPs that were created before a display or have stuck
around after the display was destroyed.

So when a display is destroyed, all of its video bitmaps are sent back
to that vector. Under no situation will a bitmap on that list be
automatically upgraded back to a video bitmap upon creating a display.
The only time that happens is when you call the explicit function.

I know some of that changes behavior slightly, but I think Allegro 5
is still new enough that the impact of any changes would be slight
given that it requires destroying displays and creating new ones, etc.

--
Matthew Leverton




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