[AD] Possible obscure bug on Windows Allegro 4.2.0

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


I've found a possible (obscure) bug within Windows Allegro 4.2.0.

Consider the following setup code:
	string assetname = "bitmapfile.bmp";
	BITMAP* filebmp = load_bitmap(assetname.c_str(), NULL);
	BITMAP* sysbmp = create_system_bitmap(filebmp->w, filebmp->h);
	BITMAP* vidbmp = create_video_bitmap(filebmp->w, filebmp->h);
	BITMAP* bmp = create_bitmap(filebmp->w, filebmp->h);

Running the sequence of code below will result in the final drawing to the
screen to not produce the image originally loaded from disk as expected:
	draw_sprite(sysbmp, filebmp, 0, 0);
	draw_sprite(vidbmp, sysbmp, 0, 0);
	draw_sprite(bmp, vidbmp, 0, 0);
	draw_sprite(screen, bmp, 0, 0);

However, the following code will result in the image showing up properly.
The difference is skipping the system bitmap transfer.
	draw_sprite(vidbmp, filebmp, 0, 0);
	draw_sprite(bmp, vidbmp, 0, 0);
	draw_sprite(screen, bmp, 0, 0);

The following code will also produce a proper image.  This time the
difference is using stretch_blit to transfer the image to the video bitmap
from the system bitmap instead of draw_sprite.  Note that using blit() has
the same effect as draw_sprite().
	draw_sprite(sysbmp, filebmp, 0, 0);
	stretch_blit(sysbmp, vidbmp, 0, 0, sysbmp->w, sysbmp->h. 0, 0,
vidbmp->w, vidbmp->h);
	draw_sprite(bmp, vidbmp, 0, 0);
	draw_sprite(screen, bmp, 0, 0);


In my application, I load everything into video memory, but, before that I
must flip and scale the image data before putting the final results into
video memory.  I didn't see a one-step method for flipping and scaling which
is the reason for the temporary system bitmap.  Later, I had a custom UI
piece of code using create_bitmap using the loaded video bitmap which caused
me to uncover this odd behavior.

Kirk Black
President / Owner
Family Time! Interactive, L.L.C.
Mobile: 512.771.5762
Email: runesabre@xxxxxxxxxx






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