Re: [AD] al_convert_bitmap

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


On Sun, Jun 12, 2011 at 11:18 PM, Peter Wang <novalazy@xxxxxxxxxx> wrote:
> Can I summarise the new flags like this, or propose that they
> work like this:
>
> ALLEGRO_ANY_BITMAP|ALLEGRO_MEMORY_BITMAP
> ALLEGRO_ANY_BITMAP|ALLEGRO_VIDEO_BITMAP
>
I assumed the flags would be mutually exclusive. That's why I proposed
ANY_BITMAP as opposed to an AUTO_CONVERT flag.

This was how I considered it:

ANY => try video first, fall back to memory. tag bitmaps as pending video
VIDEO => try video or fail
MEMORY => try memory or fail

Then when a display is created, if auto-convert is enabled (default
behavior) everything tagged as pending video would be converted to
video.

When a display is destroyed *all* video bitmaps are downgraded to
memories and tagged as pending video. It doesn't matter how they were
created.

The goal with all that is simply to make it work how people expect it
without much fuss or complication. If somebody really wants full
control, then can simply disable auto conversion, mark things as
MEMORY and manually call al_convert_bitmap() later.

VIDEO|ANY doesn't mean much to me. It could be a distinction between
destroying a bitmap upon display creation or not.

MEMORY|ANY only makes sense to do it while a display is created. So
why not then just manually create a memory bitmap, do your thing, and
then convert it? What's the use case with the MEMORY|ANY combo. You
obviously already know in advance that you don't want a video bitmap.

I'm not against allowing ANY to be an additional tag (as it allows for
more flexibility), but then I'd rename it to:

ALLEGRO_MEMORY_BITMAP | ALLEGRO_AUTO_CONVERT_BITMAP
ALLEGRO_VIDEO_BITMAP | ALLEGRO_AUTO_CONVERT_BITMAP

The absence of VIDEO and MEMORY would indicate to try video first then
fall back to memory. None of those three flags would mean try video,
then memory, and set auto convert. That would mean there would be no
way to say "I want a video or a memory bitmap but don't auto convert",
but I don't think that's a useful combination.

If the flags work together like that, then I think it makes sense that
VIDEO bitmaps without AUTO_CONVERT would be destroyed upon a displays
destruction.

On Mon, Jun 13, 2011 at 8:50 AM, Elias Pschernig
<elias.pschernig@xxxxxxxxxx> wrote:
> Would the option have any effect on al_destroy_display? Maybe it should
> also prevent the conversion to memory bitmaps there.
>
Well, I suppose that's additional rationale for having it be an option:
0 => do nothing at all
1 => auto upgrade tagged bitmaps
2 => auto downgrade tagged bitmaps
3 => auto upgrade & downgrade tagged bitmaps (default)

... just throwing out some possibilities.

> In theory a video bitmap doesn't need a texture attached
>
Then it's a bad name.

> I think I almost prefer it to be destroyed. Else there is no difference
> between a VIDEO bitmap and a VIDEO|ANY bitmap.
>
See my above comments to Peter.

--
Matthew Leverton




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