From 940b4d1848e8c70ab7642901a68594e8016caffc Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 18:51:28 +0200 Subject: Adding upstream version 1:7.0.4. Signed-off-by: Daniel Baumann --- external/cairo/pixman/Makefile.win32.common | 54 +++++++++++++++++ external/cairo/pixman/pixman-0.24.4.patch | 91 +++++++++++++++++++++++++++++ external/cairo/pixman/pixman-ofz4372.patch | 16 +++++ external/cairo/pixman/pixman-ubsan.patch | 33 +++++++++++ 4 files changed, 194 insertions(+) create mode 100644 external/cairo/pixman/Makefile.win32.common create mode 100644 external/cairo/pixman/pixman-0.24.4.patch create mode 100644 external/cairo/pixman/pixman-ofz4372.patch create mode 100644 external/cairo/pixman/pixman-ubsan.patch (limited to 'external/cairo/pixman') diff --git a/external/cairo/pixman/Makefile.win32.common b/external/cairo/pixman/Makefile.win32.common new file mode 100644 index 000000000..30b94e7b1 --- /dev/null +++ b/external/cairo/pixman/Makefile.win32.common @@ -0,0 +1,54 @@ +LIBRARY = pixman-1 + +CC = cl +LD = link +AR = lib +PERL = perl + +ifeq ($(top_builddir),) +top_builddir = $(top_srcdir) +endif + +CFG_VAR = $(CFG) +ifeq ($(CFG_VAR),) +CFG_VAR = release +endif + +ifeq ($(CFG_VAR),debug) +CFG_CFLAGS = -MD -Od -Zi +CFG_LDFLAGS = -DEBUG +else +CFG_CFLAGS = -MD -O2 +CFG_LDFLAGS = +endif + +# Package definitions, to be used instead of those provided in config.h +PKG_CFLAGS = -DPACKAGE=$(LIBRARY) -DPACKAGE_VERSION="" -DPACKAGE_BUGREPORT="" + +BASE_CFLAGS = -nologo -I. -I$(top_srcdir) -I$(top_srcdir)/pixman + +PIXMAN_CFLAGS = $(BASE_CFLAGS) $(PKG_CFLAGS) $(CFG_CFLAGS) $(CFLAGS) +PIXMAN_LDFLAGS = -nologo $(CFG_LDFLAGS) $(LDFLAGS) +PIXMAN_ARFLAGS = -nologo $(LDFLAGS) + + +inform: +ifneq ($(CFG),release) +ifneq ($(CFG),debug) +ifneq ($(CFG),) + @echo "Invalid specified configuration option: "$(CFG)"." + @echo + @echo "Possible choices for configuration are 'release' and 'debug'" + @exit 1 +endif + @echo "Using default RELEASE configuration... (use CFG=release or CFG=debug)" +endif +endif + + +$(CFG_VAR)/%.obj: %.c $(BUILT_SOURCES) + @mkdir -p $(CFG_VAR) + @$(CC) -c $(PIXMAN_CFLAGS) -Fo"$@" $< + +clean: inform + @$(RM) $(CFG_VAR)/*.{exe,ilk,lib,obj,pdb} $(BUILT_SOURCES) || exit 0 diff --git a/external/cairo/pixman/pixman-0.24.4.patch b/external/cairo/pixman/pixman-0.24.4.patch new file mode 100644 index 000000000..6d871e37b --- /dev/null +++ b/external/cairo/pixman/pixman-0.24.4.patch @@ -0,0 +1,91 @@ +--- misc/pixman-0.24.4/Makefile.in 2011-11-06 22:11:25.000000000 +0100 ++++ misc/build/pixman-0.24.4/Makefile.in 2011-12-16 09:06:45.317211035 +0100 +@@ -272,7 +272,7 @@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ +-SUBDIRS = pixman demos test ++SUBDIRS = pixman + pkgconfigdir = $(libdir)/pkgconfig + pkgconfig_DATA = pixman-1.pc + GPGKEY = 3892336E +--- misc/pixman-0.24.4/pixman/pixman-utils.c ++++ misc/build/pixman-0.24.4/pixman/pixman-utils.c +@@ -27,6 +27,7 @@ + #endif + #include + #include ++#include + + #include "pixman-private.h" + +--- misc/pixman-0.24.4/pixman/pixman-glyph.c 2015-06-30 05:48:31.000000000 -0400 ++++ misc/build/pixman-0.24.4/pixman/pixman-glyph.c 2017-11-25 13:26:33.075558418 -0500 +@@ -38,6 +38,7 @@ + + /* XXX: These numbers are arbitrary---we've never done any measurements. + */ ++#define N_PIXELS_HIGH_WATER (4 * 1024 * 1024) + #define N_GLYPHS_HIGH_WATER (16384) + #define N_GLYPHS_LOW_WATER (8192) + #define HASH_SIZE (2 * N_GLYPHS_HIGH_WATER) +@@ -58,6 +59,7 @@ + int n_glyphs; + int n_tombstones; + int freeze_count; ++ long n_pixels; + pixman_list_t mru; + glyph_t * glyphs[HASH_SIZE]; + }; +@@ -133,6 +135,7 @@ + if (*loc == TOMBSTONE) + cache->n_tombstones--; + cache->n_glyphs++; ++ cache->n_pixels += glyph->image->bits.width * glyph->image->bits.height; + + *loc = glyph; + } +@@ -150,6 +153,7 @@ + cache->glyphs[idx & HASH_MASK] = TOMBSTONE; + cache->n_tombstones++; + cache->n_glyphs--; ++ cache->n_pixels -= glyph->image->bits.width * glyph->image->bits.height; + + /* Eliminate tombstones if possible */ + if (cache->glyphs[(idx + 1) & HASH_MASK] == NULL) +@@ -180,6 +184,7 @@ + + cache->n_glyphs = 0; + cache->n_tombstones = 0; ++ cache->n_pixels = 0; + } + + PIXMAN_EXPORT pixman_glyph_cache_t * +@@ -194,6 +199,7 @@ + cache->n_glyphs = 0; + cache->n_tombstones = 0; + cache->freeze_count = 0; ++ cache->n_pixels = 0; + + pixman_list_init (&cache->mru); + +@@ -220,9 +226,9 @@ + pixman_glyph_cache_thaw (pixman_glyph_cache_t *cache) + { + if (--cache->freeze_count == 0 && +- cache->n_glyphs + cache->n_tombstones > N_GLYPHS_HIGH_WATER) ++ (cache->n_glyphs + cache->n_tombstones > N_GLYPHS_HIGH_WATER || cache->n_pixels > N_PIXELS_HIGH_WATER)) + { +- if (cache->n_tombstones > N_GLYPHS_HIGH_WATER) ++ if (cache->n_tombstones > N_GLYPHS_LOW_WATER) + { + /* More than half the entries are + * tombstones. Just dump the whole table. +@@ -230,7 +236,7 @@ + clear_table (cache); + } + +- while (cache->n_glyphs > N_GLYPHS_LOW_WATER) ++ while (cache->n_glyphs > N_GLYPHS_LOW_WATER || cache->n_pixels > N_PIXELS_HIGH_WATER) + { + glyph_t *glyph = CONTAINER_OF (glyph_t, mru_link, cache->mru.tail); diff --git a/external/cairo/pixman/pixman-ofz4372.patch b/external/cairo/pixman/pixman-ofz4372.patch new file mode 100644 index 000000000..aaf83f11d --- /dev/null +++ b/external/cairo/pixman/pixman-ofz4372.patch @@ -0,0 +1,16 @@ +--- 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 new file mode 100644 index 000000000..583706ae1 --- /dev/null +++ b/external/cairo/pixman/pixman-ubsan.patch @@ -0,0 +1,33 @@ +--- 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 +@@ -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; +--- misc/pixman/pixman/pixman-bits-image.c ++++ misc/build/pixman/pixman/pixman-bits-image.c +@@ -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 -- cgit v1.2.3