[AD] New clipping API

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


This patch implements a new clipping API.  This topic was discussed at length 
about one year ago and has been on the TODO list since then.

It deprecates set_clip() and replaces it with 5 new functions:

void set_clip_rect(BITMAP *bitmap, int x1, int y1, int x2, int y2);
void add_clip_rect(BITMAP *bitmap, int x1, int y1, int x2, int y2);
inline void get_clip_rect(BITMAP *bitmap, int *x1, int *y1, int *x2, int*y2);
inline void set_clip_state, (BITMAP *bitmap, int state);
inline int get_clip_state(BITMAP *bitmap);

The semantics of the coordinates is the same as the current one for set_clip.  
The main difference is that the *_rect functions are orthogonal to the 
*_state functions.

I skimmed through the drawing code and verified that it properly tests the 
clipping rectangle before performing any operations, so it is possible to 
turn off drawing by specifying a "reversed" clipping rectangle.  This was 
not doable with the former set_clip (it authoritatively re-ordered the 
coordinates) but is now with set_clip_rect.

-- 
Eric Botcazou

Attachment: new_clip_api.diff.gz
Description: GNU Zip compressed data



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