diff options
author | Moonchild <moonchild@palemoon.org> | 2022-04-05 14:51:06 +0200 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2022-04-05 14:51:06 +0200 |
commit | 6e6b5d89964ea726b264c711bdf6f02fe0c006f5 (patch) | |
tree | a56f756f47a7ae3e45d66ccf02279ac2d22f0d1f /gfx/cairo/libpixman/src/pixman-utils.c | |
parent | 12635c1c22573509bd33bcdb13be0e9aa4676a4a (diff) | |
download | uxp-6e6b5d89964ea726b264c711bdf6f02fe0c006f5.tar.gz |
Issue #1795 - Update libpixman
Diffstat (limited to 'gfx/cairo/libpixman/src/pixman-utils.c')
-rw-r--r-- | gfx/cairo/libpixman/src/pixman-utils.c | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/gfx/cairo/libpixman/src/pixman-utils.c b/gfx/cairo/libpixman/src/pixman-utils.c index b2ffb8ca2c..2c2dddd64c 100644 --- a/gfx/cairo/libpixman/src/pixman-utils.c +++ b/gfx/cairo/libpixman/src/pixman-utils.c @@ -27,7 +27,6 @@ #endif #include <stdio.h> #include <stdlib.h> -#include <limits.h> #include "pixman-private.h" @@ -50,6 +49,15 @@ _pixman_addition_overflows_int (unsigned int a, unsigned int b) } void * +pixman_malloc_ab_plus_c (unsigned int a, unsigned int b, unsigned int c) +{ + if (!b || a >= INT32_MAX / b || (a * b) > INT32_MAX - c) + return NULL; + + return malloc (a * b + c); +} + +void * pixman_malloc_ab (unsigned int a, unsigned int b) { @@ -198,7 +206,7 @@ pixman_contract_from_float (uint32_t *dst, for (i = 0; i < width; ++i) { - uint8_t a, r, g, b; + uint32_t a, r, g, b; a = float_to_unorm (src[i].a, 8); r = float_to_unorm (src[i].r, 8); @@ -215,6 +223,17 @@ _pixman_iter_get_scanline_noop (pixman_iter_t *iter, const uint32_t *mask) return iter->buffer; } +void +_pixman_iter_init_bits_stride (pixman_iter_t *iter, const pixman_iter_info_t *info) +{ + pixman_image_t *image = iter->image; + uint8_t *b = (uint8_t *)image->bits.bits; + int s = image->bits.rowstride * 4; + + iter->bits = b + s * iter->y + iter->x * PIXMAN_FORMAT_BPP (info->format) / 8; + iter->stride = s; +} + #define N_TMP_BOXES (16) pixman_bool_t @@ -293,8 +312,6 @@ _pixman_internal_only_get_implementation (void) return get_implementation (); } -#ifdef DEBUG - void _pixman_log_error (const char *function, const char *message) { @@ -311,5 +328,3 @@ _pixman_log_error (const char *function, const char *message) n_messages++; } } - -#endif |