Gentoo Archives: gentoo-commits

From: "Alex Alexander (wired)" <wired@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] gentoo-x86 commit in x11-libs/cairo/files: cairo-1.10.2-qt-surface.patch
Date: Sun, 29 Jan 2012 15:53:35
Message-Id: 20120129155324.97E2C2004C@flycatcher.gentoo.org
1 wired 12/01/29 15:53:24
2
3 Added: cairo-1.10.2-qt-surface.patch
4 Log:
5 revbump with patch for Qt-4.8. bug #380013
6
7 (Portage version: 2.2.0_alpha84/cvs/Linux x86_64)
8
9 Revision Changes Path
10 1.1 x11-libs/cairo/files/cairo-1.10.2-qt-surface.patch
11
12 file : http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-libs/cairo/files/cairo-1.10.2-qt-surface.patch?rev=1.1&view=markup
13 plain: http://sources.gentoo.org/viewvc.cgi/gentoo-x86/x11-libs/cairo/files/cairo-1.10.2-qt-surface.patch?rev=1.1&content-type=text/plain
14
15 Index: cairo-1.10.2-qt-surface.patch
16 ===================================================================
17 diff -ruN cairo-1.10.2-0-vanilla/src/cairo-qt-surface.cpp cairo-1.10.2/src/cairo-qt-surface.cpp
18 --- cairo-1.10.2-0-vanilla/src/cairo-qt-surface.cpp 2010-12-25 15:21:34.000000000 +0100
19 +++ cairo-1.10.2/src/cairo-qt-surface.cpp 2011-12-20 22:59:30.000000000 +0100
20 @@ -61,7 +61,9 @@
21 #include <QtGui/QX11Info>
22 #include <QtCore/QVarLengthArray>
23
24 -#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
25 +#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
26 +#include <QtGui/QGlyphRun>
27 +#elif (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
28 extern void qt_draw_glyphs(QPainter *, const quint32 *glyphs, const QPointF *positions, int count);
29 #endif
30
31 @@ -1370,7 +1372,39 @@
32 cairo_clip_t *clip,
33 int *remaining_glyphs)
34 {
35 -#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
36 +#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) && !defined(QT_NO_RAWFONT)
37 + cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
38 +
39 + // pick out the colour to use from the cairo source
40 + cairo_solid_pattern_t *solid = (cairo_solid_pattern_t*) source;
41 + // documentation says you have to freeze the cache, but I don't believe it
42 + _cairo_scaled_font_freeze_cache(scaled_font);
43 +
44 + QColor tempColour(solid->color.red * 255, solid->color.green * 255, solid->color.blue * 255);
45 + QVector<QPointF> positions(num_glyphs);
46 + QVector<unsigned int> glyphss(num_glyphs);
47 + FT_Face face = cairo_ft_scaled_font_lock_face (scaled_font);
48 + const FT_Size_Metrics& ftMetrics = face->size->metrics;
49 + QFont font(face->family_name);
50 + font.setStyleStrategy(QFont::NoFontMerging);
51 + font.setBold(face->style_flags & FT_STYLE_FLAG_BOLD);
52 + font.setItalic(face->style_flags & FT_STYLE_FLAG_ITALIC);
53 + font.setKerning(face->face_flags & FT_FACE_FLAG_KERNING);
54 + font.setPixelSize(ftMetrics.y_ppem);
55 + cairo_ft_scaled_font_unlock_face(scaled_font);
56 + qs->p->setFont(font);
57 + qs->p->setPen(tempColour);
58 + for (int currentGlyph = 0; currentGlyph < num_glyphs; currentGlyph++) {
59 + positions.append(QPointF(glyphs[currentGlyph].x, glyphs[currentGlyph].y));
60 + glyphss.append(glyphs[currentGlyph].index);
61 + }
62 + QGlyphRun qglyphs;
63 + qglyphs.setGlyphIndexes(glyphss);
64 + qglyphs.setPositions(positions);
65 + qs->p->drawGlyphRun(QPointF(), qglyphs);
66 + _cairo_scaled_font_thaw_cache(scaled_font);
67 + return CAIRO_INT_STATUS_SUCCESS;
68 +#elif (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
69 cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
70
71 // pick out the colour to use from the cairo source