[AD] stretch_blit bug

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


Trent found a bug in the C version of stretch_blit, and specifically, it
seems to be the same bug that at one point was fixed in the asm version
of stretch_blit:

"""
r3020 | tjaden | 2003-02-15 02:29:39 +0100 (Sat, 15 Feb 2003) | 4 lines

Compensate for a problem in stretch_bitmap where the first column or row can
get an extra pixel than it should do for little -> big scaling.  Fixed by me
and Eric.  Bug reported by David Gowers and AJ.
"""

Attached is Trent's testcase. It works with the asm version, but is
broken with the C version.

Anyone here who knows how stretch blit works (and in particular what the
above fix did)? I was hoping to just add the same 4-line fix to the C
version, but seems it's more complicated than that :P

-- 
Elias Pschernig
#include <allegro.h>

int main()
{
	allegro_init();
	set_gfx_mode(GFX_AUTODETECT_WINDOWED, 1024, 768, 0, 0);
	install_keyboard();

	BITMAP* b = load_pcx("test.pcx", 0);

	int xo = 32;
	int yo = 24;

	stretch_blit(b, screen, 0, 0, b->w, b->h, xo, yo, b->w*3, b->h*3);

	int sx = 50;
	int sy = 50;
	int sw = 50;
	int sh = 50;

	stretch_blit(b, screen, sx, sy, sw, sh,
		sx*3+xo, sy*3+yo, sw*3, sh*3);

	readkey();
}
END_OF_MAIN()



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