View | Details | Raw Unified
Collapse All | Expand All

(-) libgdiplus-1.0.5/src/gdip.h (-3 / +2 lines)
 Lines 20-28    Link Here 
#include <glib.h>
#include <glib.h>
#include <cairo.h>
#include <cairo.h>
#ifndef CAIRO_HAS_XLIB_SURFACE
#include <cairo-ft.h>
#include <cairo-xlib.h>
#include <cairo-xlib.h>
#endif
/* mono/io-layer/uglify.h also has these typedefs.
/* mono/io-layer/uglify.h also has these typedefs.
 * To avoid a dependency on mono we have copied all
 * To avoid a dependency on mono we have copied all
 Lines 1162-1168    Link Here 
int fcmp (double x1, double x2, double epsilon);
int fcmp (double x1, double x2, double epsilon);
float gdip_get_display_dpi();
float gdip_get_display_dpi();
void gdip_unitConversion(Unit fromUnit, Unit toUnit, float nSrc, float* nTrg);
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);
   double y0, cairo_glyph_t** glyphs, size_t* nglyphs);
void gdip_font_drawunderline (GpGraphics *graphics, GpBrush *brush, float x, float y, float width);
void gdip_font_drawunderline (GpGraphics *graphics, GpBrush *brush, float x, float y, float width);
(-) libgdiplus-1.0.5/src/general.c (-6 / +6 lines)
 Lines 269-285    Link Here 
static void
static void
_install_font_matrix(cairo_matrix_t *matrix, FT_Face face)
_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 scale_x, scale_y;
    double xx, xy, yx, yy, tx, ty;
    double xx, xy, yx, yy, tx, ty;
    FT_Matrix mat;
    FT_Matrix mat;
    _gdip_cairo_matrix_compute_scale_factors (matrix, &scale_x, &scale_y);
    _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_scale (normalized, 1.0 / scale_x, 1.0 / scale_y);
    cairo_matrix_get_affine (&normalized,
    cairo_matrix_get_affine (normalized,
                             &xx /* 00 */ , &yx /* 01 */,
                             &xx /* 00 */ , &yx /* 01 */,
                             &xy /* 10 */, &yy /* 11 */,
                             &xy /* 10 */, &yy /* 11 */,
                             &tx, &ty);
                             &tx, &ty);
 Lines 298-304    Link Here 
int
int
gdpi_utf8_to_glyphs (cairo_font_t	*font,
gdpi_utf8_to_glyphs (cairo_font_t	*font,
                 cairo_matrix_t		matrix,
                 cairo_matrix_t		*matrix,
		 const unsigned char	*utf8,
		 const unsigned char	*utf8,
		 double			x0,
		 double			x0,
		 double			y0,
		 double			y0,
 Lines 323-329    Link Here 
        return 0;
        return 0;
    }
    }
    _install_font_matrix (&matrix, face);
    _install_font_matrix (matrix, face);
    for (i = 0; i < *nglyphs; i++)
    for (i = 0; i < *nglyphs; i++)
    {
    {
(-) libgdiplus-1.0.5/src/graphics.c (-9 / +12 lines)
 Lines 448-454    Link Here 
	g_return_val_if_fail (graphics != NULL, InvalidParameter);
	g_return_val_if_fail (graphics != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != 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);
        cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
        return Ok;
        return Ok;
}
}
 Lines 1571-1586    Link Here 
	float			*GlyphWidths;
	float			*GlyphWidths;
	float			TotalWidth	= 0;
	float			TotalWidth	= 0;
	int			i;
	int			i;
	cairo_matrix_t		matrix;
	cairo_matrix_t		*matrix;
#ifdef DRAWSTRING_DEBUG
#ifdef DRAWSTRING_DEBUG
	printf("CalculateStringSize(font, %s, %d, details) called\n", utf8, StringDetailElements);
	printf("CalculateStringSize(font, %s, %d, details) called\n", utf8, StringDetailElements);
