From cb8d753674e954e6f6538ff7ffe8f58f240f39b9 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Sun, 29 Aug 2021 19:54:09 +0100 Subject: upgrade internal cairo and pixman to 1.17.4 and 0.40.0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cairo.RGB24_888.patch is split out from the rest of the unrelated patchfile it was in, this was introduced originally as: commit 54596087e57ea533253e19eea594d9b6c06e8d26 Author: Ashod Nakashian Date: Sat Dec 9 16:28:42 2017 -0500 vcl-svp: add 24-bit (3-byte) RGB surface support to Cairo drop parts of pixman-ubsan.patch that no longer apply, which maybe casts doubt over the parts that do apply if they are still necessary Change-Id: Id1e8f112b1121b892c97ea248b101f133f03ac48 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/121234 Tested-by: Jenkins Reviewed-by: Caolán McNamara --- external/cairo/ExternalPackage_cairo.mk | 2 +- external/cairo/ExternalPackage_pixman.mk | 2 +- external/cairo/ExternalProject_cairo.mk | 4 - external/cairo/UnpackedTarball_cairo.mk | 3 +- external/cairo/UnpackedTarball_pixman.mk | 1 - external/cairo/cairo/cairo-1.10.2.patch | 226 ----------------------------- external/cairo/cairo/cairo.GL_RGBA.patch | 16 +- external/cairo/cairo/cairo.RGB24_888.patch | 104 +++++++++++++ external/cairo/cairo/cairo.buildfix.patch | 122 ++++++++++++++++ external/cairo/pixman/pixman-ofz4372.patch | 16 -- external/cairo/pixman/pixman-ubsan.patch | 193 +++++------------------- 11 files changed, 273 insertions(+), 416 deletions(-) delete mode 100644 external/cairo/cairo/cairo-1.10.2.patch create mode 100644 external/cairo/cairo/cairo.RGB24_888.patch create mode 100644 external/cairo/cairo/cairo.buildfix.patch delete mode 100644 external/cairo/pixman/pixman-ofz4372.patch (limited to 'external/cairo') diff --git a/external/cairo/ExternalPackage_cairo.mk b/external/cairo/ExternalPackage_cairo.mk index 0ae9b39b8ba6..116db8a3499d 100644 --- a/external/cairo/ExternalPackage_cairo.mk +++ b/external/cairo/ExternalPackage_cairo.mk @@ -12,7 +12,7 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,cairo,cairo)) $(eval $(call gb_ExternalPackage_use_external_project,cairo,cairo)) ifneq ($(DISABLE_DYNLOADING),TRUE) -$(eval $(call gb_ExternalPackage_add_file,cairo,$(LIBO_LIB_FOLDER)/libcairo.so.2,src/.libs/libcairo.so.2.1160$(CAIRO_VERSION_MICRO).0)) +$(eval $(call gb_ExternalPackage_add_file,cairo,$(LIBO_LIB_FOLDER)/libcairo.so.2,src/.libs/libcairo.so.2.1170$(CAIRO_VERSION_MICRO).0)) endif # vim: set noet sw=4 ts=4: diff --git a/external/cairo/ExternalPackage_pixman.mk b/external/cairo/ExternalPackage_pixman.mk index 576517389565..458c2733503e 100644 --- a/external/cairo/ExternalPackage_pixman.mk +++ b/external/cairo/ExternalPackage_pixman.mk @@ -12,7 +12,7 @@ $(eval $(call gb_ExternalPackage_ExternalPackage,pixman,pixman)) $(eval $(call gb_ExternalPackage_use_external_project,pixman,pixman)) ifneq ($(DISABLE_DYNLOADING),TRUE) -$(eval $(call gb_ExternalPackage_add_file,pixman,$(LIBO_LIB_FOLDER)/libpixman-1.so.0,pixman/.libs/libpixman-1.so.0.34.0)) +$(eval $(call gb_ExternalPackage_add_file,pixman,$(LIBO_LIB_FOLDER)/libpixman-1.so.0,pixman/.libs/libpixman-1.so.0.40.0)) endif # vim: set noet sw=4 ts=4: diff --git a/external/cairo/ExternalProject_cairo.mk b/external/cairo/ExternalProject_cairo.mk index ec3f0d155492..b1e29d77b043 100644 --- a/external/cairo/ExternalProject_cairo.mk +++ b/external/cairo/ExternalProject_cairo.mk @@ -42,9 +42,6 @@ $(eval $(call gb_ExternalProject_register_targets,cairo,\ # cairo's configure. And pixman_LIBS happens to offer that. (The -Wc is necessary so that libtool # does not throw away the -rtlib=compiler-rt which it does not understand.) -# overwrite src/cairo-version.h because that is just a dummy file and included -# from cairo.h in non-overridable way - $(call gb_ExternalProject_get_state_target,cairo,build) : $(call gb_Trace_StartRange,cairo,EXTERNAL) $(call gb_ExternalProject_run,build,\ @@ -77,7 +74,6 @@ $(call gb_ExternalProject_get_state_target,cairo,build) : $(if $(CROSS_COMPILING),--build=$(BUILD_PLATFORM) --host=$(HOST_PLATFORM) \ $(if $(filter INTEL ARM,$(CPUNAME)),ac_cv_c_bigendian=no ax_cv_c_float_words_bigendian=no)) \ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________OOO) \ - && cp cairo-version.h src/cairo-version.h \ && cd src && $(MAKE) \ ) $(call gb_Trace_EndRange,cairo,EXTERNAL) diff --git a/external/cairo/UnpackedTarball_cairo.mk b/external/cairo/UnpackedTarball_cairo.mk index 920722c2e77a..5e83b526e52e 100644 --- a/external/cairo/UnpackedTarball_cairo.mk +++ b/external/cairo/UnpackedTarball_cairo.mk @@ -12,7 +12,8 @@ $(eval $(call gb_UnpackedTarball_UnpackedTarball,cairo)) $(eval $(call gb_UnpackedTarball_set_tarball,cairo,$(CAIRO_TARBALL),,cairo)) $(eval $(call gb_UnpackedTarball_add_patches,cairo,\ - external/cairo/cairo/cairo-1.10.2.patch \ + external/cairo/cairo/cairo.buildfix.patch \ + external/cairo/cairo/cairo.RGB24_888.patch \ external/cairo/cairo/cairo-libtool-rpath.patch.1 \ external/cairo/cairo/cairo.oldfreetype.patch \ external/cairo/cairo/san.patch.0 \ diff --git a/external/cairo/UnpackedTarball_pixman.mk b/external/cairo/UnpackedTarball_pixman.mk index bccc7a7a5a04..3f1f75616611 100644 --- a/external/cairo/UnpackedTarball_pixman.mk +++ b/external/cairo/UnpackedTarball_pixman.mk @@ -13,7 +13,6 @@ $(eval $(call gb_UnpackedTarball_set_tarball,pixman,$(PIXMAN_TARBALL),,cairo)) $(eval $(call gb_UnpackedTarball_add_patches,pixman,\ external/cairo/pixman/pixman-0.24.4.patch \ - external/cairo/pixman/pixman-ofz4372.patch \ external/cairo/pixman/pixman-ubsan.patch \ )) diff --git a/external/cairo/cairo/cairo-1.10.2.patch b/external/cairo/cairo/cairo-1.10.2.patch deleted file mode 100644 index f50501926faa..000000000000 --- a/external/cairo/cairo/cairo-1.10.2.patch +++ /dev/null @@ -1,226 +0,0 @@ -diff -ruNw misc/cairo-1.10.2/build/Makefile.win32.features misc/build/cairo-1.10.2/build/Makefile.win32.features ---- misc/cairo-1.10.2/build/Makefile.win32.features 2015-10-27 17:04:21.000000000 -0400 -+++ misc/build/cairo-1.10.2/build/Makefile.win32.features 2017-11-24 21:43:14.103524768 -0500 -@@ -30,7 +30,7 @@ - CAIRO_HAS_FC_FONT=0 - CAIRO_HAS_PS_SURFACE=1 - CAIRO_HAS_PDF_SURFACE=1 --CAIRO_HAS_SVG_SURFACE=1 -+CAIRO_HAS_SVG_SURFACE=0 - CAIRO_HAS_TEST_SURFACES=0 - CAIRO_HAS_TEE_SURFACE=0 - CAIRO_HAS_XML_SURFACE=0 -diff -ruNw misc/cairo-1.10.2/configure misc/build/cairo-1.10.2/configure ---- misc/cairo-1.10.2/configure 2015-12-09 15:41:45.000000000 -0500 -+++ misc/build/cairo-1.10.2/configure 2017-11-24 21:43:14.103524768 -0500 -@@ -20580,61 +20580,12 @@ - rm -f confcache - - --{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5 --$as_echo_n "checking for compress in -lz... " >&6; } --if ${ac_cv_lib_z_compress+:} false; then : -- $as_echo_n "(cached) " >&6 --else -- ac_check_lib_save_LIBS=$LIBS --LIBS="-lz $LIBS" --cat confdefs.h - <<_ACEOF >conftest.$ac_ext --/* end confdefs.h. */ -- --/* Override any GCC internal prototype to avoid an error. -- Use char because int might match the return type of a GCC -- builtin and then its argument prototype would still apply. */ --#ifdef __cplusplus --extern "C" --#endif --char compress (); --int --main () --{ --return compress (); -- ; -- return 0; --} --_ACEOF --if ac_fn_c_try_link "$LINENO"; then : -- ac_cv_lib_z_compress=yes --else -- ac_cv_lib_z_compress=no --fi --rm -f core conftest.err conftest.$ac_objext \ -- conftest$ac_exeext conftest.$ac_ext --LIBS=$ac_check_lib_save_LIBS --fi --{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5 --$as_echo "$ac_cv_lib_z_compress" >&6; } --if test "x$ac_cv_lib_z_compress" = xyes; then : -- ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" --if test "x$ac_cv_header_zlib_h" = xyes; then : - - have_libz=yes - - $as_echo "#define HAVE_ZLIB 1" >>confdefs.h - - --else -- have_libz="no (requires zlib http://www.gzip.org/zlib/)" --fi -- -- --else -- have_libz="no (requires zlib http://www.gzip.org/zlib/)" --fi -- -- - save_LIBS="$LIBS" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo2a_decompress in -llzo2" >&5 - $as_echo_n "checking for lzo2a_decompress in -llzo2... " >&6; } -@@ -30069,7 +30020,7 @@ - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_VERSION - OK" >&5 - $as_echo "$FREETYPE_VERSION - OK" >&6; } - ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags` -- ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs` -+ ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs | $SED -e 's/-lz//g'` - else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_VERSION - Too old" >&5 - $as_echo "$FREETYPE_VERSION - Too old" >&6; } - use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)" -@@ -30079,7 +30030,7 @@ - fi - - ft_CFLAGS="$FREETYPE_CFLAGS" -- ft_LIBS="$FREETYPE_LIBS" -+ ft_LIBS=`echo "$FREETYPE_LIBS" | $SED -e 's/-lz//g'` - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's FreeType font backend feature could be enabled" >&5 -@@ -30686,7 +30637,7 @@ - - # The ps backend requires zlib. - use_ps=$have_libz -- ps_NONPKGCONFIG_LIBS=-lz -+ ps_NONPKGCONFIG_LIBS=$ZLIB3RDLIB - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's PostScript surface backend feature could be enabled" >&5 -@@ -31082,7 +31033,7 @@ - - # The pdf backend requires zlib. - use_pdf=$have_libz -- pdf_NONPKGCONFIG_LIBS=-lz -+ pdf_NONPKGCONFIG_LIBS=$ZLIB3RDLIB - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's PDF surface backend feature could be enabled" >&5 -@@ -32973,7 +32924,7 @@ - - - use_xml=$have_libz -- xml_NONPKGCONFIG_LIBS=-lz -+ xml_NONPKGCONFIG_LIBS=$ZLIB3RDLIB - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's xml surface backend feature could be enabled" >&5 -diff -ruNw misc/cairo-1.10.2/src/cairo.h misc/build/cairo-1.10.2/src/cairo.h ---- misc/cairo-1.10.2/src/cairo.h 2015-10-27 17:04:21.000000000 -0400 -+++ misc/build/cairo-1.10.2/src/cairo.h 2017-12-17 12:09:59.880406411 -0500 -@@ -397,6 +397,8 @@ - * with red in the upper 5 bits, then green in the middle - * 6 bits, and blue in the lower 5 bits. (Since 1.2) - * @CAIRO_FORMAT_RGB30: like RGB24 but with 10bpc. (Since 1.12) -+ * @CAIRO_FORMAT_RGB24_888: each pixel is a 24-bit quantity, -+ * with Red, Green, Blue taking 8-bits each, in that order. (Since 1.1x) - * - * #cairo_format_t is used to identify the memory format of - * image data. -@@ -412,9 +414,16 @@ - CAIRO_FORMAT_A8 = 2, - CAIRO_FORMAT_A1 = 3, - CAIRO_FORMAT_RGB16_565 = 4, -- CAIRO_FORMAT_RGB30 = 5 -+ CAIRO_FORMAT_RGB30 = 5, -+ CAIRO_FORMAT_RGB24_888 = 6 - } cairo_format_t; - -+/** -+ * Need this until CAIRO_FORMAT_RGB24_888 is in some official release. -+ * Otherwise we can't reliably check if this is available or we should -+ * convert from 24-bit RGB to 32-bit RGB before passing to Cairo. -+ **/ -+#define HAVE_CAIRO_FORMAT_RGB24_888 - - /** - * cairo_write_func_t: -diff -ruNw misc/cairo-1.10.2/src/cairo-image-source.c misc/build/cairo-1.10.2/src/cairo-image-source.c ---- misc/cairo-1.10.2/src/cairo-image-source.c 2015-10-27 17:04:30.000000000 -0400 -+++ misc/build/cairo-1.10.2/src/cairo-image-source.c 2017-12-17 12:09:56.076344387 -0500 -@@ -508,6 +508,19 @@ - color.blue = expand_channel(pixel & 0x3fff, 10); - return pixman_image_create_solid_fill (&color); - -+ case CAIRO_FORMAT_RGB24_888: -+ pixel = *(uint32_t *) (image->data + y * image->stride + 3 * x); -+ pixel &= 0x00ffffff; /* ignore next pixel bits */ -+ if (pixel == 0) -+ return _pixman_black_image (); -+ if (pixel == 0x00ffffff) -+ return _pixman_white_image (); -+ -+ color.red = (pixel >> 16 & 0xff) | (pixel >> 8 & 0xff00); -+ color.green = (pixel >> 8 & 0xff) | (pixel & 0xff00); -+ color.blue = (pixel & 0xff) | (pixel << 8 & 0xff00); -+ return pixman_image_create_solid_fill (&color); -+ - case CAIRO_FORMAT_ARGB32: - case CAIRO_FORMAT_RGB24: - pixel = *(uint32_t *) (image->data + y * image->stride + 4 * x); -diff -ruNw misc/cairo-1.10.2/src/cairo-image-surface.c misc/build/cairo-1.10.2/src/cairo-image-surface.c ---- misc/cairo-1.10.2/src/cairo-image-surface.c 2015-10-27 17:04:30.000000000 -0400 -+++ misc/build/cairo-1.10.2/src/cairo-image-surface.c 2017-12-17 12:09:59.876406346 -0500 -@@ -104,13 +104,15 @@ - return CAIRO_FORMAT_A1; - case PIXMAN_r5g6b5: - return CAIRO_FORMAT_RGB16_565; -+ case PIXMAN_r8g8b8: -+ return CAIRO_FORMAT_RGB24_888; - #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,22,0) - case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8: - #endif - #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,27,2) - case PIXMAN_a8r8g8b8_sRGB: - #endif -- case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8: -+ case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: - case PIXMAN_b8g8r8: case PIXMAN_b5g6r5: - case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5: - case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4: -@@ -320,6 +322,9 @@ - case CAIRO_FORMAT_RGB16_565: - ret = PIXMAN_r5g6b5; - break; -+ case CAIRO_FORMAT_RGB24_888: -+ ret = PIXMAN_r8g8b8; -+ break; - case CAIRO_FORMAT_ARGB32: - case CAIRO_FORMAT_INVALID: - default: -@@ -718,6 +723,8 @@ - case CAIRO_FORMAT_RGB30: - case CAIRO_FORMAT_RGB24: - return 32; -+ case CAIRO_FORMAT_RGB24_888: -+ return 24; - case CAIRO_FORMAT_RGB16_565: - return 16; - case CAIRO_FORMAT_A8: -diff -ruNw misc/cairo-1.10.2/src/cairoint.h misc/build/cairo-1.10.2/src/cairoint.h ---- misc/cairo-1.10.2/src/cairoint.h 2015-10-27 17:04:30.000000000 -0400 -+++ misc/build/cairo-1.10.2/src/cairoint.h 2017-12-17 12:09:59.880406411 -0500 -@@ -1486,7 +1486,7 @@ - * in cairo-xlib-surface.c--again see -Wswitch-enum). - */ - #define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 && \ -- (format) <= CAIRO_FORMAT_RGB30) -+ (format) <= CAIRO_FORMAT_RGB24_888) - - /* pixman-required stride alignment in bytes. */ - #define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t)) diff --git a/external/cairo/cairo/cairo.GL_RGBA.patch b/external/cairo/cairo/cairo.GL_RGBA.patch index 5f50dd13ffa9..b1a05feb4a15 100644 --- a/external/cairo/cairo/cairo.GL_RGBA.patch +++ b/external/cairo/cairo/cairo.GL_RGBA.patch @@ -1,9 +1,9 @@ --- misc/cairo-1.10.2/src/cairo-image-surface.c +++ misc/cairo-1.10.2/src/cairo-image-surface.c -@@ -92,11 +92,11 @@ - _cairo_format_from_pixman_format (pixman_format_code_t pixman_format) - { - switch (pixman_format) { +@@ -97,11 +97,11 @@ + return CAIRO_FORMAT_RGBA128F; + case PIXMAN_rgb_float: + return CAIRO_FORMAT_RGB96F; - case PIXMAN_a8r8g8b8: + case PIXMAN_a8b8g8r8: //tweaked return CAIRO_FORMAT_ARGB32; @@ -14,7 +14,7 @@ return CAIRO_FORMAT_RGB24; case PIXMAN_a8: return CAIRO_FORMAT_A8; -@@ -112,7 +112,7 @@ +@@ -117,7 +117,7 @@ #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,27,2) case PIXMAN_a8r8g8b8_sRGB: #endif @@ -23,7 +23,7 @@ case PIXMAN_b8g8r8: case PIXMAN_b5g6r5: case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5: case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4: -@@ -314,7 +314,7 @@ +@@ -320,7 +320,7 @@ ret = PIXMAN_a8; break; case CAIRO_FORMAT_RGB24: @@ -32,8 +32,8 @@ break; case CAIRO_FORMAT_RGB30: ret = PIXMAN_x2r10g10b10; -@@ -323,12 +323,12 @@ - ret = PIXMAN_r5g6b5; +@@ -335,12 +335,12 @@ + ret = PIXMAN_rgba_float; break; case CAIRO_FORMAT_RGB24_888: - ret = PIXMAN_r8g8b8; diff --git a/external/cairo/cairo/cairo.RGB24_888.patch b/external/cairo/cairo/cairo.RGB24_888.patch new file mode 100644 index 000000000000..f0cc9bb0beb0 --- /dev/null +++ b/external/cairo/cairo/cairo.RGB24_888.patch @@ -0,0 +1,104 @@ +diff -ru cairo-1.17.4.orig/src/cairo.h cairo-1.17.4/src/cairo.h +--- misc/cairo-1.17.4.orig/src/cairo.h 2021-08-29 19:43:26.976435721 +0100 ++++ misc/build/cairo-1.17.4/src/cairo.h 2021-08-29 19:47:41.373919330 +0100 +@@ -407,6 +407,8 @@ + * @CAIRO_FORMAT_RGB30: like RGB24 but with 10bpc. (Since 1.12) + * @CAIRO_FORMAT_RGB96F: 3 floats, R, G, B. (Since 1.17.2) + * @CAIRO_FORMAT_RGBA128F: 4 floats, R, G, B, A. (Since 1.17.2) ++ * @CAIRO_FORMAT_RGB24_888: each pixel is a 24-bit quantity, ++ * with Red, Green, Blue taking 8-bits each, in that order. (Since 1.1x) + * + * #cairo_format_t is used to identify the memory format of + * image data. +@@ -424,9 +426,16 @@ + CAIRO_FORMAT_RGB16_565 = 4, + CAIRO_FORMAT_RGB30 = 5, + CAIRO_FORMAT_RGB96F = 6, +- CAIRO_FORMAT_RGBA128F = 7 ++ CAIRO_FORMAT_RGBA128F = 7, ++ CAIRO_FORMAT_RGB24_888 = 8 + } cairo_format_t; + ++/** ++ * Need this until CAIRO_FORMAT_RGB24_888 is in some official release. ++ * Otherwise we can't reliably check if this is available or we should ++ * convert from 24-bit RGB to 32-bit RGB before passing to Cairo. ++ **/ ++#define HAVE_CAIRO_FORMAT_RGB24_888 + + /** + * cairo_write_func_t: +diff -ru cairo-1.17.4.orig/src/cairo-image-source.c cairo-1.17.4/src/cairo-image-source.c +--- misc/cairo-1.17.4.orig/src/cairo-image-source.c 2021-08-29 19:43:26.979435585 +0100 ++++ misc/build/cairo-1.17.4/src/cairo-image-source.c 2021-08-29 19:43:47.501506559 +0100 +@@ -509,6 +509,19 @@ + color.blue = expand_channel(pixel & 0x3fff, 10); + return pixman_image_create_solid_fill (&color); + ++ case CAIRO_FORMAT_RGB24_888: ++ pixel = *(uint32_t *) (image->data + y * image->stride + 3 * x); ++ pixel &= 0x00ffffff; /* ignore next pixel bits */ ++ if (pixel == 0) ++ return _pixman_black_image (); ++ if (pixel == 0x00ffffff) ++ return _pixman_white_image (); ++ ++ color.red = (pixel >> 16 & 0xff) | (pixel >> 8 & 0xff00); ++ color.green = (pixel >> 8 & 0xff) | (pixel & 0xff00); ++ color.blue = (pixel & 0xff) | (pixel << 8 & 0xff00); ++ return pixman_image_create_solid_fill (&color); ++ + case CAIRO_FORMAT_ARGB32: + case CAIRO_FORMAT_RGB24: + pixel = *(uint32_t *) (image->data + y * image->stride + 4 * x); +diff -ru cairo-1.17.4.orig/src/cairo-image-surface.c cairo-1.17.4/src/cairo-image-surface.c +--- misc/cairo-1.17.4.orig/src/cairo-image-surface.c 2021-08-29 19:43:26.982435449 +0100 ++++ misc/build/cairo-1.17.4/src/cairo-image-surface.c 2021-08-29 19:43:47.501506559 +0100 +@@ -109,13 +109,15 @@ + return CAIRO_FORMAT_A1; + case PIXMAN_r5g6b5: + return CAIRO_FORMAT_RGB16_565; ++ case PIXMAN_r8g8b8: ++ return CAIRO_FORMAT_RGB24_888; + #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,22,0) + case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8: + #endif + #if PIXMAN_VERSION >= PIXMAN_VERSION_ENCODE(0,27,2) + case PIXMAN_a8r8g8b8_sRGB: + #endif +- case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8: ++ case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: + case PIXMAN_b8g8r8: case PIXMAN_b5g6r5: + case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5: + case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4: +@@ -332,6 +334,9 @@ + case CAIRO_FORMAT_RGBA128F: + ret = PIXMAN_rgba_float; + break; ++ case CAIRO_FORMAT_RGB24_888: ++ ret = PIXMAN_r8g8b8; ++ break; + case CAIRO_FORMAT_ARGB32: + case CAIRO_FORMAT_INVALID: + default: +@@ -736,6 +741,8 @@ + case CAIRO_FORMAT_RGB30: + case CAIRO_FORMAT_RGB24: + return 32; ++ case CAIRO_FORMAT_RGB24_888: ++ return 24; + case CAIRO_FORMAT_RGB16_565: + return 16; + case CAIRO_FORMAT_A8: +diff -ru cairo-1.17.4.orig/src/cairoint.h cairo-1.17.4/src/cairoint.h +--- misc/cairo-1.17.4.orig/src/cairoint.h 2021-08-29 19:43:26.973435857 +0100 ++++ misc/build/cairo-1.17.4/src/cairoint.h 2021-08-29 19:48:08.396696027 +0100 +@@ -1539,7 +1539,7 @@ + * in cairo-xlib-surface.c--again see -Wswitch-enum). + */ + #define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 && \ +- (format) <= CAIRO_FORMAT_RGBA128F) ++ (format) <= CAIRO_FORMAT_RGB24_888) + + /* pixman-required stride alignment in bytes. */ + #define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t)) diff --git a/external/cairo/cairo/cairo.buildfix.patch b/external/cairo/cairo/cairo.buildfix.patch new file mode 100644 index 000000000000..070dc8317244 --- /dev/null +++ b/external/cairo/cairo/cairo.buildfix.patch @@ -0,0 +1,122 @@ +diff -ru cairo-1.17.4.orig/build/Makefile.win32.features cairo-1.17.4/build/Makefile.win32.features +--- misc/cairo-1.17.4.orig/build/Makefile.win32.features 2021-08-29 19:43:27.093430425 +0100 ++++ misc/build/cairo-1.17.4/build/Makefile.win32.features 2021-08-29 19:43:47.496506785 +0100 +@@ -30,7 +30,7 @@ + CAIRO_HAS_FC_FONT=0 + CAIRO_HAS_PS_SURFACE=1 + CAIRO_HAS_PDF_SURFACE=1 +-CAIRO_HAS_SVG_SURFACE=1 ++CAIRO_HAS_SVG_SURFACE=0 + CAIRO_HAS_TEST_SURFACES=0 + CAIRO_HAS_TEE_SURFACE=0 + CAIRO_HAS_XML_SURFACE=0 +diff -ru cairo-1.17.4.orig/configure cairo-1.17.4/configure +--- misc/cairo-1.17.4.orig/configure 2021-08-29 19:43:26.966436173 +0100 ++++ misc/build/cairo-1.17.4/configure 2021-08-29 19:43:47.500506604 +0100 +@@ -21080,61 +21080,12 @@ + rm -f confcache + + +-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for compress in -lz" >&5 +-$as_echo_n "checking for compress in -lz... " >&6; } +-if ${ac_cv_lib_z_compress+:} false; then : +- $as_echo_n "(cached) " >&6 +-else +- ac_check_lib_save_LIBS=$LIBS +-LIBS="-lz $LIBS" +-cat confdefs.h - <<_ACEOF >conftest.$ac_ext +-/* end confdefs.h. */ +- +-/* Override any GCC internal prototype to avoid an error. +- Use char because int might match the return type of a GCC +- builtin and then its argument prototype would still apply. */ +-#ifdef __cplusplus +-extern "C" +-#endif +-char compress (); +-int +-main () +-{ +-return compress (); +- ; +- return 0; +-} +-_ACEOF +-if ac_fn_c_try_link "$LINENO"; then : +- ac_cv_lib_z_compress=yes +-else +- ac_cv_lib_z_compress=no +-fi +-rm -f core conftest.err conftest.$ac_objext \ +- conftest$ac_exeext conftest.$ac_ext +-LIBS=$ac_check_lib_save_LIBS +-fi +-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_z_compress" >&5 +-$as_echo "$ac_cv_lib_z_compress" >&6; } +-if test "x$ac_cv_lib_z_compress" = xyes; then : +- ac_fn_c_check_header_mongrel "$LINENO" "zlib.h" "ac_cv_header_zlib_h" "$ac_includes_default" +-if test "x$ac_cv_header_zlib_h" = xyes; then : + + have_libz=yes + + $as_echo "#define HAVE_ZLIB 1" >>confdefs.h + + +-else +- have_libz="no (requires zlib http://www.gzip.org/zlib/)" +-fi +- +- +-else +- have_libz="no (requires zlib http://www.gzip.org/zlib/)" +-fi +- +- + save_LIBS="$LIBS" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for lzo2a_decompress in -llzo2" >&5 + $as_echo_n "checking for lzo2a_decompress in -llzo2... " >&6; } +@@ -30670,7 +30621,7 @@ + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_VERSION - OK" >&5 + $as_echo "$FREETYPE_VERSION - OK" >&6; } + ft_NONPKGCONFIG_CFLAGS=`$FREETYPE_CONFIG --cflags` +- ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs` ++ ft_NONPKGCONFIG_LIBS=`$FREETYPE_CONFIG --libs | $SED -e 's/-lz//g'` + else { $as_echo "$as_me:${as_lineno-$LINENO}: result: $FREETYPE_VERSION - Too old" >&5 + $as_echo "$FREETYPE_VERSION - Too old" >&6; } + use_ft="no ($FREETYPE_VERSION found; version $FREETYPE_MIN_VERSION from release $FREETYPE_MIN_RELEASE required)" +@@ -30680,7 +30631,7 @@ + fi + + ft_CFLAGS="$FREETYPE_CFLAGS" +- ft_LIBS="$FREETYPE_LIBS" ++ ft_LIBS=`echo "$FREETYPE_LIBS" | $SED -e 's/-lz//g'` + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's FreeType font backend feature could be enabled" >&5 +@@ -31321,7 +31272,7 @@ + + # The ps backend requires zlib. + use_ps=$have_libz +- ps_NONPKGCONFIG_LIBS=-lz ++ ps_NONPKGCONFIG_LIBS=$ZLIB3RDLIB + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's PostScript surface backend feature could be enabled" >&5 +@@ -31718,7 +31669,7 @@ + + # The pdf backend requires zlib. + use_pdf=$have_libz +- pdf_NONPKGCONFIG_LIBS=-lz ++ pdf_NONPKGCONFIG_LIBS=$ZLIB3RDLIB + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's PDF surface backend feature could be enabled" >&5 +@@ -33610,7 +33561,7 @@ + + + use_xml=$have_libz +- xml_NONPKGCONFIG_LIBS=-lz ++ xml_NONPKGCONFIG_LIBS=$ZLIB3RDLIB + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cairo's xml surface backend feature could be enabled" >&5 diff --git a/external/cairo/pixman/pixman-ofz4372.patch b/external/cairo/pixman/pixman-ofz4372.patch deleted file mode 100644 index aaf83f11d414..000000000000 --- a/external/cairo/pixman/pixman-ofz4372.patch +++ /dev/null @@ -1,16 +0,0 @@ ---- misc/pixman/pixman/pixman-solid-fill.c -+++ misc/build/pixman/pixman/pixman-solid-fill.c -@@ -30,10 +30,10 @@ static uint32_t - color_to_uint32 (const pixman_color_t *color) - { - return -- (color->alpha >> 8 << 24) | -- (color->red >> 8 << 16) | -+ ((uint32_t)color->alpha >> 8 << 24) | -+ ((uint32_t)color->red >> 8 << 16) | - (color->green & 0xff00) | -- (color->blue >> 8); -+ ((uint32_t)color->blue >> 8); - } - - static argb_t diff --git a/external/cairo/pixman/pixman-ubsan.patch b/external/cairo/pixman/pixman-ubsan.patch index 8f68d569e117..3a556d19a9dd 100644 --- a/external/cairo/pixman/pixman-ubsan.patch +++ b/external/cairo/pixman/pixman-ubsan.patch @@ -1,59 +1,7 @@ ---- misc/pixman/pixman/pixman.h -+++ misc/build/pixman/pixman/pixman.h -@@ -127,7 +127,7 @@ - #define pixman_fixed_1_minus_e (pixman_fixed_1 - pixman_fixed_e) - #define pixman_fixed_minus_1 (pixman_int_to_fixed(-1)) - #define pixman_fixed_to_int(f) ((int) ((f) >> 16)) --#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) << 16)) -+#define pixman_int_to_fixed(i) ((pixman_fixed_t) ((i) * (1 << 16))) - #define pixman_fixed_to_double(f) (double) ((f) / (double) pixman_fixed_1) - #define pixman_double_to_fixed(d) ((pixman_fixed_t) ((d) * 65536.0)) - #define pixman_fixed_frac(f) ((f) & pixman_fixed_1_minus_e) ---- misc/pixman/pixman/pixman-fast-path.c -+++ misc/build/pixman/pixman/pixman-fast-path.c -@@ -2758,8 +2758,8 @@ - * positioned relative to a particular phase (and not relative to whatever - * exact fraction we happen to get here). - */ -- x = ((vx >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1); -- y = ((vy >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1); -+ x = ((uint32_t)(vx >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1); -+ y = ((uint32_t)(vy >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1); - - px = (x & 0xffff) >> x_phase_shift; - py = (y & 0xffff) >> y_phase_shift; -@@ -2836,7 +2836,7 @@ - sgtot = CLIP (sgtot, 0, 0xff); - sbtot = CLIP (sbtot, 0, 0xff); - -- buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0); -+ buffer[k] = ((uint32_t)satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0); - - next: - vx += ux; -@@ -3086,7 +3086,7 @@ - static force_inline uint32_t - convert_a8 (const uint8_t *row, int x) - { -- return *(row + x) << 24; -+ return (uint32_t)*(row + x) << 24; - } - - static force_inline uint32_t ---- misc/pixman/pixman/pixman-access.c -+++ misc/build/pixman/pixman/pixman-access.c -@@ -100,7 +100,7 @@ - uint32_t *__d = ((uint32_t *)(l)) + ((o) >> 5); \ - uint32_t __m, __v; \ - \ -- __m = 1 << ((o) & 0x1f); \ -+ __m = (uint32_t)1 << ((o) & 0x1f); \ - __v = (v)? __m : 0; \ - \ - WRITE((img), __d, (READ((img), __d) & ~__m) | __v); \ ---- misc/pixman/pixman/pixman-bits-image.c -+++ misc/build/pixman/pixman/pixman-bits-image.c -@@ -243,8 +243,8 @@ +diff -ru pixman-0.40.0.orig/pixman/pixman-bits-image.c pixman-0.40.0/pixman/pixman-bits-image.c +--- misc/pixman-0.40.0.orig/pixman/pixman-bits-image.c 2021-08-29 20:02:33.714515016 +0100 ++++ misc/build/pixman-0.40.0/pixman/pixman-bits-image.c 2021-08-29 20:05:43.304930185 +0100 +@@ -351,8 +351,8 @@ * positioned relative to a particular phase (and not relative to whatever * exact fraction we happen to get here). */ @@ -64,17 +12,9 @@ px = (x & 0xffff) >> x_phase_shift; py = (y & 0xffff) >> y_phase_shift; -@@ -306,7 +306,7 @@ - sgtot = CLIP (sgtot, 0, 0xff); - sbtot = CLIP (sbtot, 0, 0xff); - -- return ((satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot)); -+ return (((uint32_t)satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot)); - } - - static force_inline uint32_t ---- misc/pixman/pixman/pixman-combine32.c -+++ misc/build/pixman/pixman/pixman-combine32.c +diff -ru pixman-0.40.0.orig/pixman/pixman-combine32.c pixman-0.40.0/pixman/pixman-combine32.c +--- misc/pixman-0.40.0.orig/pixman/pixman-combine32.c 2021-08-29 20:02:33.715514970 +0100 ++++ misc/build/pixman-0.40.0/pixman/pixman-combine32.c 2021-08-29 20:05:43.304930185 +0100 @@ -589,7 +589,7 @@ rg = DIV_ONE_UN8 (rg); \ rb = DIV_ONE_UN8 (rb); \ @@ -84,49 +24,33 @@ } \ } \ \ ---- misc/pixman/pixman/pixman-gradient-walker.c -+++ misc/build/pixman/pixman/pixman-gradient-walker.c -@@ -193,7 +193,7 @@ - g8 = g + 0.5f; - b8 = b + 0.5f; - -- v = ((a8 << 24) & 0xff000000) | -+ v = (((uint32_t)a8 << 24) & 0xff000000) | - ((r8 << 16) & 0x00ff0000) | - ((g8 << 8) & 0x0000ff00) | - ((b8 >> 0) & 0x000000ff); ---- misc/pixman/pixman/pixman-sse2.c -+++ misc/build/pixman/pixman/pixman-sse2.c -@@ -516,9 +516,13 @@ - } - - static force_inline uint32_t --combine1 (const uint32_t *ps, const uint32_t *pm) -+combine1 (const void *ps, const uint32_t *pm) - { -- uint32_t s = *ps; -+#ifdef WORDS_BIGENDIAN -+ uint32_t s = (uint32_t)((const uint8_t *)ps)[3] | ((uint32_t)((const uint8_t *)ps)[2] << 8) | ((uint32_t)((const uint8_t *)ps)[1] << 16) | ((uint32_t)((const uint8_t *)ps)[0] << 24); -+#else -+ uint32_t s = (uint32_t)((const uint8_t *)ps)[0] | ((uint32_t)((const uint8_t *)ps)[1] << 8) | ((uint32_t)((const uint8_t *)ps)[2] << 16) | ((uint32_t)((const uint8_t *)ps)[3] << 24); -+#endif +diff -ru pixman-0.40.0.orig/pixman/pixman-fast-path.c pixman-0.40.0/pixman/pixman-fast-path.c +--- misc/pixman-0.40.0.orig/pixman/pixman-fast-path.c 2021-08-29 20:02:33.716514925 +0100 ++++ misc/build/pixman-0.40.0/pixman/pixman-fast-path.c 2021-08-29 20:05:43.303930231 +0100 +@@ -2758,8 +2758,8 @@ + * positioned relative to a particular phase (and not relative to whatever + * exact fraction we happen to get here). + */ +- x = ((vx >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1); +- y = ((vy >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1); ++ x = ((uint32_t)(vx >> x_phase_shift) << x_phase_shift) + ((1 << x_phase_shift) >> 1); ++ y = ((uint32_t)(vy >> y_phase_shift) << y_phase_shift) + ((1 << y_phase_shift) >> 1); - if (pm) - { -@@ -3256,7 +3260,11 @@ + px = (x & 0xffff) >> x_phase_shift; + py = (y & 0xffff) >> y_phase_shift; +@@ -2836,7 +2836,7 @@ + sgtot = CLIP (sgtot, 0, 0xff); + sbtot = CLIP (sbtot, 0, 0xff); - while (w >= 4) - { -- m = *((uint32_t*)mask); -+#ifdef WORDS_BIGENDIAN -+ m = (uint32_t)mask[3] | ((uint32_t)mask[2] << 8) | ((uint32_t)mask[1] << 16) | ((uint32_t)mask[0] << 24); -+#else -+ m = (uint32_t)mask[0] | ((uint32_t)mask[1] << 8) | ((uint32_t)mask[2] << 16) | ((uint32_t)mask[3] << 24); -+#endif +- buffer[k] = (satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0); ++ buffer[k] = ((uint32_t)satot << 24) | (srtot << 16) | (sgtot << 8) | (sbtot << 0); - if (srca == 0xff && m == 0xffffffff) - { -@@ -3343,7 +3351,7 @@ + next: + vx += ux; +diff -ru pixman-0.40.0.orig/pixman/pixman-sse2.c pixman-0.40.0/pixman/pixman-sse2.c +--- misc/pixman-0.40.0.orig/pixman/pixman-sse2.c 2021-08-29 20:02:33.716514925 +0100 ++++ misc/build/pixman-0.40.0/pixman/pixman-sse2.c 2021-08-29 20:05:43.306930095 +0100 +@@ -3344,7 +3344,7 @@ b = filler & 0xff; w = (b << 8) | b; @@ -135,57 +59,10 @@ } else if (bpp == 16) { -@@ -3528,7 +3536,11 @@ - - while (w >= 4) - { -- m = *((uint32_t*)mask); -+#ifdef WORDS_BIGENDIAN -+ m = (uint32_t)mask[3] | ((uint32_t)mask[2] << 8) | ((uint32_t)mask[1] << 16) | ((uint32_t)mask[0] << 24); -+#else -+ m = (uint32_t)mask[0] | ((uint32_t)mask[1] << 8) | ((uint32_t)mask[2] << 16) | ((uint32_t)mask[3] << 24); -+#endif - - if (srca == 0xff && m == 0xffffffff) - { -@@ -5016,7 +5028,11 @@ - - while (w >= 4) - { -- m = *(uint32_t *) mask; -+#ifdef WORDS_BIGENDIAN -+ m = (uint32_t)mask[3] | ((uint32_t)mask[2] << 8) | ((uint32_t)mask[1] << 16) | ((uint32_t)mask[0] << 24); -+#else -+ m = (uint32_t)mask[0] | ((uint32_t)mask[1] << 8) | ((uint32_t)mask[2] << 16) | ((uint32_t)mask[3] << 24); -+#endif - - if (m) - { -@@ -5970,7 +5986,11 @@ - __m128i xmm_dst, xmm_dst_lo, xmm_dst_hi; - __m128i xmm_mask, xmm_mask_lo, xmm_mask_hi; - -- m = *(uint32_t*)mask; -+#ifdef WORDS_BIGENDIAN -+ m = (uint32_t)mask[3] | ((uint32_t)mask[2] << 8) | ((uint32_t)mask[1] << 16) | ((uint32_t)mask[0] << 24); -+#else // TODO:big endian -+ m = (uint32_t)mask[0] | ((uint32_t)mask[1] << 8) | ((uint32_t)mask[2] << 16) | ((uint32_t)mask[3] << 24); -+#endif - - if (m) - { -@@ -6437,7 +6457,7 @@ - - while (w) - { -- *dst++ = *(src++) << 24; -+ *dst++ = (uint32_t)*(src++) << 24; - w--; - } - ---- misc/pixman/pixman/pixman-utils.c -+++ misc/build/pixman/pixman/pixman-utils.c -@@ -214,7 +214,7 @@ +diff -ru pixman-0.40.0.orig/pixman/pixman-utils.c pixman-0.40.0/pixman/pixman-utils.c +--- misc/pixman-0.40.0.orig/pixman/pixman-utils.c 2021-08-29 20:02:33.715514970 +0100 ++++ misc/build/pixman-0.40.0/pixman/pixman-utils.c 2021-08-29 20:05:43.306930095 +0100 +@@ -213,7 +213,7 @@ g = float_to_unorm (src[i].g, 8); b = float_to_unorm (src[i].b, 8); -- cgit