summaryrefslogtreecommitdiff
path: root/Build/source/libs/gd/TLpatches/patch-01-win32
blob: 4be08e1eaa3370d98f6645a199d5e1f8074033f5 (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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
diff -ur libgd-2.3.3/src/gd_interpolation.c libgd-src/src/gd_interpolation.c
--- libgd-2.3.3/src/gd_interpolation.c	Sat Sep 11 13:43:11 2021
+++ libgd-src/src/gd_interpolation.c	Mon Sep 13 13:00:04 2021
@@ -295,8 +295,9 @@
 }
 
 double filter_linear(const double x, const double support) {
+	double ax;
 	ARG_NOT_USED(support);
-	double ax = fabs(x);
+	ax = fabs(x);
 	if (ax < 1.0f) {
 		return (1.0f - ax);
 	}
@@ -339,8 +340,9 @@
 /* CubicSpline filter, default radius 2 */
 static double filter_cubic_spline(const double x1, const double support)
 {
+	double x;
 	ARG_NOT_USED(support);
-	const double x = x1 < 0.0 ? -x1 : x1;
+	x = x1 < 0.0 ? -x1 : x1;
 
 	if (x < 1.0 ) {
 		const double x2 = x*x;
@@ -559,8 +561,9 @@
 
 static double filter_power(const double x, const double support)
 {
+	double a;
 	ARG_NOT_USED(support);
-	const double a = 2.0f;
+	a = 2.0f;
 	if (fabs(x)>1) return 0.0f;
 	return (1.0f - (double)fabs(pow(x,a)));
 }
@@ -2004,9 +2007,9 @@
 	int i;
 
 	b = (unsigned char)tcolor;
-	g = (unsigned char)tcolor >> 8;
-	r = (unsigned char)tcolor >> 16;
-	a = (unsigned char)tcolor >> 24;
+	g = (unsigned char)(tcolor >> 8);
+	r = (unsigned char)(tcolor >> 16);
+	a = (unsigned char)(tcolor >> 24);
 
 	for (i = 0; i < im->colorsTotal; i++) {
 		if (im->red[i] == r && im->green[i] == g && im->blue[i] == b && im->alpha[i] == a) {
diff -ur libgd-2.3.3/src/gdft.c libgd-src/src/gdft.c
--- libgd-2.3.3/src/gdft.c	Sat Sep 11 13:43:11 2021
+++ libgd-src/src/gdft.c	Mon Sep 13 12:40:35 2021
@@ -446,6 +446,11 @@
 		FT_Face face, gdFTStringExtraPtr strex,
 		glyphInfo **glyph_info)
 {
+#ifndef HAVE_LIBRAQM
+	FT_UInt glyph_index = 0, previous = 0;
+	FT_Vector delta;
+	FT_Error err;
+#endif
 	size_t count;
 	glyphInfo *info;
 
@@ -488,9 +493,6 @@
 
 	raqm_destroy (rq);
 #else
-	FT_UInt glyph_index = 0, previous = 0;
-	FT_Vector delta;
-	FT_Error err;
 	info = (glyphInfo*) gdMalloc (sizeof (glyphInfo) * len);
 	if (!info) {
 		return -1;
@@ -1496,6 +1498,8 @@
 		}
 
 		if (render) {
+			FT_Pos pen_x;
+			FT_Pos pen_y;
 			FT_Activate_Size (platform_specific);
 
 			/* load glyph again into the slot (erase previous one)  - this time with scaling */
@@ -1529,8 +1533,8 @@
 			bm = (FT_BitmapGlyph) image;
 			/* position rounded down to nearest pixel at current dpi
 			(the estimate was rounded up to next 1/METRIC_RES, so this should fit) */
-			FT_Pos pen_x = penf.x + info[i].x_offset;
-			FT_Pos pen_y = penf.y - info[i].y_offset;
+			pen_x = penf.x + info[i].x_offset;
+			pen_y = penf.y - info[i].y_offset;
 			gdft_draw_bitmap (tc_cache, im, fg, bm->bitmap,
 					  (int)(x + (pen_x * cos_a + pen_y * sin_a)*hdpi/(METRIC_RES*64) + bm->left),
 					  (int)(y - (pen_x * sin_a - pen_y * cos_a)*vdpi/(METRIC_RES*64) - bm->top));
@@ -1766,6 +1770,16 @@
 	 */
 	*fontpath = NULL;
 	fontsearchpath = getenv ("GDFONTPATH");
+#ifdef _WIN32
+        if (!fontsearchpath) {
+          char *ffptr = getenv ("WINDIR");
+          if (ffptr) {
+            fontsearchpath = malloc (strlen(ffptr) + strlen("\\Fonts") + 1);
+            strcpy(fontsearchpath, ffptr);
+            strcat(fontsearchpath, "\\Fonts");
+          }
+        }
+#endif
 	if (!fontsearchpath)
 		fontsearchpath = DEFAULT_FONTPATH;
 	path = (char *) gdMalloc(sizeof(char) * strlen(fontsearchpath) + 1);