commit 1d3dbd49d92f5579bcb985dfbdcea2ad667f7041 Author: Jakub Bogusz <qbo...@pld-linux.org> Date: Sun Oct 21 20:57:53 2018 +0200
- updated to 1.16.0 - updated mingw32 patch - removed obsolete add-cairo-API-to-setup-Win32-surface-for-HDC patch - added mingw32-gl patch and gl bcond ...-cairo-API-to-setup-Win32-surface-for-HDC.patch | 138 ------------------ cairo-mingw32-gl.patch | 158 +++++++++++++++++++++ cairo-mingw32.patch | 38 +++++ crossmingw32-cairo.spec | 25 ++-- 4 files changed, 212 insertions(+), 147 deletions(-) --- diff --git a/crossmingw32-cairo.spec b/crossmingw32-cairo.spec index 0728e83..8bfcdff 100644 --- a/crossmingw32-cairo.spec +++ b/crossmingw32-cairo.spec @@ -1,21 +1,26 @@ +# +# Conditional build: +%bcond_with gl # OpenGL surface backend + Summary: Cairo - multi-platform 2D graphics library - cross MinGW32 version Summary(pl.UTF-8): Cairo - wieloplatformowa biblioteka graficzna 2D - skrośna wersja MinGW32 %define realname cairo Name: crossmingw32-%{realname} -Version: 1.14.12 -Release: 2 +Version: 1.16.0 +Release: 1 License: LGPL v2.1 or MPL v1.1 Group: Development/Libraries Source0: https://www.cairographics.org/releases/%{realname}-%{version}.tar.xz -# Source0-md5: 9f0db9dbfca0966be8acd682e636d165 +# Source0-md5: f19e0353828269c22bd72e271243a552 Patch0: cairo-link.patch Patch1: cairo-mingw32.patch -Patch2: cairo-add-cairo-API-to-setup-Win32-surface-for-HDC.patch +# https://gitlab.freedesktop.org/cairo/cairo/issues/204 +Patch2: cairo-mingw32-gl.patch URL: https://www.cairographics.org/ BuildRequires: autoconf >= 2.63 BuildRequires: automake >= 1:1.11 BuildRequires: crossmingw32-fontconfig >= 2.2.95 -BuildRequires: crossmingw32-freetype >= 2.3.0 +BuildRequires: crossmingw32-freetype >= 2.5.1 BuildRequires: crossmingw32-glib2 >= 2.14 BuildRequires: crossmingw32-libpng BuildRequires: crossmingw32-pixman >= 0.30.0 @@ -23,7 +28,7 @@ BuildRequires: crossmingw32-zlib BuildRequires: libtool >= 2:2.2 BuildRequires: pkgconfig >= 1:0.18 Requires: crossmingw32-fontconfig >= 2.2.95 -Requires: crossmingw32-freetype >= 2.3.0 +Requires: crossmingw32-freetype >= 2.5.1 Requires: crossmingw32-libpng Requires: crossmingw32-pixman >= 0.30.0 BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) @@ -102,7 +107,7 @@ Summary: DLL Cairo library for Windows Summary(pl.UTF-8): Biblioteka DLL Cairo dla Windows Group: Applications/Emulators Requires: crossmingw32-fontconfig-dll >= 2.2.95 -Requires: crossmingw32-freetype-dll >= 2.3.0 +Requires: crossmingw32-freetype-dll >= 2.5.1 Requires: crossmingw32-libpng-dll Requires: crossmingw32-pixman-dll >= 0.30.0 @@ -171,8 +176,8 @@ export PKG_CONFIG_LIBDIR=%{_prefix}/lib/pkgconfig --disable-gtk-doc \ --disable-silent-rules \ --disable-xlib \ - --disable-xlib-render \ - --enable-freetype \ + --enable-ft \ + %{?with_gl:--enable-gl} \ --enable-pdf \ --enable-png \ --enable-ps \ @@ -214,12 +219,14 @@ rm -rf $RPM_BUILD_ROOT %{_pkgconfigdir}/cairo.pc %{_pkgconfigdir}/cairo-fc.pc %{_pkgconfigdir}/cairo-ft.pc +%{?with_gl:%{_pkgconfigdir}/cairo-gl.pc} %{_pkgconfigdir}/cairo-pdf.pc %{_pkgconfigdir}/cairo-png.pc %{_pkgconfigdir}/cairo-ps.pc %{_pkgconfigdir}/cairo-script.pc %{_pkgconfigdir}/cairo-svg.pc %{_pkgconfigdir}/cairo-tee.pc +%{?with_gl:%{_pkgconfigdir}/cairo-wgl.pc} %{_pkgconfigdir}/cairo-win32.pc %{_pkgconfigdir}/cairo-win32-font.pc %{_pkgconfigdir}/cairo-xml.pc diff --git a/cairo-add-cairo-API-to-setup-Win32-surface-for-HDC.patch b/cairo-add-cairo-API-to-setup-Win32-surface-for-HDC.patch deleted file mode 100644 index 70d90ff..0000000 --- a/cairo-add-cairo-API-to-setup-Win32-surface-for-HDC.patch +++ /dev/null @@ -1,138 +0,0 @@ -From 16898ba11b4d6e9e2e64bb2d02d0fb5adbe266e2 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?=D0=A0=D1=83=D1=81=D0=BB=D0=B0=D0=BD=20=D0=98=D0=B6=D0=B1?= - =?UTF-8?q?=D1=83=D0=BB=D0=B0=D1=82=D0=BE=D0=B2?= <lrn1...@gmail.com> -Date: Thu, 26 Mar 2015 19:33:43 +0000 -Subject: win32: Add cairo API to set up a Win32 surface for an HDC with an - alpha channel. -MIME-Version: 1.0 -Content-Type: text/plain; charset=UTF-8 -Content-Transfer-Encoding: 8bit - -Signed-off-by: Руслан Ижбулатов <lrn1...@gmail.com> -Reviewed-by: Bryce Harrington <br...@osg.samsung.com> - -diff --git a/src/cairo-win32.h b/src/cairo-win32.h -index 3d2e1c6..db4cac6 100644 ---- a/src/cairo-win32.h -+++ b/src/cairo-win32.h -@@ -49,6 +49,10 @@ cairo_public cairo_surface_t * - cairo_win32_surface_create (HDC hdc); - - cairo_public cairo_surface_t * -+cairo_win32_surface_create_with_format (HDC hdc, -+ cairo_format_t format); -+ -+cairo_public cairo_surface_t * - cairo_win32_printing_surface_create (HDC hdc); - - cairo_public cairo_surface_t * -diff --git a/src/win32/cairo-win32-display-surface.c b/src/win32/cairo-win32-display-surface.c -index 965f2c4..1571480 100644 ---- a/src/win32/cairo-win32-display-surface.c -+++ b/src/win32/cairo-win32-display-surface.c -@@ -917,31 +917,41 @@ static const cairo_surface_backend_t cairo_win32_display_surface_backend = { - */ - - /** -- * cairo_win32_surface_create: -+ * cairo_win32_surface_create_with_format: - * @hdc: the DC to create a surface for -+ * @format: format of pixels in the surface to create - * - * Creates a cairo surface that targets the given DC. The DC will be - * queried for its initial clip extents, and this will be used as the -- * size of the cairo surface. The resulting surface will always be of -- * format %CAIRO_FORMAT_RGB24; should you need another surface format, -- * you will need to create one through -- * cairo_win32_surface_create_with_dib(). -+ * size of the cairo surface. - * -- * Return value: the newly created surface -+ * Supported formats are: -+ * %CAIRO_FORMAT_ARGB32 -+ * %CAIRO_FORMAT_RGB24 - * -- * Since: 1.0 -+ * Note: @format only tells cairo how to draw on the surface, not what -+ * the format of the surface is. Namely, cairo does not (and cannot) -+ * check that @hdc actually supports alpha-transparency. -+ * -+ * Return value: the newly created surface, NULL on failure -+ * -+ * Since: 1.14.3 - **/ - cairo_surface_t * --cairo_win32_surface_create (HDC hdc) -+cairo_win32_surface_create_with_format (HDC hdc, cairo_format_t format) - { - cairo_win32_display_surface_t *surface; - -- cairo_format_t format; - cairo_status_t status; - cairo_device_t *device; - -- /* Assume that everything coming in as a HDC is RGB24 */ -- format = CAIRO_FORMAT_RGB24; -+ switch (format) { -+ default: -+ return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT)); -+ case CAIRO_FORMAT_ARGB32: -+ case CAIRO_FORMAT_RGB24: -+ break; -+ } - - surface = malloc (sizeof (*surface)); - if (surface == NULL) -@@ -977,6 +987,28 @@ cairo_win32_surface_create (HDC hdc) - } - - /** -+ * cairo_win32_surface_create: -+ * @hdc: the DC to create a surface for -+ * -+ * Creates a cairo surface that targets the given DC. The DC will be -+ * queried for its initial clip extents, and this will be used as the -+ * size of the cairo surface. The resulting surface will always be of -+ * format %CAIRO_FORMAT_RGB24; should you need another surface format, -+ * you will need to create one through -+ * cairo_win32_surface_create_with_format() or -+ * cairo_win32_surface_create_with_dib(). -+ * -+ * Return value: the newly created surface, NULL on failure -+ * -+ * Since: 1.0 -+ **/ -+cairo_surface_t * -+cairo_win32_surface_create (HDC hdc) -+{ -+ return cairo_win32_surface_create_with_format (hdc, CAIRO_FORMAT_RGB24); -+} -+ -+/** - * cairo_win32_surface_create_with_dib: - * @format: format of pixels in the surface to create - * @width: width of the surface, in pixels -@@ -1027,12 +1059,16 @@ cairo_win32_surface_create_with_ddb (HDC hdc, - HDC screen_dc, ddb_dc; - HBITMAP saved_dc_bitmap; - -- if (format != CAIRO_FORMAT_RGB24) -+ switch (format) { -+ default: -+/* XXX handle these eventually */ -+ case CAIRO_FORMAT_A8: -+ case CAIRO_FORMAT_A1: - return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT)); --/* XXX handle these eventually -- format != CAIRO_FORMAT_A8 || -- format != CAIRO_FORMAT_A1) --*/ -+ case CAIRO_FORMAT_ARGB32: -+ case CAIRO_FORMAT_RGB24: -+ break; -+ } - - if (!hdc) { - screen_dc = GetDC (NULL); --- -cgit v0.10.2 diff --git a/cairo-mingw32-gl.patch b/cairo-mingw32-gl.patch new file mode 100644 index 0000000..af0eb92 --- /dev/null +++ b/cairo-mingw32-gl.patch @@ -0,0 +1,158 @@ +--- cairo-1.16.0/src/cairo-gl-composite.c.orig 2018-10-21 18:12:52.400945600 +0200 ++++ cairo-1.16.0/src/cairo-gl-composite.c 2018-10-21 18:14:57.924277503 +0200 +@@ -340,7 +340,7 @@ _cairo_gl_context_setup_operand (cairo_g + case CAIRO_GL_OPERAND_CONSTANT: + break; + case CAIRO_GL_OPERAND_TEXTURE: +- glActiveTexture (GL_TEXTURE0 + tex_unit); ++ ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit); + glBindTexture (ctx->tex_target, operand->texture.tex); + _cairo_gl_texture_set_extend (ctx, ctx->tex_target, + operand->texture.attributes.extend); +@@ -358,7 +358,7 @@ _cairo_gl_context_setup_operand (cairo_g + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_A0: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_NONE: + case CAIRO_GL_OPERAND_RADIAL_GRADIENT_EXT: +- glActiveTexture (GL_TEXTURE0 + tex_unit); ++ ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit); + glBindTexture (ctx->tex_target, operand->gradient.gradient->tex); + _cairo_gl_texture_set_extend (ctx, ctx->tex_target, operand->gradient.extend); + _cairo_gl_texture_set_filter (ctx, ctx->tex_target, CAIRO_FILTER_BILINEAR); +@@ -481,9 +481,9 @@ _cairo_gl_set_operator (cairo_gl_context + } + + if (ctx->current_target->base.content == CAIRO_CONTENT_ALPHA) { +- glBlendFuncSeparate (GL_ZERO, GL_ZERO, src_factor, dst_factor); ++ ctx->dispatch.BlendFuncSeparate (GL_ZERO, GL_ZERO, src_factor, dst_factor); + } else if (ctx->current_target->base.content == CAIRO_CONTENT_COLOR) { +- glBlendFuncSeparate (src_factor, dst_factor, GL_ONE, GL_ONE); ++ ctx->dispatch.BlendFuncSeparate (src_factor, dst_factor, GL_ONE, GL_ONE); + } else { + glBlendFunc (src_factor, dst_factor); + } +--- cairo-1.16.0/src/cairo-gl-device.c.orig 2018-10-21 18:12:52.400945600 +0200 ++++ cairo-1.16.0/src/cairo-gl-device.c 2018-10-21 18:16:20.617609890 +0200 +@@ -341,9 +341,9 @@ _cairo_gl_context_activate (cairo_gl_con + _cairo_gl_composite_flush (ctx); + _cairo_gl_context_destroy_operand (ctx, ctx->max_textures - 1); + } +- glActiveTexture (ctx->max_textures - 1); ++ ctx->dispatch.ActiveTexture (ctx->max_textures - 1); + } else { +- glActiveTexture (GL_TEXTURE0 + tex_unit); ++ ctx->dispatch.ActiveTexture (GL_TEXTURE0 + tex_unit); + } + } + +diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-dispatch-private.h cairo-1.12.16.new/src/cairo-gl-dispatch-private.h +--- cairo-1.12.16.old/src/cairo-gl-dispatch-private.h 2013-08-26 15:07:21 +0000 ++++ cairo-1.12.16.new/src/cairo-gl-dispatch-private.h 2014-08-02 14:58:08 +0000 +@@ -59,6 +59,16 @@ typedef struct _cairo_gl_dispatch_entry + offsetof(cairo_gl_dispatch_t, name)} + #define DISPATCH_ENTRY_LAST { { NULL, NULL, NULL }, 0 } + ++cairo_private cairo_gl_dispatch_entry_t dispatch_multitexture_entries[] = { ++ DISPATCH_ENTRY_ARB (ActiveTexture), ++ DISPATCH_ENTRY_LAST ++}; ++ ++cairo_private cairo_gl_dispatch_entry_t dispatch_blendfuncseparate_entries[] = { ++ DISPATCH_ENTRY_EXT (BlendFuncSeparate), ++ DISPATCH_ENTRY_LAST ++}; ++ + cairo_private cairo_gl_dispatch_entry_t dispatch_buffers_entries[] = { + DISPATCH_ENTRY_ARB (GenBuffers), + DISPATCH_ENTRY_ARB (BindBuffer), +diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-dispatch.c cairo-1.12.16.new/src/cairo-gl-dispatch.c +--- cairo-1.12.16.old/src/cairo-gl-dispatch.c 2013-08-26 15:07:21 +0000 ++++ cairo-1.12.16.new/src/cairo-gl-dispatch.c 2014-08-02 15:00:10 +0000 +@@ -226,6 +226,45 @@ _cairo_gl_dispatch_init_multisampling (c + return CAIRO_STATUS_SUCCESS; + } + ++static cairo_status_t ++_cairo_gl_dispatch_init_multitexture (cairo_gl_dispatch_t *dispatch, ++ cairo_gl_get_proc_addr_func_t get_proc_addr, ++ int gl_version, ++ cairo_gl_flavor_t gl_flavor) ++{ ++ cairo_gl_dispatch_name_t dispatch_name = CAIRO_GL_DISPATCH_NAME_EXT; ++ ++ if (gl_version >= CAIRO_GL_VERSION_ENCODE (1, 3)) ++ dispatch_name = CAIRO_GL_DISPATCH_NAME_CORE; ++ else if (!_cairo_gl_has_extension ("GL_ARB_multitexture")) ++ return CAIRO_STATUS_DEVICE_ERROR; ++ ++ _cairo_gl_dispatch_init_entries (dispatch, get_proc_addr, ++ dispatch_multitexture_entries, ++ dispatch_name); ++ return CAIRO_STATUS_SUCCESS; ++} ++ ++static cairo_status_t ++_cairo_gl_dispatch_init_blendfuncseparate (cairo_gl_dispatch_t *dispatch, ++ cairo_gl_get_proc_addr_func_t get_proc_addr, ++ int gl_version, ++ cairo_gl_flavor_t gl_flavor) ++{ ++ cairo_gl_dispatch_name_t dispatch_name = CAIRO_GL_DISPATCH_NAME_EXT; ++ ++ if (gl_version >= CAIRO_GL_VERSION_ENCODE (1, 4)) ++ { ++ dispatch_name = CAIRO_GL_DISPATCH_NAME_CORE; ++ } else if (!_cairo_gl_has_extension ("GL_EXT_blend_func_separate")) ++ return CAIRO_STATUS_DEVICE_ERROR; ++ ++ _cairo_gl_dispatch_init_entries (dispatch, get_proc_addr, ++ dispatch_blendfuncseparate_entries, ++ dispatch_name); ++ return CAIRO_STATUS_SUCCESS; ++} ++ + cairo_status_t + _cairo_gl_dispatch_init (cairo_gl_dispatch_t *dispatch, + cairo_gl_get_proc_addr_func_t get_proc_addr) +@@ -257,5 +296,15 @@ _cairo_gl_dispatch_init (cairo_gl_dispat + if (status != CAIRO_STATUS_SUCCESS) + return status; + ++ status = _cairo_gl_dispatch_init_multitexture (dispatch, get_proc_addr, ++ gl_version, gl_flavor); ++ if (status != CAIRO_STATUS_SUCCESS) ++ return status; ++ ++ status = _cairo_gl_dispatch_init_blendfuncseparate (dispatch, get_proc_addr, ++ gl_version, gl_flavor); ++ if (status != CAIRO_STATUS_SUCCESS) ++ return status; ++ + return CAIRO_STATUS_SUCCESS; + } +diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-glyphs.c cairo-1.12.16.new/src/cairo-gl-glyphs.c +--- cairo-1.12.16.old/src/cairo-gl-glyphs.c 2013-08-26 15:07:21 +0000 ++++ cairo-1.12.16.new/src/cairo-gl-glyphs.c 2014-08-01 21:45:43 +0000 +@@ -130,7 +130,7 @@ _cairo_gl_glyph_cache_add_glyph (cairo_g + return status; + + /* XXX: Make sure we use the mask texture. This should work automagically somehow */ +- glActiveTexture (GL_TEXTURE1); ++ ctx->dispatch.ActiveTexture (GL_TEXTURE1); + status = _cairo_gl_surface_draw_image (cache->surface, glyph_surface, + 0, 0, + glyph_surface->width, glyph_surface->height, +diff -x '*.am' -x '*.in' -rupwN cairo-1.12.16.old/src/cairo-gl-private.h cairo-1.12.16.new/src/cairo-gl-private.h +--- cairo-1.12.16.old/src/cairo-gl-private.h 2013-08-26 15:07:21 +0000 ++++ cairo-1.12.16.new/src/cairo-gl-private.h 2014-08-01 21:35:01 +0000 +@@ -325,6 +325,11 @@ typedef struct _cairo_gl_dispatch { + void (*FramebufferTexture2DMultisample) (GLenum target, GLenum attachment, + GLenum textarget, GLuint texture, + GLint level, GLsizei samples); ++ ++ /* Misc */ ++ void (*ActiveTexture) (GLenum texture); ++ void (*BlendFuncSeparate) (GLenum sfactorRGB, GLenum dfactorRGB, ++ GLenum sfactorAlpha, GLenum dfactorAlpha); + } cairo_gl_dispatch_t; + + struct _cairo_gl_context { diff --git a/cairo-mingw32.patch b/cairo-mingw32.patch index f38cd09..6a5eb17 100644 --- a/cairo-mingw32.patch +++ b/cairo-mingw32.patch @@ -30,3 +30,41 @@ #define access _access #define fdopen _fdopen #define hypot _hypot +--- cairo-1.16.0/configure.ac.orig 2018-10-21 16:21:17.304355378 +0200 ++++ cairo-1.16.0/configure.ac 2018-10-21 17:09:07.484322608 +0200 +@@ -334,7 +334,11 @@ + AC_CHECK_HEADER(GL/gl.h,, [use_gl="no (gl.pc nor OpenGL headers not found)"]) + if test "x$use_gl" = "xyes"; then + gl_NONPKGCONFIG_CFLAGS= ++ if test "x$have_windows" = xyes; then ++ gl_NONPKGCONFIG_LIBS="-lopengl32" ++ else + gl_NONPKGCONFIG_LIBS="-lGL" ++ fi + fi]) + + if test "x$have_dl" = "xyes" -a "x$have_dlsym" = "xyes"; then +--- cairo-1.16.0/test/Makefile.am.orig 2018-08-17 03:10:53.000000000 +0200 ++++ cairo-1.16.0/test/Makefile.am 2018-10-21 18:46:12.054256102 +0200 +@@ -17,8 +17,11 @@ endif + endif + + if CAIRO_HAS_GL_SURFACE ++if CAIRO_HAS_XLIB_SURFACE ++# gl_surface test relies on X11/GLX + test_sources += $(gl_surface_test_sources) + endif ++endif + + if CAIRO_HAS_EGL_FUNCTIONS + test_sources += $(egl_surface_test_sources) +--- cairo-1.16.0/boilerplate/cairo-boilerplate-wgl.c.orig 2018-08-17 03:10:53.000000000 +0200 ++++ cairo-1.16.0/boilerplate/cairo-boilerplate-wgl.c 2018-10-21 20:14:56.554195307 +0200 +@@ -35,6 +35,7 @@ + + #include "cairo-boilerplate-private.h" + ++#include <GL/gl.h> + #include <cairo-gl.h> + + static const cairo_user_data_key_t gl_closure_key; ================================================================ ---- gitweb: http://git.pld-linux.org/gitweb.cgi/packages/crossmingw32-cairo.git/commitdiff/1d3dbd49d92f5579bcb985dfbdcea2ad667f7041 _______________________________________________ pld-cvs-commit mailing list pld-cvs-commit@lists.pld-linux.org http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit