Re: [AD] New clipping API

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


Quick questions: why are the cordinates inclusive on both sides? Why not use a width/height approach, to match, say, the blit() semantics?


Eric Botcazou wrote:
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.



--
- Robert Jr Ohannessian
http://bob.allegronetwork.com/






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