Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 79559
Collapse All | Expand All

(-)libgdiplus-1.0.5/src/gdip.h (-3 / +2 lines)
Lines 20-28 Link Here
20
#include <glib.h>
20
#include <glib.h>
21
21
22
#include <cairo.h>
22
#include <cairo.h>
23
#ifndef CAIRO_HAS_XLIB_SURFACE
23
#include <cairo-ft.h>
24
#include <cairo-xlib.h>
24
#include <cairo-xlib.h>
25
#endif
26
25
27
/* mono/io-layer/uglify.h also has these typedefs.
26
/* mono/io-layer/uglify.h also has these typedefs.
28
 * To avoid a dependency on mono we have copied all
27
 * To avoid a dependency on mono we have copied all
Lines 1162-1168 Link Here
1162
int fcmp (double x1, double x2, double epsilon);
1161
int fcmp (double x1, double x2, double epsilon);
1163
float gdip_get_display_dpi();
1162
float gdip_get_display_dpi();
1164
void gdip_unitConversion(Unit fromUnit, Unit toUnit, float nSrc, float* nTrg);
1163
void gdip_unitConversion(Unit fromUnit, Unit toUnit, float nSrc, float* nTrg);
1165
int gdpi_utf8_to_glyphs (cairo_font_t* font, cairo_matrix_t matrix, const unsigned char* utf8, double	x0,
1164
int gdpi_utf8_to_glyphs (cairo_font_t* font, cairo_matrix_t* matrix, const unsigned char* utf8, double	x0,
1166
   double y0, cairo_glyph_t** glyphs, size_t* nglyphs);
1165
   double y0, cairo_glyph_t** glyphs, size_t* nglyphs);
1167
1166
1168
void gdip_font_drawunderline (GpGraphics *graphics, GpBrush *brush, float x, float y, float width);
1167
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
269
static void
269
static void
270
_install_font_matrix(cairo_matrix_t *matrix, FT_Face face)
270
_install_font_matrix(cairo_matrix_t *matrix, FT_Face face)
271
{
271
{
272
    cairo_matrix_t normalized;
272
    cairo_matrix_t* normalized = cairo_matrix_create();
273
    double scale_x, scale_y;
273
    double scale_x, scale_y;
274
    double xx, xy, yx, yy, tx, ty;
274
    double xx, xy, yx, yy, tx, ty;
275
    FT_Matrix mat;
275
    FT_Matrix mat;
276
276
277
    _gdip_cairo_matrix_compute_scale_factors (matrix, &scale_x, &scale_y);
277
    _gdip_cairo_matrix_compute_scale_factors (matrix, &scale_x, &scale_y);
278
278
279
    cairo_matrix_copy (&normalized, matrix);
279
    cairo_matrix_copy (normalized, matrix);
280
280
281
    cairo_matrix_scale (&normalized, 1.0 / scale_x, 1.0 / scale_y);
281
    cairo_matrix_scale (normalized, 1.0 / scale_x, 1.0 / scale_y);
282
    cairo_matrix_get_affine (&normalized,
282
    cairo_matrix_get_affine (normalized,
283
                             &xx /* 00 */ , &yx /* 01 */,
283
                             &xx /* 00 */ , &yx /* 01 */,
284
                             &xy /* 10 */, &yy /* 11 */,
284
                             &xy /* 10 */, &yy /* 11 */,
285
                             &tx, &ty);
285
                             &tx, &ty);
Lines 298-304 Link Here
298
298
299
int
299
int
300
gdpi_utf8_to_glyphs (cairo_font_t	*font,
300
gdpi_utf8_to_glyphs (cairo_font_t	*font,
301
                 cairo_matrix_t		matrix,
301
                 cairo_matrix_t		*matrix,
302
		 const unsigned char	*utf8,
302
		 const unsigned char	*utf8,
303
		 double			x0,
303
		 double			x0,
304
		 double			y0,
304
		 double			y0,
Lines 323-329 Link Here
323
        return 0;
323
        return 0;
324
    }
324
    }
325
325
326
    _install_font_matrix (&matrix, face);
326
    _install_font_matrix (matrix, face);
327
327
328
    for (i = 0; i < *nglyphs; i++)
328
    for (i = 0; i < *nglyphs; i++)
329
    {
329
    {
(-)libgdiplus-1.0.5/src/graphics.c (-9 / +12 lines)
Lines 448-454 Link Here
448
	g_return_val_if_fail (graphics != NULL, InvalidParameter);
448
	g_return_val_if_fail (graphics != NULL, InvalidParameter);
449
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
449
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
450
450
451
        *(graphics->copy_of_ctm) = *(matrix);
451
        graphics->copy_of_ctm = matrix;
452
        cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
452
        cairo_set_matrix (graphics->ct, graphics->copy_of_ctm);
453
        return Ok;
453
        return Ok;
454
}
454
}
Lines 1571-1586 Link Here
1571
	float			*GlyphWidths;
