[AD] clipping off-by-1

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


I just fixed an off-by-1 problem in the clipping code. It had this in
al_set_clipping_rectangle:

bitmap->cl = x;
bitmap->cr = x + width;

but this in al_get_clipping_rectangle:

if (w) *w = bitmap->cr - bitmap->cl + 1;

The first one was assuming semantics where cr is the actual position of
the clipping edge. The second was assuming that it is one less. The
OpenGL implementation also was assuming the one-less semantics.

So, without any idea what the original implementator (likely myself)
wanted, I now fixed it to never use the one-less semantics, as I think
it's less obvious for the floating-point coordinates we use for all
blitting and drawing primitives. Depending on what other implementations
besides OpenGL assumed, they may need to be updated as well.

-- 
Elias Pschernig <elias@xxxxxxxxxx>





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