Re: [AD] al_convert_bitmap |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2011-06-03, Elias Pschernig <elias.pschernig@xxxxxxxxxx> wrote:
> The attached patch adds the ability to convert between memory and video
> bitmaps. It has two new functions:
>
> al_convert_bitmap: like al_clone_bitmap, but modifies the bitmap
> in-place)
>
> al_convert_all_video_bitmaps: converts all video bitmaps which have
> silently been converted to memory bitmaps because there was no display
> to actual video bitmaps
>
> I first implemented this with a very small patch, simply making
> ALLEGRO_BITMAP big enough to hold either the OpenGL or D3D version with
> some static asserts to ensure it. But since that felt a bit messy I then
> changed ALLEGRO_BITMAP to have an .extra field which OpenGL/D3D now use
> to allocate their additional required storage, with no more driver
> specific bitmap structs. This however made the patch grow huge :P
I think the documentation is lacking justification for why you might
want to create pseudo-video bitmaps before creating a display.
(If it's to do with fonts, I think the font addons should actually keep
both memory and video bitmap copies of the glyphs, at least by default.)
Here's an idea: what if we introduce bitmap 'tags', where every bitmap
is tagged with the current tag when it is created. Logically, each tag
is a list of bitmaps managed by Allegro. Then we introduce a function
to convert all bitmaps with a particular tag:
al_convert_bitmaps_with_tag(int tag, int newtag);
/* After each bitmap is successfully converted, its tag
* can be changed to newtag.
*/
This might replace al_convert_all_video_bitmaps while opening up
more possibilities.
Peter