1571
	float			*GlyphWidths;
1572
	float			TotalWidth	= 0;
1572
	float			TotalWidth	= 0;
1573
	int			i;
1573
	int			i;
1574
	cairo_matrix_t		matrix;
1574
	cairo_matrix_t		*matrix;
1575
1575
1576
#ifdef DRAWSTRING_DEBUG
1576
#ifdef DRAWSTRING_DEBUG
1577
	printf("CalculateStringSize(font, %s, %d, details) called\n", utf8, StringDetailElements);
1577
	printf("CalculateStringSize(font, %s, %d, details) called\n", utf8, StringDetailElements);
1578
#endif
1578
#endif
1579
	Font=(cairo_font_t *)gdiFont->cairofnt;
1579
	Font=(cairo_font_t *)gdiFont->cairofnt;
1580
1580
1581
	matrix = cairo_matrix_create();
1582
1581
	/* Generate Glyhps for string utf8 */
1583
	/* Generate Glyhps for string utf8 */
1582
	cairo_font_current_transform(Font, &matrix);
1584
	cairo_font_current_transform(Font, matrix);
1583
	cairo_matrix_scale(&matrix, gdiFont->sizeInPixels, gdiFont->sizeInPixels);
1585
	cairo_matrix_scale(matrix, gdiFont->sizeInPixels, gdiFont->sizeInPixels);
1584
	gdpi_utf8_to_glyphs (Font, matrix, utf8, 0.0, 0.0, &Glyphs, &NumOfGlyphs);
1586
	gdpi_utf8_to_glyphs (Font, matrix, utf8, 0.0, 0.0, &Glyphs, &NumOfGlyphs);
1585
1587
1586
	/* FIXME - This check and the StringDetailElements argument can be removed after verification of Glyph:WChar=1:1 */
1588
	/* FIXME - This check and the StringDetailElements argument can be removed after verification of Glyph:WChar=1:1 */
Lines 1617-1623 Link Here
1617
	unsigned char		*String;		/* Holds the UTF8 version of our sanitized string */
1619
	unsigned char		*String;		/* Holds the UTF8 version of our sanitized string */
1618
	WCHAR			*CleanString;		/* Holds the unicode version of our sanitized string */
1620
	WCHAR			*CleanString;		/* Holds the unicode version of our sanitized string */
1619
	unsigned long		StringLen;		/* Length of CleanString */
1621
	unsigned long		StringLen;		/* Length of CleanString */
1620
	cairo_matrix_t		SavedMatrix;		
1622
	cairo_matrix_t		*SavedMatrix;		
1621
	GDIPCONST WCHAR		*Src;
1623
	GDIPCONST WCHAR		*Src;
1622
	WCHAR	 		*Dest;
1624
	WCHAR	 		*Dest;
1623
	GpStringFormat		*fmt;
1625
	GpStringFormat		*fmt;
Lines 1683-1694 Link Here
1683
	/*
1685
	/*
1684
	   Get font size information; how expensive is the cairo stuff here? 
1686
	   Get font size information; how expensive is the cairo stuff here? 
1685
	*/
1687
	*/
1688
	SavedMatrix = cairo_matrix_create();
1686
	cairo_save (graphics->ct);
1689
	cairo_save (graphics->ct);
1687
	cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
1690
	cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
1688
	cairo_font_current_transform(font->cairofnt, &SavedMatrix);
1691
	cairo_font_current_transform(font->cairofnt, SavedMatrix);
1689
	cairo_scale_font (graphics->ct, font->sizeInPixels);
1692
	cairo_scale_font (graphics->ct, font->sizeInPixels);
1690
	cairo_current_font_extents (graphics->ct, &FontExtent);
1693
	cairo_current_font_extents (graphics->ct, &FontExtent);
1691
	cairo_font_set_transform(font->cairofnt, &SavedMatrix);
1694
	cairo_font_set_transform(font->cairofnt, SavedMatrix);
1692
	cairo_restore (graphics->ct);
1695
	cairo_restore (graphics->ct);
1693
	LineHeight=FontExtent.ascent;
1696
	LineHeight=FontExtent.ascent;
1694
#ifdef DRAWSTRING_DEBUG
1697
#ifdef DRAWSTRING_DEBUG
Lines 2170-2176 Link Here
2170
		/* Setup cairo */
