Re: [AD] some small patches

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


On Sat, 2002-11-02 at 14:23, Eric Botcazou wrote:
> > Hm, I see.. in this case, this is simply a bug. This voids my docs
> > patch. Setting the clipping rectangle already works, just not to the
> > right and to the bottom - the following patch aims at fixing it:
> 
> diff -u -r1.44 graphics.c
> --- src/graphics.c	9 Oct 2002 06:14:57 -0000	1.44
> +++ src/graphics.c	1 Nov 2002 11:46:36 -0000
> @@ -1405,8 +1405,8 @@
>     y2++;
>  
>     bitmap->clip = TRUE;
> -   bitmap->cl = MID(0, x1, bitmap->w-1);
> -   bitmap->ct = MID(0, y1, bitmap->h-1);
> +   bitmap->cl = MID(0, x1, bitmap->w);
> +   bitmap->ct = MID(0, y1, bitmap->h);
>     bitmap->cr = MID(0, x2, bitmap->w);
>     bitmap->cb = MID(0, y2, bitmap->h);
> 
> 
> Nope, there is no bug here: cl and ct are inclusive delimiters, whereas cr and 
> cb are exclusive ones. And it should probably be:
> 
>     bitmap->cr = MID(1, x2, bitmap->w);
>     bitmap->cb = MID(1, y2, bitmap->h);
> 

Yes, that would make it consistent for all 4 sides. But where is the
problem with my patch? It never actually sets the clipping rectangle
outside - the only case where cl/ct are set to w/h, is when the clipping
rectangle is empty anyway.

This makes most sense IMO, because the clipping rectangle is clipped
with the bitmap area. When would you actually want the (current for
left/right side) behavior of clipping to leave a 1-pixel border at the
side?

--
Elias Pschernig




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