- MFB: #106, gdImageRectangle draws 1x1 rectangles as 1x3 rectangles

master
pajoye 2007-08-26 19:46:19 +00:00
parent 12c4668a26
commit 1e3d5f1e70
5 changed files with 72 additions and 3 deletions

View File

@ -2102,6 +2102,11 @@ BGD_DECLARE(void) gdImageRectangle (gdImagePtr im, int x1, int y1, int x2, int y
int half1 = 1;
int t;
if (x1 == x2 && y1 == y2 && thick == 1) {
gdImageSetPixel(im, x1, y1, color);
return;
}
if (y2 < y1) {
t=y1;
y1 = y2;

View File

@ -1,6 +1,7 @@
SET(TESTS_FILES
bug00004
bug00078
bug00106
)
FOREACH(test_name ${TESTS_FILES})

View File

@ -0,0 +1,28 @@
#include <gd.h>
#include "gdtest.h"
int main()
{
gdImagePtr im;
FILE *fp;
int c1,c2,c3,c4;
im = gdImageCreateTrueColor(10,10);
if (!im) {
return 1;
}
gdImageFilledRectangle(im, 1,1, 1,1, 0x50FFFFFF);
c1 = gdImageGetTrueColorPixel(im, 1, 1);
c2 = gdImageGetTrueColorPixel(im, 2, 1);
c3 = gdImageGetTrueColorPixel(im, 1, 2);
c4 = gdImageGetTrueColorPixel(im, 2, 2);
gdImageDestroy(im);
if (0x005e5e5e == c1 && 0x0 == c2 &&
0x0 == c3 && 0x0 == c4) {
return 0;
} else {
return 1;
}
}

View File

@ -1,4 +1,10 @@
SET(TESTS_FILES
bug00003
bug00106
)
add_executable(bug00003 bug00003.c)
target_link_libraries (bug00003 gdTest ${GD_LIB})
ADD_TEST(bug00003 ${EXECUTABLE_OUTPUT_PATH}/bug00003)
FOREACH(test_name ${TESTS_FILES})
add_executable(${test_name} "${test_name}.c")
target_link_libraries (${test_name} gdTest ${GD_LIB})
ADD_TEST(${test_name} ${EXECUTABLE_OUTPUT_PATH}/${test_name})
ENDFOREACH(test_name)

View File

@ -0,0 +1,29 @@
#include "gd.h"
#include "gdtest.h"
int main()
{
gdImagePtr im;
FILE *fp;
int c1,c2,c3,c4;
im = gdImageCreateTrueColor(10,10);
if (!im) {
return 1;
}
gdImageRectangle(im, 1,1, 1,1, 0x50FFFFFF);
c1 = gdImageGetTrueColorPixel(im, 1, 1);
c2 = gdImageGetTrueColorPixel(im, 2, 1);
c3 = gdImageGetTrueColorPixel(im, 1, 2);
c4 = gdImageGetTrueColorPixel(im, 2, 2);
gdImageDestroy(im);
if (0x005e5e5e == c1 && 0x0 == c2 &&
0x0 == c3 && 0x0 == c4) {
return 0;
} else {
return 1;
}
}