summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/libgd-src/tests/gdtransformaffinecopy/github_bug_00585.c
blob: e83910c95ac5de335d5485484d0770d976e6e8f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/*
 * Test that gdTransformAffineCopy() does not change the interpolation method
 *
 * See <https://github.com/libgd/libgd/issues/585>
 */

#include "gd.h"
#include "gdtest.h"

int main()
{
	gdImagePtr src, dst;
	gdRect rect = {0, 0, 8, 8};
	double matrix[] = {1, 1, 1, 1, 1, 1};
	int res;
	gdInterpolationMethod old_m, new_m;

	src = gdImageCreateTrueColor(8, 8);
	gdTestAssert(src != NULL);
	dst = gdImageCreateTrueColor(8, 8);
	gdTestAssert(dst != NULL);

	res = gdImageSetInterpolationMethod(src, GD_CATMULLROM);
	gdTestAssert(res == GD_TRUE);
	old_m = gdImageGetInterpolationMethod(src);
	gdTransformAffineCopy(dst, 0, 0, src, &rect, matrix);
	new_m = gdImageGetInterpolationMethod(src);
	gdTestAssert(new_m == old_m);

	gdImageDestroy(src);
	gdImageDestroy(dst);
	return gdNumFailures();
}