ports/169343: [patch] graphics/cairo: add qt4 surface
Jan Beich
jbeich at tormail.org
Sat Jun 23 12:50:10 UTC 2012
>Number: 169343
>Category: ports
>Synopsis: [patch] graphics/cairo: add qt4 surface
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-ports-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Jun 23 12:50:09 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator: Jan Beich
>Release: FreeBSD 10.0-CURRENT amd64
>Organization:
>Environment:
tested with MOZ_TOOLKIT=cairo-qt using freebsd-gecko repo
https://bugs.freedesktop.org/show_bug.cgi?id=29092#c9
>Description:
>How-To-Repeat:
>Fix:
--- qt.diff begins here ---
Index: graphics/cairo/Makefile
===================================================================
RCS file: /a/.csup/ports/graphics/cairo/Makefile,v
retrieving revision 1.60
diff -u -p -r1.60 Makefile
--- graphics/cairo/Makefile 1 Jun 2012 05:19:39 -0000 1.60
+++ graphics/cairo/Makefile 20 Jun 2012 00:33:42 -0000
@@ -29,6 +29,8 @@ CONFIGURE_ARGS= --with-html-dir=${DOCSDI
--enable-tee \
--enable-gobject
USE_GNOME= gnomehack ltverhack referencehack
+USE_QT4= # empty
+QT_NONSTANDARD= yes
USE_AUTOTOOLS= libtool
USE_LDCONFIG= yes
@@ -44,6 +46,7 @@ PLIST_SUB+= X11=""
.endif
OPTIONS+= GL "Enable OpenGL Support" Off \
+ QT4 "Enable QT4 Support" Off \
XCB "Enable XCB (X C-language Binding) Support" On \
GLIB "Enable GObject Functions Feature" On
@@ -58,6 +61,15 @@ CONFIGURE_ARGS+= --disable-gl
PLIST_SUB+= GL="@comment "
.endif
+.if defined(WITH_QT4)
+CONFIGURE_ARGS+= --enable-qt
+USE_QT4+= gui
+PLIST_SUB+= QT4=""
+.else
+CONFIGURE_ARGS+= --disable-qt
+PLIST_SUB+= QT4="@comment "
+.endif
+
.if defined(WITH_XCB)
BUILD_DEPENDS+= ${LOCALBASE}/libdata/pkgconfig/xcb-renderutil.pc:${PORTSDIR}/x11/xcb-util-renderutil
RUN_DEPENDS+= ${LOCALBASE}/libdata/pkgconfig/xcb-renderutil.pc:${PORTSDIR}/x11/xcb-util-renderutil
Index: graphics/cairo/pkg-plist
===================================================================
RCS file: /a/.csup/ports/graphics/cairo/pkg-plist,v
retrieving revision 1.15
diff -u -p -r1.15 pkg-plist
--- graphics/cairo/pkg-plist 26 May 2012 03:54:11 -0000 1.15
+++ graphics/cairo/pkg-plist 19 Jun 2012 23:38:14 -0000
@@ -6,6 +6,7 @@ include/cairo/cairo-ft.h
%%GLIB%%include/cairo/cairo-gobject.h
include/cairo/cairo-pdf.h
include/cairo/cairo-ps.h
+%%QT4%%include/cairo/cairo-qt.h
include/cairo/cairo-script-interpreter.h
include/cairo/cairo-svg.h
include/cairo/cairo-tee.h
@@ -39,6 +40,7 @@ libdata/pkgconfig/cairo-ft.pc
libdata/pkgconfig/cairo-pdf.pc
libdata/pkgconfig/cairo-png.pc
libdata/pkgconfig/cairo-ps.pc
+%%QT4%%libdata/pkgconfig/cairo-qt.pc
libdata/pkgconfig/cairo-svg.pc
libdata/pkgconfig/cairo-tee.pc
%%XCB%%libdata/pkgconfig/cairo-xcb.pc
Index: graphics/cairo/files/patch-bug29092
===================================================================
RCS file: graphics/cairo/files/patch-bug29092
diff -N graphics/cairo/files/patch-bug29092
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ graphics/cairo/files/patch-bug29092 20 Jun 2012 00:40:51 -0000
@@ -0,0 +1,54 @@
+--- src/cairo-qt-surface.cpp 2010-12-25 15:21:34.000000000 +0100
++++ src/cairo-qt-surface.cpp 2011-12-20 22:59:30.000000000 +0100
+@@ -61,7 +61,9 @@
+ #include <QtGui/QX11Info>
+ #include <QtCore/QVarLengthArray>
+
+-#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
++#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0))
++#include <QtGui/QGlyphRun>
++#elif (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
+ extern void qt_draw_glyphs(QPainter *, const quint32 *glyphs, const QPointF *positions, int count);
+ #endif
+
+@@ -1370,7 +1372,39 @@
+ cairo_clip_t *clip,
+ int *remaining_glyphs)
+ {
+-#if (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
++#if (QT_VERSION >= QT_VERSION_CHECK(4, 8, 0)) && !defined(QT_NO_RAWFONT)
++ cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
++
++ // pick out the colour to use from the cairo source
++ cairo_solid_pattern_t *solid = (cairo_solid_pattern_t*) source;
++ // documentation says you have to freeze the cache, but I don't believe it
++ _cairo_scaled_font_freeze_cache(scaled_font);
++
++ QColor tempColour(solid->color.red * 255, solid->color.green * 255, solid->color.blue * 255);
++ QVector<QPointF> positions(num_glyphs);
++ QVector<unsigned int> glyphss(num_glyphs);
++ FT_Face face = cairo_ft_scaled_font_lock_face (scaled_font);
++ const FT_Size_Metrics& ftMetrics = face->size->metrics;
++ QFont font(face->family_name);
++ font.setStyleStrategy(QFont::NoFontMerging);
++ font.setBold(face->style_flags & FT_STYLE_FLAG_BOLD);
++ font.setItalic(face->style_flags & FT_STYLE_FLAG_ITALIC);
++ font.setKerning(face->face_flags & FT_FACE_FLAG_KERNING);
++ font.setPixelSize(ftMetrics.y_ppem);
++ cairo_ft_scaled_font_unlock_face(scaled_font);
++ qs->p->setFont(font);
++ qs->p->setPen(tempColour);
++ for (int currentGlyph = 0; currentGlyph < num_glyphs; currentGlyph++) {
++ positions.append(QPointF(glyphs[currentGlyph].x, glyphs[currentGlyph].y));
++ glyphss.append(glyphs[currentGlyph].index);
++ }
++ QGlyphRun qglyphs;
++ qglyphs.setGlyphIndexes(glyphss);
++ qglyphs.setPositions(positions);
++ qs->p->drawGlyphRun(QPointF(), qglyphs);
++ _cairo_scaled_font_thaw_cache(scaled_font);
++ return CAIRO_INT_STATUS_SUCCESS;
++#elif (QT_VERSION >= QT_VERSION_CHECK(4, 7, 0)) || defined(QT_GLYPHS_API_BACKPORT)
+ cairo_qt_surface_t *qs = (cairo_qt_surface_t *) abstract_surface;
+
+ // pick out the colour to use from the cairo source
--- qt.diff ends here ---
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list