#endif
#endif
	Font=(cairo_font_t *)gdiFont->cairofnt;
	Font=(cairo_font_t *)gdiFont->cairofnt;
	matrix = cairo_matrix_create();
	/* Generate Glyhps for string utf8 */
	/* Generate Glyhps for string utf8 */
	cairo_font_current_transform(Font, &matrix);
	cairo_font_current_transform(Font, matrix);
	cairo_matrix_scale(&matrix, gdiFont->sizeInPixels, gdiFont->sizeInPixels);
	cairo_matrix_scale(matrix, gdiFont->sizeInPixels, gdiFont->sizeInPixels);
	gdpi_utf8_to_glyphs (Font, matrix, utf8, 0.0, 0.0, &Glyphs, &NumOfGlyphs);
	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 */
	/* FIXME - This check and the StringDetailElements argument can be removed after verification of Glyph:WChar=1:1 */
 Lines 1617-1623    Link Here 
	unsigned char		*String;		/* Holds the UTF8 version of our sanitized string */
	unsigned char		*String;		/* Holds the UTF8 version of our sanitized string */
	WCHAR			*CleanString;		/* Holds the unicode version of our sanitized string */
	WCHAR			*CleanString;		/* Holds the unicode version of our sanitized string */
	unsigned long		StringLen;		/* Length of CleanString */
	unsigned long		StringLen;		/* Length of CleanString */
	cairo_matrix_t		SavedMatrix;		
	cairo_matrix_t		*SavedMatrix;		
	GDIPCONST WCHAR		*Src;
	GDIPCONST WCHAR		*Src;
	WCHAR	 		*Dest;
	WCHAR	 		*Dest;
	GpStringFormat		*fmt;
	GpStringFormat		*fmt;
 Lines 1683-1694    Link Here 
	/*
	/*
	   Get font size information; how expensive is the cairo stuff here? 
	   Get font size information; how expensive is the cairo stuff here? 
	*/
	*/
	SavedMatrix = cairo_matrix_create();
	cairo_save (graphics->ct);
	cairo_save (graphics->ct);
	cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
	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_scale_font (graphics->ct, font->sizeInPixels);
	cairo_current_font_extents (graphics->ct, &FontExtent);
	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);
	cairo_restore (graphics->ct);
	LineHeight=FontExtent.ascent;
	LineHeight=FontExtent.ascent;
#ifdef DRAWSTRING_DEBUG
#ifdef DRAWSTRING_DEBUG
 Lines 2170-2176    Link Here 
		/* Setup cairo */
		/* Setup cairo */
		/* Save the font matrix */
		/* Save the font matrix */
		cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
		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) {
		if (brush) {
			gdip_brush_setup (graphics, (GpBrush *)brush);
			gdip_brush_setup (graphics, (GpBrush *)brush);
 Lines 2307-2313    Link Here 
			}
			}
		}
		}
		cairo_font_set_transform(font->cairofnt, &SavedMatrix);
		cairo_font_set_transform(font->cairofnt, SavedMatrix);
		cairo_restore (graphics->ct);
		cairo_restore (graphics->ct);
	}
	}
(-) libgdiplus-1.0.5/src/lineargradientbrush.c (-2 / +4 lines)
 Lines 1189-1195    Link Here 
	if (brush->presetColors->count >= 2)
	if (brush->presetColors->count >= 2)
		return WrongState;
		return WrongState;
	*matrix = *(brush->matrix);
	matrix = brush->matrix;
	return Ok;
	return Ok;
}
}
 Lines 1200-1206    Link Here 
	g_return_val_if_fail (brush != NULL, InvalidParameter);
	g_return_val_if_fail (brush != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != 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;
	brush->changed = TRUE;
	return Ok;
	return Ok;
}
}
(-) libgdiplus-1.0.5/src/matrix.c (-12 / +28 lines)
 Lines 169-177    Link Here 
GpStatus
GpStatus
GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order)
GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order)
{
{
        GpMatrix tmp;
	cairo_matrix_t *tmp;
        cairo_matrix_set_affine (&tmp, 1, 0, 0, 1, offsetX, offsetY);
        GpStatus s;
        GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
	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;
        return s;
}
}
 Lines 179-187    Link Here 
GpStatus
GpStatus
GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order)
GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order)
{
{
        GpMatrix tmp;
	cairo_matrix_t *tmp;
        cairo_matrix_set_affine (&tmp, scaleX, 0, 0, scaleY, 0, 0);
        GpStatus s;
        GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);        
	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;
        return s;
}
}
 Lines 189-198    Link Here 
GpStatus
GpStatus
GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order)
GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order)
{
{
	GpMatrix tmp;
	cairo_matrix_t *tmp;
        GpStatus s;
        float rad = angle * DEGTORAD;
        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;
        return s;
}
}
 Lines 200-208    Link Here 
GpStatus
GpStatus
GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order)
GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order)
{
{
        GpMatrix tmp;
	cairo_matrix_t *tmp;
        cairo_matrix_set_affine (&tmp, 1, shearX, shearY, 1, 0, 0);
        GpStatus s;
        GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
	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;
        return s;
}
}
(-) libgdiplus-1.0.5/src/pathgradientbrush.c (-23 / +43 lines)
 Lines 481-487    Link Here 
    g_return_val_if_fail (brush != NULL, InvalidParameter);
    g_return_val_if_fail (brush != NULL, InvalidParameter);
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
    *matrix = *(brush->transform);
    cairo_matrix_copy(matrix, brush->transform);
    return Ok;
    return Ok;
}
}
 Lines 491-497    Link Here 
    g_return_val_if_fail (brush != NULL, InvalidParameter);
    g_return_val_if_fail (brush != NULL, InvalidParameter);
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
    *(brush->transform) = *matrix;
    brush->transform = matrix;
    return Ok;
    return Ok;
}
}
 Lines 506-524    Link Here 
