Re: [AD] Logic in al_load_bitmap

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


Sorry, wrong patch!

Pete


On Thu, Feb 28, 2008 at 11:05 PM, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> Patch attached
>
>  Pete
>
>
>
>
>  On Tue, Feb 26, 2008 at 11:32 PM, Trent Gamblin <trent@xxxxxxxxxx> wrote:
>  > On Tue, February 26, 2008 2:34 pm, Peter Hull said:
>  >  > I've got a question about this one too. In these lines:
>  >  > /* If it's a display bitmap */
>  >  >    if (!(al_get_new_bitmap_flags() & ALLEGRO_MEMORY_BITMAP) &&
>  >  > bitmap) {
>  >  >       bitmap->vt->upload_bitmap(bitmap, 0, 0, bitmap->w, bitmap->h);
>  >  >    }
>  >  > would it be better to test bitmap->flags rather than
>  >  > al_get_new_bitmap_flags? It doesn't matter except if a display
>  >  > driver
>  >  > doesn't support any accelerated bitmaps and returns a memory bitmap
>  >  > instead. Then the upload_bitmap vtable function is NULL and it
>  >  > crashes.
>  >  >
>  >  > Pete
>  >
>  >  Yes, I think you're right again. Good eye.
>  >
>  >
>  >  Trent
>  >
>  >  -------------------------------------------------------------------------
>  >  This SF.net email is sponsored by: Microsoft
>  >  Defy all challenges. Microsoft(R) Visual Studio 2008.
>  >  http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>  >  --
>  >  https://lists.sourceforge.net/lists/listinfo/alleg-developers
>  >
>
Index: src/bitmap_new.c
===================================================================
--- src/bitmap_new.c	(revision 10045)
+++ src/bitmap_new.c	(working copy)
@@ -253,7 +253,7 @@
    bitmap = _al_load_memory_bitmap(filename);
 
    /* If it's a display bitmap */
-   if (!(al_get_new_bitmap_flags() & ALLEGRO_MEMORY_BITMAP) && bitmap) {
+   if ((bitmap!=NULL) && ((bitmap->flags | ALLEGRO_MEMORY_BITMAP) == 0)) {
       bitmap->vt->upload_bitmap(bitmap, 0, 0, bitmap->w, bitmap->h);
    }
 


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