mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-06 05:48:00 +02:00
Merge branch 'enhancements' into 'master'
Fixes for the new release Closes #929 and #921 See merge request cairo/cairo!661
This commit is contained in:
commit
662b072733
6 changed files with 58 additions and 39 deletions
|
|
@ -148,9 +148,13 @@ check_headers = [
|
|||
check_types = [
|
||||
['uint64_t', {'headers': ['stdint.h']}],
|
||||
['uint128_t', {'headers': ['stdint.h']}],
|
||||
['__uint128_t']
|
||||
]
|
||||
|
||||
# https://github.com/llvm/llvm-project/issues/25679
|
||||
if cc.get_id() != 'clang-cl'
|
||||
check_types += [ ['__uint128_t'] ]
|
||||
endif
|
||||
|
||||
check_funcs = [
|
||||
'alarm',
|
||||
'ctime_r',
|
||||
|
|
|
|||
|
|
@ -1095,8 +1095,6 @@ draw_paint (cairo_colr_glyph_render_t *render,
|
|||
FT_Vector orig_delta;
|
||||
cairo_status_t status = CAIRO_STATUS_SUCCESS;
|
||||
|
||||
assert (cairo_status (cr) == CAIRO_STATUS_SUCCESS);
|
||||
|
||||
if (!FT_Get_Paint (render->face, *paint, &p))
|
||||
return CAIRO_STATUS_NO_MEMORY;
|
||||
|
||||
|
|
|
|||
|
|
@ -62,9 +62,10 @@
|
|||
#endif
|
||||
|
||||
#if PIXMAN_HAS_ATOMIC_OPS
|
||||
static pixman_image_t *__pixman_transparent_image;
|
||||
static pixman_image_t *__pixman_black_image;
|
||||
static pixman_image_t *__pixman_white_image;
|
||||
|
||||
static cairo_atomic_intptr_t __pixman_transparent_image; /* (pixman_image_t *) */
|
||||
static cairo_atomic_intptr_t __pixman_black_image;
|
||||
static cairo_atomic_intptr_t __pixman_white_image;
|
||||
|
||||
static pixman_image_t *
|
||||
_pixman_transparent_image (void)
|
||||
|
|
@ -73,7 +74,7 @@ _pixman_transparent_image (void)
|
|||
|
||||
TRACE ((stderr, "%s\n", __FUNCTION__));
|
||||
|
||||
image = __pixman_transparent_image;
|
||||
image = (pixman_image_t *) _cairo_atomic_ptr_get (&__pixman_transparent_image);
|
||||
if (unlikely (image == NULL)) {
|
||||
pixman_color_t color;
|
||||
|
||||
|
|
@ -105,7 +106,7 @@ _pixman_black_image (void)
|
|||
|
||||
TRACE ((stderr, "%s\n", __FUNCTION__));
|
||||
|
||||
image = __pixman_black_image;
|
||||
image = (pixman_image_t *) _cairo_atomic_ptr_get (&__pixman_black_image);
|
||||
if (unlikely (image == NULL)) {
|
||||
pixman_color_t color;
|
||||
|
||||
|
|
@ -137,7 +138,7 @@ _pixman_white_image (void)
|
|||
|
||||
TRACE ((stderr, "%s\n", __FUNCTION__));
|
||||
|
||||
image = __pixman_white_image;
|
||||
image = (pixman_image_t *) _cairo_atomic_ptr_get (&__pixman_white_image);
|
||||
if (unlikely (image == NULL)) {
|
||||
pixman_color_t color;
|
||||
|
||||
|
|
@ -178,6 +179,7 @@ static struct {
|
|||
static int n_cached;
|
||||
|
||||
#else /* !PIXMAN_HAS_ATOMIC_OPS */
|
||||
|
||||
static pixman_image_t *
|
||||
_pixman_transparent_image (void)
|
||||
{
|
||||
|
|
@ -198,6 +200,7 @@ _pixman_white_image (void)
|
|||
TRACE ((stderr, "%s\n", __FUNCTION__));
|
||||
return _pixman_image_for_color (CAIRO_COLOR_WHITE);
|
||||
}
|
||||
|
||||
#endif /* !PIXMAN_HAS_ATOMIC_OPS */
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -162,7 +162,6 @@ csi_file_new_from_string (csi_t *ctx,
|
|||
file->base.ref = 1;
|
||||
|
||||
if (src->deflate) {
|
||||
uLongf len = src->deflate;
|
||||
csi_object_t tmp_obj;
|
||||
csi_string_t *tmp_str;
|
||||
csi_status_t status;
|
||||
|
|
@ -179,20 +178,26 @@ csi_file_new_from_string (csi_t *ctx,
|
|||
break;
|
||||
|
||||
case ZLIB:
|
||||
{
|
||||
#if HAVE_ZLIB
|
||||
uLongf len = src->deflate;
|
||||
if (uncompress ((Bytef *) tmp_str->string, &len,
|
||||
(Bytef *) src->string, src->len) != Z_OK)
|
||||
#endif
|
||||
status = _csi_error (CAIRO_STATUS_NO_MEMORY);
|
||||
break;
|
||||
}
|
||||
case LZO:
|
||||
{
|
||||
#if HAVE_LZO
|
||||
lzo_uint len = src->deflate;
|
||||
if (lzo2a_decompress ((lzo_bytep) src->string, src->len,
|
||||
(lzo_bytep) tmp_str->string, &len,
|
||||
NULL))
|
||||
#endif
|
||||
status = _csi_error (CAIRO_STATUS_NO_MEMORY);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (_csi_unlikely (status)) {
|
||||
csi_string_free (ctx, tmp_str);
|
||||
|
|
|
|||
|
|
@ -1758,46 +1758,47 @@ _mmap_bytes (const struct mmap_vec *vec, int count)
|
|||
static void *
|
||||
inflate_string (csi_t *ctx, csi_string_t *src)
|
||||
{
|
||||
uLongf len;
|
||||
uint8_t *bytes;
|
||||
|
||||
len = src->deflate;
|
||||
bytes = _csi_alloc (ctx, len + 1);
|
||||
bytes = _csi_alloc (ctx, src->deflate + 1);
|
||||
if (bytes == NULL)
|
||||
return NULL;
|
||||
|
||||
switch (src->method) {
|
||||
default:
|
||||
case NONE:
|
||||
free (bytes);
|
||||
return NULL;
|
||||
|
||||
case ZLIB:
|
||||
{
|
||||
#if HAVE_ZLIB
|
||||
if (uncompress ((Bytef *) bytes, &len,
|
||||
(Bytef *) src->string, src->len) != Z_OK)
|
||||
#endif
|
||||
uLongf length = src->deflate;
|
||||
if (uncompress ((Bytef *) bytes, &length,
|
||||
(Bytef *) src->string, src->len) == Z_OK)
|
||||
{
|
||||
_csi_free (ctx, bytes);
|
||||
return NULL;
|
||||
bytes[length] = '\0';
|
||||
return bytes;
|
||||
}
|
||||
break;
|
||||
|
||||
case LZO:
|
||||
#if HAVE_LZO
|
||||
if (lzo2a_decompress ((Bytef *) src->string, src->len,
|
||||
(Bytef *) bytes, &len,
|
||||
NULL))
|
||||
#endif
|
||||
{
|
||||
_csi_free (ctx, bytes);
|
||||
return NULL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case LZO:
|
||||
{
|
||||
#if HAVE_LZO
|
||||
lzo_uint length = src->deflate;
|
||||
if (lzo2a_decompress ((Bytef *) src->string, src->len,
|
||||
(Bytef *) bytes, &length,
|
||||
NULL) == LZO_E_OK)
|
||||
{
|
||||
bytes[length] = '\0';
|
||||
return bytes;
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case NONE:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bytes[len] = '\0';
|
||||
return bytes;
|
||||
_csi_free (ctx, bytes);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static csi_status_t
|
||||
|
|
@ -2982,7 +2983,6 @@ _image_read_raw (csi_t *ctx,
|
|||
len == src->datum.string->deflate)
|
||||
{
|
||||
csi_string_t *s = src->datum.string;
|
||||
unsigned long out = s->deflate;
|
||||
|
||||
switch (s->method) {
|
||||
default:
|
||||
|
|
@ -2992,21 +2992,27 @@ err_decompress:
|
|||
return _csi_error (CSI_STATUS_READ_ERROR);
|
||||
|
||||
case ZLIB:
|
||||
{
|
||||
#if HAVE_ZLIB
|
||||
uLongf out = s->deflate;
|
||||
if (uncompress ((Bytef *) data, &out,
|
||||
(Bytef *) s->string, s->len) != Z_OK)
|
||||
#endif
|
||||
goto err_decompress;
|
||||
break;
|
||||
}
|
||||
|
||||
case LZO:
|
||||
{
|
||||
#if HAVE_LZO
|
||||
lzo_uint out = s->deflate;
|
||||
if (lzo2a_decompress ((Bytef *) s->string, s->len,
|
||||
(Bytef *) data, &out,
|
||||
NULL))
|
||||
#endif
|
||||
goto err_decompress;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1595,7 +1595,10 @@ _translate_string (csi_t *ctx,
|
|||
|
||||
#if HAVE_LZO
|
||||
if (method == NONE && buf_len > 16) {
|
||||
unsigned long mem_len = 2*string->len > LZO2A_999_MEM_COMPRESS ? 2*string->len : LZO2A_999_MEM_COMPRESS;
|
||||
lzo_uint mem_len = 2 * (lzo_uint)string->len;
|
||||
if (mem_len < LZO2A_999_MEM_COMPRESS)
|
||||
mem_len = LZO2A_999_MEM_COMPRESS;
|
||||
|
||||
void *mem = malloc (mem_len);
|
||||
void *work = malloc(LZO2A_999_MEM_COMPRESS);
|
||||
|
||||
|
|
@ -1628,7 +1631,7 @@ _translate_string (csi_t *ctx,
|
|||
method = NONE;
|
||||
deflate = 0;
|
||||
} else {
|
||||
unsigned long mem_len = 2*string->deflate;
|
||||
lzo_uint mem_len = 2*string->deflate;
|
||||
void *mem = malloc (mem_len);
|
||||
void *work = malloc(LZO2A_999_MEM_COMPRESS);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue