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 #include -#ifndef CAIRO_HAS_XLIB_SURFACE +#include #include -#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;