2173
		/* Setup cairo */
2171
		/* Save the font matrix */
2174
		/* Save the font matrix */
2172
		cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
2175
		cairo_set_font (graphics->ct, (cairo_font_t*) font->cairofnt);
2173
		cairo_font_current_transform(font->cairofnt, &SavedMatrix);
2176
		cairo_font_current_transform(font->cairofnt, SavedMatrix);
2174
2177
2175
		if (brush) {
2178
		if (brush) {
2176
			gdip_brush_setup (graphics, (GpBrush *)brush);
2179
			gdip_brush_setup (graphics, (GpBrush *)brush);
Lines 2307-2313 Link Here
2307
			}
2310
			}
2308
		}
2311
		}
2309
2312
2310
		cairo_font_set_transform(font->cairofnt, &SavedMatrix);
2313
		cairo_font_set_transform(font->cairofnt, SavedMatrix);
2311
		cairo_restore (graphics->ct);
2314
		cairo_restore (graphics->ct);
2312
	}
2315
	}
2313
2316
(-)libgdiplus-1.0.5/src/lineargradientbrush.c (-2 / +4 lines)
Lines 1189-1195 Link Here
1189
	if (brush->presetColors->count >= 2)
1189
	if (brush->presetColors->count >= 2)
1190
		return WrongState;
1190
		return WrongState;
1191
1191
1192
	*matrix = *(brush->matrix);
1192
	matrix = brush->matrix;
1193
1193
1194
	return Ok;
1194
	return Ok;
1195
}
1195
}
Lines 1200-1206 Link Here
1200
	g_return_val_if_fail (brush != NULL, InvalidParameter);
1200
	g_return_val_if_fail (brush != NULL, InvalidParameter);
1201
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
1201
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
1202
1202
1203
	*(brush->matrix) = *matrix;
1203
	brush->matrix = cairo_matrix_create();
1204
	g_return_val_if_fail (brush->matrix != NULL, OutOfMemory);
1205
	cairo_matrix_copy(brush->matrix, matrix);
1204
	brush->changed = TRUE;
1206
	brush->changed = TRUE;
1205
	return Ok;
1207
	return Ok;
1206
}
1208
}
(-)libgdiplus-1.0.5/src/matrix.c (-12 / +28 lines)
Lines 169-177 Link Here
169
GpStatus
169
GpStatus
170
GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order)
170
GdipTranslateMatrix (GpMatrix *matrix, float offsetX, float offsetY, GpMatrixOrder order)
171
{
171
{
172
        GpMatrix tmp;
172
	cairo_matrix_t *tmp;
173
        cairo_matrix_set_affine (&tmp, 1, 0, 0, 1, offsetX, offsetY);
173
        GpStatus s;
174
        GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
174
175
	tmp = cairo_matrix_create();
176
        cairo_matrix_set_affine (tmp, 1, 0, 0, 1, offsetX, offsetY);
177
        s = GdipMultiplyMatrix (matrix, tmp, order);
178
	cairo_matrix_destroy(tmp); 
175
179
176
        return s;
180
        return s;
177
}
181
}
Lines 179-187 Link Here
179
GpStatus
183
GpStatus
180
GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order)
184
GdipScaleMatrix (GpMatrix *matrix, float scaleX, float scaleY, GpMatrixOrder order)
181
{
185
{
182
        GpMatrix tmp;
186
	cairo_matrix_t *tmp;
183
        cairo_matrix_set_affine (&tmp, scaleX, 0, 0, scaleY, 0, 0);
187
        GpStatus s;
184
        GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);        
188
189
	tmp = cairo_matrix_create();
190
        cairo_matrix_set_affine (tmp, scaleX, 0, 0, scaleY, 0, 0);
191
        s = GdipMultiplyMatrix (matrix, tmp, order);        
192
	cairo_matrix_destroy(tmp);
185
193
186
        return s;
194
        return s;
187
}
195
}
Lines 189-198 Link Here
189
GpStatus
197
GpStatus
190
GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order)
198
GdipRotateMatrix (GpMatrix *matrix, float angle, GpMatrixOrder order)
191
{
199
{
192
	GpMatrix tmp;
200
	cairo_matrix_t *tmp;
201
        GpStatus s;
193
        float rad = angle * DEGTORAD;
202
        float rad = angle * DEGTORAD;
194
        cairo_matrix_set_affine (&tmp, cos (rad), sin (rad), -sin (rad), cos (rad), 0, 0);
203
195
        GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
204
	tmp = cairo_matrix_create();
205
        cairo_matrix_set_affine (tmp, cos (rad), sin (rad), -sin (rad), cos (rad), 0, 0);
206
        s = GdipMultiplyMatrix (matrix, tmp, order);
207
	cairo_matrix_destroy(tmp);
196
208
197
        return s;
209
        return s;
198
}
210
}
Lines 200-208 Link Here
200
GpStatus
212
GpStatus
201
GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order)
213
GdipShearMatrix (GpMatrix *matrix, float shearX, float shearY, GpMatrixOrder order)
202
{
214
{
203
        GpMatrix tmp;
215
	cairo_matrix_t *tmp;
204
        cairo_matrix_set_affine (&tmp, 1, shearX, shearY, 1, 0, 0);
216
        GpStatus s;
205
        GpStatus s = GdipMultiplyMatrix (matrix, &tmp, order);
217
218
	tmp = cairo_matrix_create();
219
        cairo_matrix_set_affine (tmp, 1, shearX, shearY, 1, 0, 0);
220
        s = GdipMultiplyMatrix (matrix, tmp, order);
221
	cairo_matrix_destroy(tmp);
206
222
207
        return s;
223
        return s;
208
}
224
}
(-)libgdiplus-1.0.5/src/pathgradientbrush.c (-23 / +43 lines)
Lines 481-487 Link Here
481
    g_return_val_if_fail (brush != NULL, InvalidParameter);