GpStatus
GpStatus
GdipMultiplyPathGradientTransform (GpPathGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
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 (brush != NULL, InvalidParameter);
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
    mat = cairo_matrix_create();
    if (order == MatrixOrderPrepend)
    if (order == MatrixOrderPrepend)
        cairo_matrix_multiply (&mat, matrix, brush->transform);
        cairo_matrix_multiply (mat, matrix, brush->transform);
    else if (order == MatrixOrderAppend)
    else if (order == MatrixOrderAppend)
        cairo_matrix_multiply (&mat, brush->transform, matrix);
        cairo_matrix_multiply (mat, brush->transform, matrix);
    else
    else {
	cairo_matrix_destroy(mat);
        return InvalidParameter;
        return InvalidParameter;
    }
    *(brush->transform) = mat;
    brush->transform = mat;
    return Ok;
    return Ok;
}
}
 Lines 530-540    Link Here 
    if (order == MatrixOrderAppend) {
    if (order == MatrixOrderAppend) {
        cairo_matrix_translate (brush->transform, dx, dy);
        cairo_matrix_translate (brush->transform, dx, dy);
    } else if (order == MatrixOrderPrepend) {
    } else if (order == MatrixOrderPrepend) {
        cairo_matrix_t mat, matres;
        cairo_matrix_t *mat, *matres;
        cairo_matrix_set_identity (&mat);
        cairo_matrix_translate (&mat, dx, dy);
	mat = cairo_matrix_create();
        cairo_matrix_multiply (&matres, &mat, brush->transform);
	matres = cairo_matrix_create();
        *(brush->transform) = matres;
        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 {
    } else {
        return InvalidParameter;
        return InvalidParameter;
    }
    }
 Lines 550-560    Link Here 
    if (order == MatrixOrderAppend) {
    if (order == MatrixOrderAppend) {
        cairo_matrix_scale (brush->transform, sx, sy);
        cairo_matrix_scale (brush->transform, sx, sy);
    } else if (order == MatrixOrderPrepend) {
    } else if (order == MatrixOrderPrepend) {
        cairo_matrix_t mat, matres;
        cairo_matrix_t *mat, *matres;
        cairo_matrix_set_identity (&mat);
        cairo_matrix_scale (&mat, sx, sy);
	mat = cairo_matrix_create();
        cairo_matrix_multiply (&matres, &mat, brush->transform);
	matres = cairo_matrix_create();
        *(brush->transform) = matres;
        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 {
    } else {
        return InvalidParameter;
        return InvalidParameter;
    }
    }
 Lines 570-580    Link Here 
    if (order == MatrixOrderAppend) {
    if (order == MatrixOrderAppend) {
        cairo_matrix_rotate (brush->transform, angle * DEGTORAD);
        cairo_matrix_rotate (brush->transform, angle * DEGTORAD);
    } else if (order == MatrixOrderPrepend) {
    } else if (order == MatrixOrderPrepend) {
        cairo_matrix_t mat, matres;
        cairo_matrix_t *mat, *matres;
        cairo_matrix_set_identity (&mat);
        cairo_matrix_rotate (&mat, angle * DEGTORAD);
	mat = cairo_matrix_create();
        cairo_matrix_multiply (&matres, &mat, brush->transform);
	matres  = cairo_matrix_create();
        *(brush->transform) = matres;
	
        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 {
    } else {
        return InvalidParameter;
        return InvalidParameter;
    }
    }
(-) libgdiplus-1.0.5/src/pen.c (-2 / +3 lines)
 Lines 543-549    Link Here 
	g_return_val_if_fail (pen != NULL, InvalidParameter);
	g_return_val_if_fail (pen != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != 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;
	pen->changed = TRUE;
        return Ok;
        return Ok;
}
}
 Lines 554-560    Link Here 
	g_return_val_if_fail (pen != NULL, InvalidParameter);
	g_return_val_if_fail (pen != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
        *matrix = *(pen->matrix);
	cairo_matrix_copy(matrix, pen->matrix);
        return Ok;
        return Ok;
}
}
(-) libgdiplus-1.0.5/src/texturebrush.c (-2 / +3 lines)
 Lines 714-720    Link Here 
	g_return_val_if_fail (texture != NULL, InvalidParameter);
	g_return_val_if_fail (texture != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
	*matrix = *(texture->matrix);
	cairo_matrix_copy(matrix, texture->matrix);
	return Ok;
	return Ok;
}
}
 Lines 724-730    Link Here 
	g_return_val_if_fail (texture != NULL, InvalidParameter);
	g_return_val_if_fail (texture != NULL, InvalidParameter);
	g_return_val_if_fail (matrix != 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;
	texture->changed = TRUE;
	return Ok;
	return Ok;