diff options
Diffstat (limited to 'Build/source/libs/cairo/cairo-src/src/cairo-image-compositor.c')
-rw-r--r-- | Build/source/libs/cairo/cairo-src/src/cairo-image-compositor.c | 70 |
1 files changed, 48 insertions, 22 deletions
diff --git a/Build/source/libs/cairo/cairo-src/src/cairo-image-compositor.c b/Build/source/libs/cairo/cairo-src/src/cairo-image-compositor.c index 48072f81bd0..bbf4cf2281d 100644 --- a/Build/source/libs/cairo/cairo-src/src/cairo-image-compositor.c +++ b/Build/source/libs/cairo/cairo-src/src/cairo-image-compositor.c @@ -821,6 +821,18 @@ get_glyph_cache (void) } void +_cairo_image_compositor_reset_static_data (void) +{ + CAIRO_MUTEX_LOCK (_cairo_glyph_cache_mutex); + + if (global_glyph_cache) + pixman_glyph_cache_destroy (global_glyph_cache); + global_glyph_cache = NULL; + + CAIRO_MUTEX_UNLOCK (_cairo_glyph_cache_mutex); +} + +void _cairo_image_scaled_glyph_fini (cairo_scaled_font_t *scaled_font, cairo_scaled_glyph_t *scaled_glyph) { @@ -946,6 +958,11 @@ out_unlock: } #else void +_cairo_image_compositor_reset_static_data (void) +{ +} + +void _cairo_image_scaled_glyph_fini (cairo_scaled_font_t *scaled_font, cairo_scaled_glyph_t *scaled_glyph) { @@ -1244,11 +1261,12 @@ check_composite (const cairo_composite_rectangles_t *extents) const cairo_compositor_t * _cairo_image_traps_compositor_get (void) { + static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT; static cairo_traps_compositor_t compositor; - if (compositor.base.delegate == NULL) { - _cairo_traps_compositor_init (&compositor, - &__cairo_no_compositor); + if (_cairo_atomic_init_once_enter(&once)) { + _cairo_traps_compositor_init(&compositor, + &__cairo_no_compositor); compositor.acquire = acquire; compositor.release = release; compositor.set_clip_region = set_clip_region; @@ -1269,6 +1287,8 @@ _cairo_image_traps_compositor_get (void) #endif compositor.check_composite_glyphs = check_composite_glyphs; compositor.composite_glyphs = composite_glyphs; + + _cairo_atomic_init_once_leave(&once); } return &compositor.base; @@ -1277,9 +1297,10 @@ _cairo_image_traps_compositor_get (void) const cairo_compositor_t * _cairo_image_mask_compositor_get (void) { + static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT; static cairo_mask_compositor_t compositor; - if (compositor.base.delegate == NULL) { + if (_cairo_atomic_init_once_enter(&once)) { _cairo_mask_compositor_init (&compositor, _cairo_image_traps_compositor_get ()); compositor.acquire = acquire; @@ -1296,6 +1317,8 @@ _cairo_image_mask_compositor_get (void) compositor.composite_boxes = composite_boxes; compositor.check_composite_glyphs = check_composite_glyphs; compositor.composite_glyphs = composite_glyphs; + + _cairo_atomic_init_once_leave(&once); } return &compositor.base; @@ -1575,7 +1598,7 @@ typedef struct _cairo_image_span_renderer { pixman_image_t *src, *mask; union { struct fill { - int stride; + ptrdiff_t stride; uint8_t *data; uint32_t pixel; } fill; @@ -1594,7 +1617,7 @@ typedef struct _cairo_image_span_renderer { struct finish { cairo_rectangle_int_t extents; int src_x, src_y; - int stride; + ptrdiff_t stride; uint8_t *data; } mask; } u; @@ -1763,7 +1786,7 @@ _fill16_spans (void *abstract_renderer, int y, int h, if (spans[0].coverage) { int len = spans[1].x - spans[0].x; uint16_t *d = (uint16_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*2); - while (len--) + while (len-- > 0) *d++ = r->u.fill.pixel; } spans++; @@ -1775,7 +1798,7 @@ _fill16_spans (void *abstract_renderer, int y, int h, do { int len = spans[1].x - spans[0].x; uint16_t *d = (uint16_t*)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*2); - while (len--) + while (len-- > 0) *d++ = r->u.fill.pixel; yy++; } while (--hh); @@ -1805,7 +1828,7 @@ _fill32_spans (void *abstract_renderer, int y, int h, spans[0].x, y, len, 1, r->u.fill.pixel); } else { uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4); - while (len--) + while (len-- > 0) *d++ = r->u.fill.pixel; } } @@ -1823,7 +1846,7 @@ _fill32_spans (void *abstract_renderer, int y, int h, do { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*4); - while (len--) + while (len-- > 0) *d++ = r->u.fill.pixel; yy++; } while (--hh); @@ -2180,7 +2203,7 @@ _fill_a8_lerp_opaque_spans (void *abstract_renderer, int y, int h, uint8_t s = mul8_8(a, r->u.fill.pixel); uint8_t *dst = d + spans[0].x; a = ~a; - while (len--) { + while (len-- > 0) { uint8_t t = mul8_8(*dst, a); *dst++ = t + s; } @@ -2206,7 +2229,7 @@ _fill_a8_lerp_opaque_spans (void *abstract_renderer, int y, int h, do { int len = spans[1].x - spans[0].x; uint8_t *d = r->u.fill.data + r->u.fill.stride*yy + spans[0].x; - while (len--) { + while (len-- > 0) { uint8_t t = mul8_8(*d, a); *d++ = t + s; } @@ -2266,7 +2289,7 @@ _fill_xrgb32_lerp_opaque_spans (void *abstract_renderer, int y, int h, do { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*4); - while (len--) + while (len-- > 0) *d++ = r->u.fill.pixel; yy++; } while (--hh); @@ -2276,7 +2299,7 @@ _fill_xrgb32_lerp_opaque_spans (void *abstract_renderer, int y, int h, do { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t *)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*4); - while (len--) { + while (len-- > 0) { *d = lerp8x4 (r->u.fill.pixel, a, *d); d++; } @@ -2308,7 +2331,7 @@ _fill_a8_lerp_spans (void *abstract_renderer, int y, int h, uint8_t *d = r->u.fill.data + r->u.fill.stride*y + spans[0].x; uint16_t p = (uint16_t)a * r->u.fill.pixel + 0x7f; uint16_t ia = ~a; - while (len--) { + while (len-- > 0) { uint16_t t = *d*ia + p; *d++ = (t + (t>>8)) >> 8; } @@ -2325,7 +2348,7 @@ _fill_a8_lerp_spans (void *abstract_renderer, int y, int h, do { int len = spans[1].x - spans[0].x; uint8_t *d = r->u.fill.data + r->u.fill.stride*yy + spans[0].x; - while (len--) { + while (len-- > 0) { uint16_t t = *d*ia + p; *d++ = (t + (t>>8)) >> 8; } @@ -2354,7 +2377,7 @@ _fill_xrgb32_lerp_spans (void *abstract_renderer, int y, int h, if (a) { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4); - while (len--) { + while (len-- > 0) { *d = lerp8x4 (r->u.fill.pixel, a, *d); d++; } @@ -2369,7 +2392,7 @@ _fill_xrgb32_lerp_spans (void *abstract_renderer, int y, int h, do { int len = spans[1].x - spans[0].x; uint32_t *d = (uint32_t *)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*4); - while (len--) { + while (len-- > 0) { *d = lerp8x4 (r->u.fill.pixel, a, *d); d++; } @@ -2407,7 +2430,7 @@ _blit_xrgb32_lerp_spans (void *abstract_renderer, int y, int h, else memcpy(d, s, len*4); } else { - while (len--) { + while (len-- > 0) { *d = lerp8x4 (*s, a, *d); s++, d++; } @@ -2430,7 +2453,7 @@ _blit_xrgb32_lerp_spans (void *abstract_renderer, int y, int h, else memcpy(d, s, len * 4); } else { - while (len--) { + while (len-- > 0) { *d = lerp8x4 (*s, a, *d); s++, d++; } @@ -2911,7 +2934,7 @@ inplace_renderer_init (cairo_image_span_renderer_t *r, /* Create an effectively unbounded mask by repeating the single line */ buf = r->_buf; if (width > SZ_BUF) { - buf = malloc (width); + buf = _cairo_malloc (width); if (unlikely (buf == NULL)) { pixman_image_unref (r->src); return _cairo_error (CAIRO_STATUS_NO_MEMORY); @@ -3105,10 +3128,11 @@ span_renderer_fini (cairo_abstract_span_renderer_t *_r, const cairo_compositor_t * _cairo_image_spans_compositor_get (void) { + static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT; static cairo_spans_compositor_t spans; static cairo_compositor_t shape; - if (spans.base.delegate == NULL) { + if (_cairo_atomic_init_once_enter(&once)) { _cairo_shape_mask_compositor_init (&shape, _cairo_image_traps_compositor_get()); shape.glyphs = NULL; @@ -3131,6 +3155,8 @@ _cairo_image_spans_compositor_get (void) //spans.check_span_renderer = check_span_renderer; spans.renderer_init = span_renderer_init; spans.renderer_fini = span_renderer_fini; + + _cairo_atomic_init_once_leave(&once); } return &spans.base; |