481
    g_return_val_if_fail (brush != NULL, InvalidParameter);
482
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
482
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
483
483
484
    *matrix = *(brush->transform);
484
    cairo_matrix_copy(matrix, brush->transform);
485
    return Ok;
485
    return Ok;
486
}
486
}
487
487
Lines 491-497 Link Here
491
    g_return_val_if_fail (brush != NULL, InvalidParameter);
491
    g_return_val_if_fail (brush != NULL, InvalidParameter);
492
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
492
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
493
493
494
    *(brush->transform) = *matrix;
494
    brush->transform = matrix;
495
    return Ok;
495
    return Ok;
496
}
496
}
497
497
Lines 506-524 Link Here
506
GpStatus
506
GpStatus
507
GdipMultiplyPathGradientTransform (GpPathGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
507
GdipMultiplyPathGradientTransform (GpPathGradient *brush, GDIPCONST GpMatrix *matrix, GpMatrixOrder order)
508
{
508
{
509
    cairo_matrix_t mat;
509
    cairo_matrix_t *mat;
510
    g_return_val_if_fail (brush != NULL, InvalidParameter);
510
    g_return_val_if_fail (brush != NULL, InvalidParameter);
511
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
511
    g_return_val_if_fail (matrix != NULL, InvalidParameter);
512
512
513
    mat = cairo_matrix_create();
514
513
    if (order == MatrixOrderPrepend)
515
    if (order == MatrixOrderPrepend)
514
        cairo_matrix_multiply (&mat, matrix, brush->transform);
516
        cairo_matrix_multiply (mat, matrix, brush->transform);
515
    else if (order == MatrixOrderAppend)
517
    else if (order == MatrixOrderAppend)
516
        cairo_matrix_multiply (&mat, brush->transform, matrix);
518
        cairo_matrix_multiply (mat, brush->transform, matrix);
517
    else
519
    else {
520
	cairo_matrix_destroy(mat);
518
        return InvalidParameter;
521
        return InvalidParameter;
522
    }
519
523
520
    *(brush->transform) = mat;
524
    brush->transform = mat;
521
522
    return Ok;
525
    return Ok;
523
}
526
}
524
527
Lines 530-540 Link Here
530
    if (order == MatrixOrderAppend) {
533
    if (order == MatrixOrderAppend) {
531
        cairo_matrix_translate (brush->transform, dx, dy);
534
        cairo_matrix_translate (brush->transform, dx, dy);
532
    } else if (order == MatrixOrderPrepend) {
535
    } else if (order == MatrixOrderPrepend) {
533
        cairo_matrix_t mat, matres;
536
        cairo_matrix_t *mat, *matres;
534
        cairo_matrix_set_identity (&mat);
537
535
        cairo_matrix_translate (&mat, dx, dy);
538
	mat = cairo_matrix_create();
536
        cairo_matrix_multiply (&matres, &mat, brush->transform);
539
	matres = cairo_matrix_create();
537
        *(brush->transform) = matres;
540
541
        cairo_matrix_set_identity (mat);
542
        cairo_matrix_translate (mat, dx, dy);
543
        cairo_matrix_multiply (matres, mat, brush->transform);
544
        brush->transform = matres;
545
546
	cairo_matrix_destroy(mat);
538
    } else {
547
    } else {
539
        return InvalidParameter;
548
        return InvalidParameter;
540
    }
549
    }
Lines 550-560 Link Here
550
    if (order == MatrixOrderAppend) {
559
    if (order == MatrixOrderAppend) {
551
        cairo_matrix_scale (brush->transform, sx, sy);
560
        cairo_matrix_scale (brush->transform, sx, sy);
552
    } else if (order == MatrixOrderPrepend) {
561
    } else if (order == MatrixOrderPrepend) {
553
        cairo_matrix_t mat, matres;
562
        cairo_matrix_t *mat, *matres;
554
        cairo_matrix_set_identity (&mat);
563
555
        cairo_matrix_scale (&mat, sx, sy);
564
	mat = cairo_matrix_create();
556
        cairo_matrix_multiply (&matres, &mat, brush->transform);
565
	matres = cairo_matrix_create();
557
        *(brush->transform) = matres;
566
        cairo_matrix_set_identity (mat);
567
        cairo_matrix_scale (mat, sx, sy);
568
        cairo_matrix_multiply (matres, mat, brush->transform);
569
        brush->transform = matres;
570
571
	cairo_matrix_destroy(mat);
558
    } else {
572
    } else {
559
        return InvalidParameter;
573
        return InvalidParameter;
560
    }
574
    }
Lines 570-580 Link Here
570
    if (order == MatrixOrderAppend) {
584
    if (order == MatrixOrderAppend) {
571
        cairo_matrix_rotate (brush->transform, angle * DEGTORAD);
585
        cairo_matrix_rotate (brush->transform, angle * DEGTORAD);
572
    } else if (order == MatrixOrderPrepend) {
586
    } else if (order == MatrixOrderPrepend) {
573
        cairo_matrix_t mat, matres;
587
        cairo_matrix_t *mat, *matres;
574
        cairo_matrix_set_identity (&mat);
588
575
        cairo_matrix_rotate (&mat, angle * DEGTORAD);
589
	mat = cairo_matrix_create();
576
        cairo_matrix_multiply (&matres, &mat, brush->transform);
590
	matres  = cairo_matrix_create();
577
        *(brush->transform) = matres;
591
	
592
        cairo_matrix_set_identity (mat);
593
        cairo_matrix_rotate (mat, angle * DEGTORAD);
594
        cairo_matrix_multiply (matres, mat, brush->transform);
595
        brush->transform = matres;
596
597
	cairo_matrix_destroy(mat);
578
    } else {
598
    } else {
579
        return InvalidParameter;
599
        return InvalidParameter;
580
    }
600
    }
(-)libgdiplus-1.0.5/src/pen.c (-2 / +3 lines)
Lines 543-549 Link Here
543
	g_return_val_if_fail (pen != NULL, InvalidParameter);
543
	g_return_val_if_fail (pen != NULL, InvalidParameter);
544
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
544
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
545
545
546
        *(pen->matrix) = *matrix;
546
        pen->matrix = cairo_matrix_create();
547
	cairo_matrix_copy(pen->matrix, matrix);
547
	pen->changed = TRUE;
548
	pen->changed = TRUE;
548
        return Ok;
549
        return Ok;
549
}
550
}
Lines 554-560 Link Here
554
	g_return_val_if_fail (pen != NULL, InvalidParameter);
