gdImageRectangle: support any relative points

Contrary to gdImageFilledRectangle(), gdImageRectangle() has the
documented limitation that the given points have to be the upper
left and the lower right corner, respectively.  However, libgd
already caters to upper right / lower left pairs, and not
catering to the other two combinations seems to be an oversight.

Fixes #177.
master
Christoph M. Becker 2015-07-20 02:11:18 +02:00 committed by Mike Frysinger
parent 7d0d9d2a4f
commit 5a85d6c3e3
1 changed files with 4 additions and 3 deletions

View File

@ -2262,12 +2262,13 @@ BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y
}
if (y2 < y1) {
int t;
t = y1;
int t = y1;
y1 = y2;
y2 = t;
}
t = x1;
if (x2 < x1) {
int t = x1;
x1 = x2;
x2 = t;
}