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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
|
diff -aur libgdiplus-1.0.5/src/gdip.h libgdiplus-1.0.5-messy/src/gdip.h
--- libgdiplus-1.0.5/src/gdip.h 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/gdip.h 2005-01-27 21:48:44.214654248 -0500
@@ -20,9 +20,8 @@
#include <glib.h>
#include <cairo.h>
-#ifndef CAIRO_HAS_XLIB_SURFACE
+#include <cairo-ft.h>
#include <cairo-xlib.h>
-#endif
/* mono/io-layer/uglify.h also has these typedefs.
* To avoid a dependency on mono we have copied all
@@ -1162,7 +1161,7 @@
int fcmp (double x1, double x2, double epsilon);
float gdip_get_display_dpi();
void gdip_unitConversion(Unit fromUnit, Unit toUnit, float nSrc, float* nTrg);
-int gdpi_utf8_to_glyphs (cairo_font_t* font, cairo_matrix_t matrix, const unsigned char* utf8, double x0,
+int gdpi_utf8_to_glyphs (cairo_font_t* font, cairo_matrix_t* matrix, const unsigned char* utf8, double x0,
double y0, cairo_glyph_t** glyphs, size_t* nglyphs);
void gdip_font_drawunderline (GpGraphics *graphics, GpBrush *brush, float x, float y, float width);
diff -aur libgdiplus-1.0.5/src/general.c libgdiplus-1.0.5-messy/src/general.c
--- libgdiplus-1.0.5/src/general.c 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/general.c 2005-01-27 21:07:37.319679288 -0500
@@ -269,17 +269,17 @@
static void
_install_font_matrix(cairo_matrix_t *matrix, FT_Face face)
{
- cairo_matrix_t normalized;
+ cairo_matrix_t* normalized = cairo_matrix_create();
double scale_x, scale_y;
double xx, xy, yx, yy, tx, ty;
FT_Matrix mat;
_gdip_cairo_matrix_compute_scale_factors (matrix, &scale_x, &scale_y);
- cairo_matrix_copy (&normalized, matrix);
+ cairo_matrix_copy (normalized, matrix);
- cairo_matrix_scale (&normalized, 1.0 / scale_x, 1.0 / scale_y);
- cairo_matrix_get_affine (&normalized,
+ cairo_matrix_scale (normalized, 1.0 / scale_x, 1.0 / scale_y);
+ cairo_matrix_get_affine (normalized,
&xx /* 00 */ , &yx /* 01 */,
&xy /* 10 */, &yy /* 11 */,
&tx, &ty);
@@ -298,7 +298,7 @@
int
gdpi_utf8_to_glyphs (cairo_font_t *font,
- cairo_matrix_t matrix,
+ cairo_matrix_t *matrix,
const unsigned char *utf8,
double x0,
double y0,
@@ -323,7 +323,7 @@
return 0;
}
- _install_font_matrix (&matrix, face);
+ _install_font_matrix (matrix, face);
for (i = 0; i < *nglyphs; i++)
{
diff -aur libgdiplus-1.0.5/src/graphics.c libgdiplus-1.0.5-messy/src/graphics.c
--- libgdiplus-1.0.5/src/graphics.c 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/graphics.c 2005-01-27 21:21:25.643754888 -0500
@@ -448,7 +448,7 @@
g_return_val_if_fail (graphics != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *(graphics->copy_of_ctm) = *(matrix);
+ graphics->copy_of_ctm = matrix;
cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
return Ok;
}
@@ -1571,16 +1571,18 @@
float *GlyphWidths;
float TotalWidth = 0;
int i;
- cairo_matrix_t matrix;
+ cairo_matrix_t *matrix;
#ifdef DRAWSTRING_DEBUG
printf("CalculateStringSize(font, %s, %d, details) called\n", utf8, StringDetailElements);
#endif
Font=(cairo_font_t *)gdiFont->cairofnt;
+ matrix = cairo_matrix_create();
+
/* Generate Glyhps for string utf8 */
- cairo_font_current_transform(Font, &matrix);
- cairo_matrix_scale(&matrix, gdiFont->sizeInPixels, gdiFont->sizeInPixels);
+ cairo_font_current_transform(Font, matrix);
+ cairo_matrix_scale(matrix, gdiFont->sizeInPixels, gdiFont->sizeInPixels);
gdpi_utf8_to_glyphs (Font, matrix, utf8, 0.0, 0.0, &Glyphs, &NumOfGlyphs);
/* FIXME - This check and the StringDetailElements argument can be removed after verification of Glyph:WChar=1:1 */
@@ -1617,7 +1619,7 @@
unsigned char *String; /* Holds the UTF8 version of our sanitized string */
WCHAR *CleanString; /* Holds the unicode version of our sanitized string */
unsigned long StringLen; /* Length of CleanString */
- cairo_matrix_t SavedMatrix;
+ cairo_matrix_t *SavedMatrix;
GDIPCONST WCHAR *Src;
WCHAR *Dest;
GpStringFormat *fmt;
@@ -1683,12 +1685,13 @@
/*
Get font size information; how expensive is the cairo stuff here?
*/
+ SavedMatrix = cairo_matrix_create();
cairo_save (graphics->ct);
cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
- cairo_font_current_transform(font->cairofnt, &SavedMatrix);
+ cairo_font_current_transform(font->cairofnt, SavedMatrix);
cairo_scale_font (graphics->ct, font->sizeInPixels);
cairo_current_font_extents (graphics->ct, &FontExtent);
- cairo_font_set_transform(font->cairofnt, &SavedMatrix);
+ cairo_font_set_transform(font->cairofnt, SavedMatrix);
cairo_restore (graphics->ct);
LineHeight=FontExtent.ascent;
#ifdef DRAWSTRING_DEBUG
@@ -2170,7 +2173,7 @@
/* Setup cairo */
/* Save the font matrix */
cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
- cairo_font_current_transform(font->cairofnt, &SavedMatrix);
+ cairo_font_current_transform(font->cairofnt, SavedMatrix);
if (brush) {
gdip_brush_setup (graphics, (GpBrush *)brush);
@@ -2307,7 +2310,7 @@
}
}
- cairo_font_set_transform(font->cairofnt, &SavedMatrix);
+ cairo_font_set_transform(font->cairofnt, SavedMatrix);
cairo_restore (graphics->ct);
}
diff -aur libgdiplus-1.0.5/src/lineargradientbrush.c libgdiplus-1.0.5-messy/src/lineargradientbrush.c
--- libgdiplus-1.0.5/src/lineargradientbrush.c 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/lineargradientbrush.c 2005-01-27 21:23:44.401660480 -0500
@@ -1189,7 +1189,7 @@
if (brush->presetColors->count >= 2)
return WrongState;
- *matrix = *(brush->matrix);
+ matrix = brush->matrix;
return Ok;
}
@@ -1200,7 +1200,9 @@
g_return_val_if_fail (brush != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *(brush->matrix) = *matrix;
+ brush->matrix = cairo_matrix_create();
+ g_return_val_if_fail (brush->matrix != NULL, OutOfMemory);
+ cairo_matrix_copy(brush->matrix, matrix);
brush->changed = TRUE;
return Ok;
}
diff -aur libgdiplus-1.0.5/src/matrix.c libgdiplus-1.0.5-messy/src/matrix.c
--- libgdiplus-1.0.5/src/matrix.c 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/matrix.c 2005-01-27 21:27:43.823262864 -0500
@@ -169,9 +169,13 @@
GpStatus
GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order)
{
- GpMatrix tmp;
- cairo_matrix_set_affine (&tmp, 1, 0, 0, 1, offsetX, offsetY);
- GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
+ cairo_matrix_t *tmp;
+ GpStatus s;
+
+ tmp = cairo_matrix_create();
+ cairo_matrix_set_affine (tmp, 1, 0, 0, 1, offsetX, offsetY);
+ s = GdipMultiplyMatrix (matrix, tmp, order);
+ cairo_matrix_destroy(tmp);
return s;
}
@@ -179,9 +183,13 @@
GpStatus
GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order)
{
- GpMatrix tmp;
- cairo_matrix_set_affine (&tmp, scaleX, 0, 0, scaleY, 0, 0);
- GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
+ cairo_matrix_t *tmp;
+ GpStatus s;
+
+ tmp = cairo_matrix_create();
+ cairo_matrix_set_affine (tmp, scaleX, 0, 0, scaleY, 0, 0);
+ s = GdipMultiplyMatrix (matrix, tmp, order);
+ cairo_matrix_destroy(tmp);
return s;
}
@@ -189,10 +197,14 @@
GpStatus
GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order)
{
- GpMatrix tmp;
+ cairo_matrix_t *tmp;
+ GpStatus s;
float rad = angle * DEGTORAD;
- cairo_matrix_set_affine (&tmp, cos (rad), sin (rad), -sin (rad), cos (rad), 0, 0);
- GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
+
+ tmp = cairo_matrix_create();
+ cairo_matrix_set_affine (tmp, cos (rad), sin (rad), -sin (rad), cos (rad), 0, 0);
+ s = GdipMultiplyMatrix (matrix, tmp, order);
+ cairo_matrix_destroy(tmp);
return s;
}
@@ -200,9 +212,13 @@
GpStatus
GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order)
{
- GpMatrix tmp;
- cairo_matrix_set_affine (&tmp, 1, shearX, shearY, 1, 0, 0);
- GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
+ cairo_matrix_t *tmp;
+ GpStatus s;
+
+ tmp = cairo_matrix_create();
+ cairo_matrix_set_affine (tmp, 1, shearX, shearY, 1, 0, 0);
+ s = GdipMultiplyMatrix (matrix, tmp, order);
+ cairo_matrix_destroy(tmp);
return s;
}
diff -aur libgdiplus-1.0.5/src/pathgradientbrush.c libgdiplus-1.0.5-messy/src/pathgradientbrush.c
--- libgdiplus-1.0.5/src/pathgradientbrush.c 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/pathgradientbrush.c 2005-01-27 23:05:13.196023040 -0500
@@ -481,7 +481,7 @@
g_return_val_if_fail (brush != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *matrix = *(brush->transform);
+ cairo_matrix_copy(matrix, brush->transform);
return Ok;
}
@@ -491,7 +491,7 @@
g_return_val_if_fail (brush != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *(brush->transform) = *matrix;
+ brush->transform = matrix;
return Ok;
}
@@ -506,19 +506,22 @@
GpStatus
GdipMultiplyPathGradientTransform (GpPathGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
{
- cairo_matrix_t mat;
+ cairo_matrix_t *mat;
g_return_val_if_fail (brush != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
+ mat = cairo_matrix_create();
+
if (order == MatrixOrderPrepend)
- cairo_matrix_multiply (&mat, matrix, brush->transform);
+ cairo_matrix_multiply (mat, matrix, brush->transform);
else if (order == MatrixOrderAppend)
- cairo_matrix_multiply (&mat, brush->transform, matrix);
- else
+ cairo_matrix_multiply (mat, brush->transform, matrix);
+ else {
+ cairo_matrix_destroy(mat);
return InvalidParameter;
+ }
- *(brush->transform) = mat;
-
+ brush->transform = mat;
return Ok;
}
@@ -530,11 +533,17 @@
if (order == MatrixOrderAppend) {
cairo_matrix_translate (brush->transform, dx, dy);
} else if (order == MatrixOrderPrepend) {
- cairo_matrix_t mat, matres;
- cairo_matrix_set_identity (&mat);
- cairo_matrix_translate (&mat, dx, dy);
- cairo_matrix_multiply (&matres, &mat, brush->transform);
- *(brush->transform) = matres;
+ cairo_matrix_t *mat, *matres;
+
+ mat = cairo_matrix_create();
+ matres = cairo_matrix_create();
+
+ cairo_matrix_set_identity (mat);
+ cairo_matrix_translate (mat, dx, dy);
+ cairo_matrix_multiply (matres, mat, brush->transform);
+ brush->transform = matres;
+
+ cairo_matrix_destroy(mat);
} else {
return InvalidParameter;
}
@@ -550,11 +559,16 @@
if (order == MatrixOrderAppend) {
cairo_matrix_scale (brush->transform, sx, sy);
} else if (order == MatrixOrderPrepend) {
- cairo_matrix_t mat, matres;
- cairo_matrix_set_identity (&mat);
- cairo_matrix_scale (&mat, sx, sy);
- cairo_matrix_multiply (&matres, &mat, brush->transform);
- *(brush->transform) = matres;
+ cairo_matrix_t *mat, *matres;
+
+ mat = cairo_matrix_create();
+ matres = cairo_matrix_create();
+ cairo_matrix_set_identity (mat);
+ cairo_matrix_scale (mat, sx, sy);
+ cairo_matrix_multiply (matres, mat, brush->transform);
+ brush->transform = matres;
+
+ cairo_matrix_destroy(mat);
} else {
return InvalidParameter;
}
@@ -570,11 +584,17 @@
if (order == MatrixOrderAppend) {
cairo_matrix_rotate (brush->transform, angle * DEGTORAD);
} else if (order == MatrixOrderPrepend) {
- cairo_matrix_t mat, matres;
- cairo_matrix_set_identity (&mat);
- cairo_matrix_rotate (&mat, angle * DEGTORAD);
- cairo_matrix_multiply (&matres, &mat, brush->transform);
- *(brush->transform) = matres;
+ cairo_matrix_t *mat, *matres;
+
+ mat = cairo_matrix_create();
+ matres = cairo_matrix_create();
+
+ cairo_matrix_set_identity (mat);
+ cairo_matrix_rotate (mat, angle * DEGTORAD);
+ cairo_matrix_multiply (matres, mat, brush->transform);
+ brush->transform = matres;
+
+ cairo_matrix_destroy(mat);
} else {
return InvalidParameter;
}
diff -aur libgdiplus-1.0.5/src/pen.c libgdiplus-1.0.5-messy/src/pen.c
--- libgdiplus-1.0.5/src/pen.c 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/pen.c 2005-01-27 21:28:51.829924280 -0500
@@ -543,7 +543,8 @@
g_return_val_if_fail (pen != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *(pen->matrix) = *matrix;
+ pen->matrix = cairo_matrix_create();
+ cairo_matrix_copy(pen->matrix, matrix);
pen->changed = TRUE;
return Ok;
}
@@ -554,7 +555,7 @@
g_return_val_if_fail (pen != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *matrix = *(pen->matrix);
+ cairo_matrix_copy(matrix, pen->matrix);
return Ok;
}
diff -aur libgdiplus-1.0.5/src/texturebrush.c libgdiplus-1.0.5-messy/src/texturebrush.c
--- libgdiplus-1.0.5/src/texturebrush.c 2004-11-13 19:28:19.000000000 -0500
+++ libgdiplus-1.0.5-messy/src/texturebrush.c 2005-01-27 21:44:47.726605896 -0500
@@ -714,7 +714,7 @@
g_return_val_if_fail (texture != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *matrix = *(texture->matrix);
+ cairo_matrix_copy(matrix, texture->matrix);
return Ok;
}
@@ -724,7 +724,8 @@
g_return_val_if_fail (texture != NULL, InvalidParameter);
g_return_val_if_fail (matrix != NULL, InvalidParameter);
- *(texture->matrix) = *matrix;
+ texture->matrix = cairo_matrix_create();
+ cairo_matrix_copy(texture->matrix, matrix);
texture->changed = TRUE;
return Ok;
|