Re: [AD] al_convert_bitmap

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


On Wed, Jun 15, 2011 at 10:01 AM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> If nobody wants it, let's not add it ;)
>
There are valid reasons for all of this. To me, the question is
simply: what should the default behavior be?

As Elias mentioned, we already are doing some high-level things with
bitmap management. This is about making what's already been done more
sensible. The other alternative is not to do nothing, but to get rid
of all high level bitmap management functionality.

I think the following *mutually exclusive* flags are simple enough:

ANY_BITMAP: try video, if it fails, create memory, and add it to the
list of auto convert. default.
VIDEO_BITMAP: only try video
MEMORY_BITMAP: only try memory

* When a display is created, loop through the list of
bitmaps-to-be-converted and convert them IF the display option was not
disabled.

* When a display is destroyed, try to transfer all video bitmaps to
another compatible display (as currently is happening). If that fails
then convert them to memory (as currently is happening) and add them
to the list of bitmaps to be converted. ALL video bitmaps that are
converted to memory would be added to that list... regardless of how
they were initially created.

One display option:

ALLEGRO_BITMAP_AUTO_CONVERSION
0: no conversion
1: enable conversion

One function:

al_convert_bitmaps();

So if you don't want any automatic conversions, the process is simple:
never use ALLEGRO_ANY_BITMAP.

Set ALLEGRO_MEMORY_BITMAP when creating your memory bitmap. And
destroy your ALLEGRO_VIDEO_BITMAP before you destroy your display.
Nothing is forced upon you. You'd basically have to do those two steps
anyway.

--
Matthew Leverton




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