Re: [AD] C draw_trans_sprite() again

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


> Remember the little patch I submited a while ago to fix the trans sprite
> drawing bug in the C only routine version?

Sure :-)

> Well, all seemed to go well after it, until I ran extrans today... And I
> wonder if the current behaviour is a bug or not. The spotlight is drawn
> correctly, but the area around the outer circle (of color 0 in the
> spotlight bitmap) shows the background at full light: this is because the
> bitmap uses the transparency color in that area, so the
> draw_trans_sprite() skips it...

It seems that you just made a rediscovery:

	http://glub.ehu.es/mlist/allegro_conductors/2000/0578.html

and that your patch has mostly undone that of Stepan.

What is the most surprising is that both Shawn and Stepan implicitly take the 
weird behaviour of the asm version of draw_trans_sprite() in 8-bit as 
granted, which makes me think that it's a "feature".

> The docs are unclear on if this is a correct behaviour of not, so I wonder
> how to operate...

Yes, the only hint I found is in create_trans_table():
"This function treats source color #0 as a special case, leaving the 
destination unchanged whenever a zero source pixel is encountered, so that 
masked sprites will draw correctly."

This seems to acknowledge that draw_trans_sprite() doesn't skip zero source 
pixels in 8-bit.

> On other ports using the asm version of the trans routines this doesn't
> happen AFAIK;

Yes, I just verified that the asm code of _linear_draw_trans_sprite8() 
doesn't test for zero pixels, whereas that of _linear_draw_lit_sprite8() 
does test!

> so should we treat the 8bpp draw_trans_sprite routine differently, i.e. not
> to skip color 0?

Yes, the most sensible solution I think.

> On other color depths I think it's correct to skip bright pink. What's your 
> opinion?

The asm version of

	_linear_draw_trans_sprite15(),
	_linear_draw_trans_sprite16(),
	_linear_draw_trans_sprite24(),
	_linear_draw_trans_sprite32()

do skip the masked color so we should do the same in C.

> Oh, and btw the docs should be more clear about this...

Definitely.

-- 
Eric Botcazou




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