Re: [AD] al_convert_bitmap

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


On 2011-06-12, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> On Sun, Jun 12, 2011 at 11:16 AM, Elias Pschernig
> <elias.pschernig@xxxxxxxxxx> wrote:
> > I also left in al_convert_all_video_bitmaps for now. Can maybe remove it
> > now or at least rename.
> >
> I would leave it in and make a display option to disable the auto
> conversion behavior. That should prevent any complaints. I would use
> an option as opposed to a flag because a) negative flags are
> confusing, b) it gives the ability to offer different conversions
> methods in the future (although I cannot think of any other useful
> scenarios...), and c) it's rather obscure and probably not worth
> taking up a bitmask.
> 
> The function could be named something like al_upload_bitmap_textures().

I would just tell the users to call al_upload_bitmap_textures().

Can I summarise the new flags like this, or propose that they
work like this:

ALLEGRO_ANY_BITMAP|ALLEGRO_MEMORY_BITMAP
    The bitmap actually does reside in system memory right now.
    al_upload_bitmap_textures() will try to transition these to
    ALLEGRO_ANY_BITMAP|ALLEGRO_VIDEO_BITMAP.

ALLEGRO_ANY_BITMAP|ALLEGRO_VIDEO_BITMAP
    The bitmap actually is a texture right now.
    al_destroy_display() may transition these to
    ALLEGRO_ANY_BITMAP|ALLEGRO_MEMORY_BITMAP.

ALLEGRO_MEMORY_BITMAP
    The bitmap actually really does reside in system memory right now.
    al_upload_bitmap_textures() will NOT try to convert it.

ALLEGRO_VIDEO_BITMAP
    The bitmap actually is a texture right now.
    al_destroy_display() may transition these to
    ALLEGRO_ANY_BITMAP|ALLEGRO_MEMORY_BITMAP
    even if the ALLEGRO_ANY_BITMAP flag is not present.


al_set_new_bitmap_flags(ALLEGRO_MEMORY_BITMAP) means:
    al_create_bitmap must return a memory bitmap, or NULL.

al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP) means:
    al_create_bitmap must return a video bitmap, or NULL.
    Unlike 5.0, it won't return a memory bitmap when no display is
    present.

al_set_new_bitmap_flags(ALLEGRO_ANY_BITMAP) means:
    al_create_bitmap will preferably return a video bitmap, but
    may return a memory bitmap.
    The bitmap has the flag ALLEGRO_ANY_BITMAP, so in the latter
    case al_upload_bitmap_textures will try to convert it.

al_set_new_bitmap_flags(ALLEGRO_ANY_BITMAP|ALLEGRO_MEMORY_BITMAP) means:
    al_create_bitmap must return a memory bitmap, or NULL.
    The bitmap will have the flag ALLEGRO_ANY_BITMAP so
    al_upload_bitmap_textures will try to convert it later.

al_set_new_bitmap_flags(ALLEGRO_ANY_BITMAP|ALLEGRO_VIDEO_BITMAP) means:
    The same as al_set_new_bitmap_flags(ALLEGRO_VIDEO_BITMAP).
    The bitmap will have the flag ALLEGRO_ANY_BITMAP but that is
    immaterial.

al_set_new_bitmap_flags(0)
    Now implies ALLEGRO_ANY_BITMAP instead of ALLEGRO_VIDEO_BITMAP.

Peter




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