diff options
-rw-r--r-- | rect.c | 20 |
1 files changed, 8 insertions, 12 deletions
@@ -3,7 +3,6 @@ Rect* rect_clip(Rect* r, const Rect* c) { int n; - int x = r->x, y = r->y; if ((n = c->x - r->x) > 0) { r->w -= n; r->x += n; @@ -12,16 +11,15 @@ Rect* rect_clip(Rect* r, const Rect* c) { r->h -= n; r->y += n; } - if ((n = x + r->w - (c->x + c->w)) > 0) + if ((n = r->x + r->w - (c->x + c->w)) > 0) r->w -= n; - if ((n = y + r->h - (c->y + c->h)) > 0) + if ((n = r->y + r->h - (c->y + c->h)) > 0) r->h -= n; return r; } Rect* rect_clipr(Rect* r, const int* c) { int n; - int x = r->x, y = r->y; if ((n = c[0] - r->x) > 0) { r->w -= n; r->x += n; @@ -30,16 +28,15 @@ Rect* rect_clipr(Rect* r, const int* c) { r->h -= n; r->y += n; } - if ((n = x + r->w - c[2]) > 0) + if ((n = r->x + r->w - c[2]) > 0) r->w -= n; - if ((n = y + r->h - c[3]) > 0) + if ((n = r->y + r->h - c[3]) > 0) r->h -= n; return r; } Rect* rect_clips(Rect* r, Rect* s, const Rect* c) { int n; - int x = r->x, y = r->y; if ((n = c->x - r->x) > 0) { r->w -= n; r->x += n; @@ -52,11 +49,11 @@ Rect* rect_clips(Rect* r, Rect* s, const Rect* c) { s->h -= n; s->y += n; } - if ((n = x + r->w - (c->x + c->w)) > 0) { + if ((n = r->x + r->w - (c->x + c->w)) > 0) { r->w -= n; s->w -= n; } - if ((n = y + r->h - (c->y + c->h)) > 0) { + if ((n = r->y + r->h - (c->y + c->h)) > 0) { r->h -= n; s->h -= n; } @@ -65,7 +62,6 @@ Rect* rect_clips(Rect* r, Rect* s, const Rect* c) { Rect* rect_clipsr(Rect* r, Rect* s, const int* c) { int n; - int x = r->x, y = r->y; if ((n = c[0] - r->x) > 0) { r->w -= n; r->x += n; @@ -78,11 +74,11 @@ Rect* rect_clipsr(Rect* r, Rect* s, const int* c) { s->h -= n; s->y += n; } - if ((n = x + r->w - c[2]) > 0) { + if ((n = r->x + r->w - c[2]) > 0) { r->w -= n; s->w -= n; } - if ((n = y + r->h - c[3]) > 0) { + if ((n = r->y + r->h - c[3]) > 0) { r->h -= n; s->h -= n; } |