add some macros for usefulness

SVN revision: 34165
This commit is contained in:
Carsten Haitzler 2008-04-01 20:51:04 +00:00
parent 6a7335a51f
commit 13cc8ba33d
1 changed files with 26 additions and 0 deletions

View File

@ -140,6 +140,32 @@ typedef struct _E_Rect E_Rect;
while (0)
#define E_CLAMP(x, min, max) (x < min ? min : (x > max ? max : x))
#define E_RECTS_CLIP_TO_RECT(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \
{ \
if (E_INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \
{ \
if (_x < (_cx)) \
{ \
_w += _x - (_cx); \
_x = (_cx); \
if (_w < 0) _w = 0; \
} \
if ((_x + _w) > ((_cx) + (_cw))) \
_w = (_cx) + (_cw) - _x; \
if (_y < (_cy)) \
{ \
_h += _y - (_cy); \
_y = (_cy); \
if (_h < 0) _h = 0; \
} \
if ((_y + _h) > ((_cy) + (_ch))) \
_h = (_cy) + (_ch) - _y; \
} \
else \
{ \
_w = 0; _h = 0; \
} \
}
#define E_REMOTE_OPTIONS 1
#define E_REMOTE_OUT 2