Re: [AD] al_convert_bitmap

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


On Wed, Jun 15, 2011 at 2:54 AM, Matthew Leverton <meffer@xxxxxxxxxx> wrote:
> On Tue, Jun 14, 2011 at 3:29 PM, Elias Pschernig
> <elias.pschernig@xxxxxxxxxx> wrote:
>> Makes sense. So al_destroy_display simply would go through the display
>> bitmaps and remove the VIDEO flag from any bitmaps without the ANY flag
>> - meaning the only operation allowed on them from now on is calling
>> al_destroy_bitmap.
>>
> I took it to mean it would destroy the video bitmap and replace it
> with something like a 1x1 memory bitmap. Thus the bitmap and all
> operations on it would be valid, but there would be little memory
> associated with it. To the programmer it would look like the bitmap
> was simply "erased".
>
> It's really kind of a no-good-solution situation. I was trying to
> avoid this altogether with the ANY_BITMAP approach.
>
> It was much simpler ... with it there's no difference between a video
> bitmap and a memory bitmap that has been converted to a video bitmap.
> Allegro wouldn't be able to tell them apart... they would always be
> downgraded to memory and added back to the convert-list vector.
>

So maybe we should leave it that way - if someone does not want it
they can destroy all bitmaps before destroying the display. Even when
converting to a 1x1 memory bitmap the zombie bitmaps still would use
up memory and need to be destroyed, so the user must keep a list of
the bitmaps either way.

>> We could provide bitflags instead of numbers:
>>
>> NO_AUTO_MEM_VID = 1
>> NO_AUTO_VID_MEM = 2
>> NO_TRANSFER = 4
>>
> Mine were based on a bitfield, but I didn't have the transfer flag.
> Given that the person could use al_convert_bitmaps() to transfer those
> bitmaps, I don't think it's necessary.
>
> I wouldn't ever expect Allegro to transfer video bitmaps to another
> dislpay... if it is doing it now, I wouldn't have thought it would.
>

Yes, someone must have implemented that at some point, at least I see
it for the OSX and X11 display drivers. The problem is when you have
two displays and draw your bitmaps to both. As long as the OpenGL
contexts are compatible that works. The bitmaps still are only in the
list of one display though. When one is destroyed they are
transferred.

Maybe we should not have a display option for al_destroy_display after
all (as Trent said I guess). Then:

- Display destruction works like now (video bitmaps are transferred to
anyother display if there is a compatible one, else converted to
memory bitmaps).

- If you do not want this, simply destroy all your display bitmaps
before destroying the display. (This would be slightly easier if we
had that bitmap tagging system since user code would not need a list
at all.)

The only values for the new display option then would be 0
(AUTO_CONVERT bitmaps are converted in al_create_display) and 1
(AUTO_CONVERT bitmaps are ignored).




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