display: fix bound checking in drect_border (#14)

Bounds would be moved before drawing the border, therefore displacing
the border. Since drect() already performs all the necessary checks,
this change doesn't try to save a couple of function calls and drops the
redundant checks.
This commit is contained in:
Lephe 2021-04-30 09:42:01 +02:00
parent 392d033e4a
commit c4ec06d6ab
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 1 additions and 6 deletions

View File

@ -8,12 +8,7 @@ void drect_border(int x1, int y1, int x2, int y2, int fill, int width,
if(x1 > x2) swap(x1, x2);
if(y1 > y2) swap(y1, y2);
/* Order and bounds */
if(x1 >= 396 || x2 < 0 || y1 >= 224 || y2 < 0) return;
if(x1 < 0) x1 = 0;
if(x2 >= 396) x2 = 395;
if(y1 < 0) y1 = 0;
if(y2 >= 224) y2 = 223;
if(x1 >= DWIDTH || x2 < 0 || y1 >= DHEIGHT || y2 < 0) return;
drect(x1, y1, x2, y1 + (width-1), border);
drect(x1, y2 - (width-1), x2, y2, border);