Re: [AD] al_create_bitmap

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


I've made a patch for this one, too.


On Thu, Feb 21, 2008 at 1:32 PM, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> Currently al_create_bitmap checks if the memory bitmap flag is set,
>  and if not, goes to the create_bitmap vtable entry  in the the
>  display. Would it be possible to check first if this entry is NULL,
>  and if so, create a memory bitmap anyway.
>
>  If that were done, it would make it really easy to make a display
>  driver for a new platform - you could allocate a memory bitmap for the
>  backbuffer and then you would only have to implement create, destroy
>  and flip. In this case, flip would just be a memory->vram blit.
>
>  Pete
>
Index: src/bitmap_new.c
===================================================================
--- src/bitmap_new.c	(revision 10045)
+++ src/bitmap_new.c	(working copy)
@@ -73,7 +73,7 @@
    memset(bitmap, 0, sizeof *bitmap);
 
    bitmap->format = format;
-   bitmap->flags = al_get_new_bitmap_flags();
+   bitmap->flags = al_get_new_bitmap_flags() | ALLEGRO_MEMORY_BITMAP;
    bitmap->w = w;
    bitmap->h = h;
    bitmap->display = NULL;
@@ -113,7 +113,8 @@
 {
    ALLEGRO_BITMAP *bitmap;
    
-   if (al_get_new_bitmap_flags() & ALLEGRO_MEMORY_BITMAP) {
+   if ((al_get_new_bitmap_flags() & ALLEGRO_MEMORY_BITMAP) ||
+         (_al_current_display->vt->create_bitmap == NULL)) {
       return _al_create_memory_bitmap(w, h);
    }
 


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