555
	g_return_val_if_fail (pen != NULL, InvalidParameter);
555
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
556
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
556
557
557
        *matrix = *(pen->matrix);
558
	cairo_matrix_copy(matrix, pen->matrix);
558
        return Ok;
559
        return Ok;
559
}
560
}
560
561
(-)libgdiplus-1.0.5/src/texturebrush.c (-2 / +3 lines)
Lines 714-720 Link Here
714
	g_return_val_if_fail (texture != NULL, InvalidParameter);
714
	g_return_val_if_fail (texture != NULL, InvalidParameter);
715
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
715
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
716
716
717
	*matrix = *(texture->matrix);
717
	cairo_matrix_copy(matrix, texture->matrix);
718
	return Ok;
718
	return Ok;
719
}
719
}
720
720
Lines 724-730 Link Here
724
	g_return_val_if_fail (texture != NULL, InvalidParameter);
724
	g_return_val_if_fail (texture != NULL, InvalidParameter);
725
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
725
	g_return_val_if_fail (matrix != NULL, InvalidParameter);
726
726
727
	*(texture->matrix) = *matrix;
727
        texture->matrix = cairo_matrix_create();
728
        cairo_matrix_copy(texture->matrix, matrix);
728
	texture->changed = TRUE;
729
	texture->changed = TRUE;
729
730
730
	return Ok;
731
	return Ok;

Return to bug 79559