_cairo_array_init:
   59|    760|{
   60|    760|    array->size = 0;
   61|    760|    array->num_elements = 0;
   62|    760|    array->element_size = element_size;
   63|       |    array->elements = NULL;
   64|    760|}
_cairo_array_fini:
   76|    755|{
   77|    755|    free (array->elements);
   78|    755|}
_cairo_array_grow_by:
   90|  1.91M|{
   91|  1.91M|    char *new_elements;
   92|  1.91M|    unsigned int old_size = array->size;
   93|  1.91M|    unsigned int required_size = array->num_elements + additional;
   94|  1.91M|    unsigned int new_size;
   95|       |
   96|       |    /* check for integer overflow */
   97|  1.91M|    if (required_size > INT_MAX || required_size < array->num_elements)
  ------------------
  |  Branch (97:9): [True: 0, False: 1.91M]
  |  Branch (97:36): [True: 0, False: 1.91M]
  ------------------
   98|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
   99|       |
  100|  1.91M|    if (CAIRO_INJECT_FAULT ())
  ------------------
  |  |   47|  1.91M|#define CAIRO_INJECT_FAULT() 0
  |  |  ------------------
  |  |  |  Branch (47:30): [Folded, False: 1.91M]
  |  |  ------------------
  ------------------
  101|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  102|       |
  103|  1.91M|    if (required_size <= old_size)
  ------------------
  |  Branch (103:9): [True: 1.91M, False: 1.85k]
  ------------------
  104|  1.91M|	return CAIRO_STATUS_SUCCESS;
  105|       |
  106|  1.85k|    if (old_size == 0)
  ------------------
  |  Branch (106:9): [True: 503, False: 1.35k]
  ------------------
  107|    503|	new_size = 1;
  108|  1.35k|    else
  109|  1.35k|	new_size = old_size * 2;
  110|       |
  111|  3.50k|    while (new_size < required_size)
  ------------------
  |  Branch (111:12): [True: 1.65k, False: 1.85k]
  ------------------
  112|  1.65k|	new_size = new_size * 2;
  113|       |
  114|  1.85k|    array->size = new_size;
  115|  1.85k|    new_elements = _cairo_realloc_ab (array->elements,
  116|  1.85k|			              array->size, array->element_size);
  117|       |
  118|  1.85k|    if (unlikely (new_elements == NULL)) {
  ------------------
  |  |  145|  1.85k|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1.85k]
  |  |  ------------------
  ------------------
  119|      0|	array->size = old_size;
  120|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  121|      0|    }
  122|       |
  123|  1.85k|    array->elements = new_elements;
  124|       |
  125|  1.85k|    return CAIRO_STATUS_SUCCESS;
  126|  1.85k|}
_cairo_array_index:
  168|    252|{
  169|       |    /* We allow an index of 0 for the no-elements case.
  170|       |     * This makes for cleaner calling code which will often look like:
  171|       |     *
  172|       |     *    elements = _cairo_array_index (array, 0);
  173|       |     *	  for (i=0; i < num_elements; i++) {
  174|       |     *        ... use elements[i] here ...
  175|       |     *    }
  176|       |     *
  177|       |     * which in the num_elements==0 case gets the NULL pointer here,
  178|       |     * but never dereferences it.
  179|       |     */
  180|    252|    if (index == 0 && array->num_elements == 0)
  ------------------
  |  Branch (180:9): [True: 252, False: 0]
  |  Branch (180:23): [True: 84, False: 168]
  ------------------
  181|     84|	return NULL;
  182|       |
  183|    252|    assert (index < array->num_elements);
  ------------------
  |  Branch (183:5): [True: 0, False: 168]
  |  Branch (183:5): [True: 168, False: 0]
  ------------------
  184|       |
  185|    168|    return array->elements + (size_t)index * array->element_size;
  186|    168|}
_cairo_array_append:
  266|     84|{
  267|     84|    return _cairo_array_append_multiple (array, element, 1);
  268|     84|}
_cairo_array_append_multiple:
  286|  1.91M|{
  287|  1.91M|    cairo_status_t status;
  288|  1.91M|    void *dest;
  289|       |
  290|  1.91M|    status = _cairo_array_allocate (array, num_elements, &dest);
  291|  1.91M|    if (unlikely (status))
  ------------------
  |  |  145|  1.91M|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1.91M]
  |  |  ------------------
  ------------------
  292|      0|	return status;
  293|       |
  294|  1.91M|    memcpy (dest, elements, (size_t)num_elements * array->element_size);
  295|       |
  296|  1.91M|    return CAIRO_STATUS_SUCCESS;
  297|  1.91M|}
_cairo_array_allocate:
  316|  1.91M|{
  317|  1.91M|    cairo_status_t status;
  318|       |
  319|  1.91M|    status = _cairo_array_grow_by (array, num_elements);
  320|  1.91M|    if (unlikely (status))
  ------------------
  |  |  145|  1.91M|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1.91M]
  |  |  ------------------
  ------------------
  321|      0|	return status;
  322|       |
  323|  1.91M|    assert (array->num_elements + num_elements <= array->size);
  ------------------
  |  Branch (323:5): [True: 0, False: 1.91M]
  |  Branch (323:5): [True: 1.91M, False: 0]
  ------------------
  324|       |
  325|  1.91M|    *elements = array->elements + (size_t)array->num_elements * array->element_size;
  326|       |
  327|  1.91M|    array->num_elements += num_elements;
  328|       |
  329|  1.91M|    return CAIRO_STATUS_SUCCESS;
  330|  1.91M|}
_cairo_array_num_elements:
  342|     84|{
  343|     84|    return array->num_elements;
  344|     84|}
_cairo_user_data_array_init:
  372|    340|{
  373|    340|    _cairo_array_init (array, sizeof (cairo_user_data_slot_t));
  374|    340|}
_cairo_user_data_array_fini:
  385|    336|{
  386|    336|    unsigned int num_slots;
  387|       |
  388|    336|    num_slots = array->num_elements;
  389|    336|    if (num_slots) {
  ------------------
  |  Branch (389:9): [True: 84, False: 252]
  ------------------
  390|     84|	cairo_user_data_slot_t *slots;
  391|       |
  392|     84|	slots = _cairo_array_index (array, 0);
  393|    168|	while (num_slots--) {
  ------------------
  |  Branch (393:9): [True: 84, False: 84]
  ------------------
  394|     84|	    cairo_user_data_slot_t *s = &slots[num_slots];
  395|     84|	    if (s->user_data != NULL && s->destroy != NULL)
  ------------------
  |  Branch (395:10): [True: 84, False: 0]
  |  Branch (395:34): [True: 84, False: 0]
  ------------------
  396|     84|		s->destroy (s->user_data);
  397|     84|	}
  398|     84|    }
  399|       |
  400|    336|    _cairo_array_fini (array);
  401|    336|}
_cairo_user_data_array_set_data:
  457|     84|{
  458|     84|    cairo_status_t status;
  459|     84|    unsigned int i, num_slots;
  460|     84|    cairo_user_data_slot_t *slots, *slot, new_slot;
  461|       |
  462|     84|    if (user_data) {
  ------------------
  |  Branch (462:9): [True: 84, False: 0]
  ------------------
  463|     84|	new_slot.key = key;
  464|     84|	new_slot.user_data = user_data;
  465|     84|	new_slot.destroy = destroy;
  466|     84|    } else {
  467|      0|	new_slot.key = NULL;
  468|      0|	new_slot.user_data = NULL;
  469|      0|	new_slot.destroy = NULL;
  470|      0|    }
  471|       |
  472|     84|    slot = NULL;
  473|     84|    num_slots = array->num_elements;
  474|     84|    slots = _cairo_array_index (array, 0);
  475|     84|    for (i = 0; i < num_slots; i++) {
  ------------------
  |  Branch (475:17): [True: 0, False: 84]
  ------------------
  476|      0|	if (slots[i].key == key) {
  ------------------
  |  Branch (476:6): [True: 0, False: 0]
  ------------------
  477|      0|	    slot = &slots[i];
  478|      0|	    if (slot->destroy && slot->user_data)
  ------------------
  |  Branch (478:10): [True: 0, False: 0]
  |  Branch (478:27): [True: 0, False: 0]
  ------------------
  479|      0|		slot->destroy (slot->user_data);
  480|      0|	    break;
  481|      0|	}
  482|      0|	if (user_data && slots[i].user_data == NULL) {
  ------------------
  |  Branch (482:6): [True: 0, False: 0]
  |  Branch (482:19): [True: 0, False: 0]
  ------------------
  483|      0|	    slot = &slots[i];	/* Have to keep searching for an exact match */
  484|      0|	}
  485|      0|    }
  486|       |
  487|     84|    if (slot) {
  ------------------
  |  Branch (487:9): [True: 0, False: 84]
  ------------------
  488|      0|	*slot = new_slot;
  489|      0|	return CAIRO_STATUS_SUCCESS;
  490|      0|    }
  491|       |
  492|     84|    if (user_data == NULL)
  ------------------
  |  Branch (492:9): [True: 0, False: 84]
  ------------------
  493|      0|	return CAIRO_STATUS_SUCCESS;
  494|       |
  495|     84|    status = _cairo_array_append (array, &new_slot);
  496|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  497|      0|	return status;
  498|       |
  499|     84|    return CAIRO_STATUS_SUCCESS;
  500|     84|}

cairo-surface.c:_cairo_atomic_int_cmpxchg_impl:
   92|     84|{
   93|     84|    int expected = oldv;
   94|       |    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
   95|     84|}
cairo-surface.c:_cairo_atomic_int_get:
   61|  1.26k|{
   62|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   63|  1.26k|}
cairo.c:_cairo_atomic_int_get:
   61|    168|{
   62|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   63|    168|}
cairo.c:_cairo_atomic_int_cmpxchg_impl:
   92|     84|{
   93|     84|    int expected = oldv;
   94|       |    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
   95|     84|}
cairo-default-context.c:_cairo_atomic_int_get_relaxed:
   67|    168|{
   68|       |    return atomic_load_explicit (x, memory_order_relaxed);
   69|    168|}
cairo-default-context.c:_cairo_atomic_ptr_get:
   79|     84|{
   80|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   81|     84|}
cairo-default-context.c:_cairo_atomic_ptr_cmpxchg_impl:
  115|    168|{
  116|    168|    void *expected = oldv;
  117|       |    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
  118|    168|}
cairo-default-context.c:_cairo_atomic_int_set_relaxed:
   73|    167|{
   74|       |    atomic_store_explicit (x, val, memory_order_relaxed);
   75|    167|}
cairo-font-face.c:_cairo_atomic_int_get:
   61|    345|{
   62|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   63|    345|}
cairo-font-face.c:_cairo_atomic_int_cmpxchg_return_old_impl:
  104|     86|{
  105|     86|    int expected = oldv;
  106|       |    (void) atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
  107|     86|    return expected;
  108|     86|}
cairo-freed-pool.c:_cairo_atomic_ptr_get:
   79|     16|{
   80|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   81|     16|}
cairo-freed-pool.c:_cairo_atomic_ptr_cmpxchg_impl:
  115|     16|{
  116|     16|    void *expected = oldv;
  117|       |    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
  118|     16|}
cairo-freed-pool.c:_cairo_atomic_int_set_relaxed:
   73|      1|{
   74|       |    atomic_store_explicit (x, val, memory_order_relaxed);
   75|      1|}
cairo-image-compositor.c:_cairo_atomic_init_once_enter:
  541|     85|{
  542|     85|    if (likely(_cairo_atomic_int_get(once) == CAIRO_ATOMIC_ONCE_INITIALIZED))
  ------------------
  |  |  144|     85|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 83, False: 2]
  |  |  ------------------
  ------------------
  543|     83|	return 0;
  544|       |
  545|      2|    if (_cairo_atomic_int_cmpxchg(once,
  ------------------
  |  |   98|      2|  _cairo_atomic_int_cmpxchg_impl(x, oldv, newv)
  |  |  ------------------
  |  |  |  Branch (98:3): [True: 2, False: 0]
  |  |  ------------------
  ------------------
  546|      2|				  CAIRO_ATOMIC_ONCE_UNINITIALIZED,
  547|      2|				  CAIRO_ATOMIC_ONCE_INITIALIZING))
  548|      2|	return 1;
  549|       |
  550|      0|    while (_cairo_atomic_int_get(once) != CAIRO_ATOMIC_ONCE_INITIALIZED) {}
  ------------------
  |  |  536|      0|#define CAIRO_ATOMIC_ONCE_INITIALIZED   (2)
  ------------------
  |  Branch (550:12): [True: 0, False: 0]
  ------------------
  551|      0|    return 0;
  552|      2|}
cairo-image-compositor.c:_cairo_atomic_int_get:
   61|     85|{
   62|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   63|     85|}
cairo-image-compositor.c:_cairo_atomic_int_cmpxchg_impl:
   92|      4|{
   93|      4|    int expected = oldv;
   94|       |    return atomic_compare_exchange_strong_explicit (x, &expected, newv, memory_order_seq_cst, memory_order_seq_cst);
   95|      4|}
cairo-image-compositor.c:_cairo_atomic_init_once_leave:
  556|      2|{
  557|      2|    if (unlikely(!_cairo_atomic_int_cmpxchg(once,
  ------------------
  |  |  145|      2|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  558|      2|					    CAIRO_ATOMIC_ONCE_INITIALIZING,
  559|      2|					    CAIRO_ATOMIC_ONCE_INITIALIZED)))
  560|       |	assert (0 && "incorrect use of _cairo_atomic_init_once API (once != CAIRO_ATOMIC_ONCE_INITIALIZING)");
  ------------------
  |  Branch (560:2): [Folded, False: 0]
  |  Branch (560:2): [True: 0, False: 0]
  |  Branch (560:2): [Folded, False: 0]
  |  Branch (560:2): [True: 0, False: 0]
  ------------------
  561|      2|}
cairo-pattern.c:_cairo_atomic_int_get:
   61|     84|{
   62|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   63|     84|}
cairo-scaled-font.c:_cairo_atomic_int_get:
   61|    168|{
   62|       |    return atomic_load_explicit (x, memory_order_seq_cst);
   63|    168|}

_cairo_hash_string:
  321|     87|{
  322|       |    /* This is the djb2 hash. */
  323|     87|    uintptr_t hash = _CAIRO_HASH_INIT_VALUE;
  ------------------
  |  |  386|     87|#define _CAIRO_HASH_INIT_VALUE 5381
  ------------------
  324|    195|    while (c && *c)
  ------------------
  |  Branch (324:12): [True: 195, False: 0]
  |  Branch (324:17): [True: 108, False: 87]
  ------------------
  325|    108|	hash = ((hash << 5) + hash) + *c++;
  326|     87|    return hash;
  327|     87|}

_cairo_clip_destroy:
  129|     84|{
  130|     84|    if (clip == NULL || _cairo_clip_is_all_clipped (clip))
  ------------------
  |  Branch (130:9): [True: 84, False: 0]
  |  Branch (130:25): [True: 0, False: 0]
  ------------------
  131|     84|	return;
  132|       |
  133|      0|    if (clip->path != NULL)
  ------------------
  |  Branch (133:9): [True: 0, False: 0]
  ------------------
  134|      0|	_cairo_clip_path_destroy (clip->path);
  135|       |
  136|      0|    if (clip->boxes != &clip->embedded_box)
  ------------------
  |  Branch (136:9): [True: 0, False: 0]
  ------------------
  137|      0|	free (clip->boxes);
  138|      0|    cairo_region_destroy (clip->region);
  139|       |
  140|      0|    _freed_pool_put (&clip_pool, clip);
  141|      0|}

_cairo_default_context_fini:
   69|     84|{
   70|     84|    while (cr->gstate != &cr->gstate_tail[0]) {
  ------------------
  |  Branch (70:12): [True: 0, False: 84]
  ------------------
   71|      0|	if (_cairo_gstate_restore (&cr->gstate, &cr->gstate_freelist))
  ------------------
  |  Branch (71:6): [True: 0, False: 0]
  ------------------
   72|      0|	    break;
   73|      0|    }
   74|       |
   75|     84|    _cairo_gstate_fini (cr->gstate);
   76|     84|    cr->gstate_freelist = cr->gstate_freelist->next; /* skip over tail[1] */
   77|     84|    while (cr->gstate_freelist != NULL) {
  ------------------
  |  Branch (77:12): [True: 0, False: 84]
  ------------------
   78|      0|	cairo_gstate_t *gstate = cr->gstate_freelist;
   79|      0|	cr->gstate_freelist = gstate->next;
   80|      0|	free (gstate);
   81|      0|    }
   82|       |
   83|     84|    _cairo_path_fixed_fini (cr->path);
   84|       |
   85|     84|    _cairo_fini (&cr->base);
   86|     84|}
_cairo_default_context_init:
 1497|     84|{
 1498|     84|    _cairo_init (&cr->base, &_cairo_default_context_backend);
 1499|     84|    _cairo_path_fixed_init (cr->path);
 1500|       |
 1501|     84|    cr->gstate = &cr->gstate_tail[0];
 1502|     84|    cr->gstate_freelist = &cr->gstate_tail[1];
 1503|     84|    cr->gstate_tail[1].next = NULL;
 1504|       |
 1505|     84|    return _cairo_gstate_init (cr->gstate, target);
 1506|     84|}
_cairo_default_context_create:
 1510|     84|{
 1511|     84|    cairo_default_context_t *cr;
 1512|     84|    cairo_status_t status;
 1513|       |
 1514|     84|    cr = _freed_pool_get (&context_pool);
 1515|     84|    if (unlikely (cr == NULL)) {
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 1, False: 83]
  |  |  ------------------
  ------------------
 1516|      1|	cr = _cairo_calloc (sizeof (cairo_default_context_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
 1517|      1|	if (unlikely (cr == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1518|      0|	    return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
 1519|      1|    }
 1520|       |
 1521|     84|    status = _cairo_default_context_init (cr, target);
 1522|     84|    if (unlikely (status)) {
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1523|      0|	_freed_pool_put (&context_pool, cr);
 1524|      0|	return _cairo_create_in_error (status);
 1525|      0|    }
 1526|       |
 1527|     84|    return &cr->base;
 1528|     84|}
cairo-default-context.c:_cairo_default_context_destroy:
   90|     84|{
   91|     84|    cairo_default_context_t *cr = abstract_cr;
   92|       |
   93|     84|    _cairo_default_context_fini (cr);
   94|       |
   95|       |    /* mark the context as invalid to protect against misuse */
   96|     84|    cr->base.status = CAIRO_STATUS_NULL_POINTER;
   97|     84|    _freed_pool_put (&context_pool, cr);
   98|     84|}
cairo-default-context.c:_cairo_default_context_has_current_point:
  930|     84|{
  931|     84|    cairo_default_context_t *cr = abstract_cr;
  932|       |
  933|     84|    return cr->path->has_current_point;
  934|     84|}
cairo-default-context.c:_cairo_default_context_get_scaled_font:
 1325|     84|{
 1326|     84|    cairo_default_context_t *cr = abstract_cr;
 1327|     84|    cairo_scaled_font_t *scaled_font;
 1328|     84|    cairo_status_t status;
 1329|       |
 1330|     84|    status = _cairo_gstate_get_scaled_font (cr->gstate, &scaled_font);
 1331|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1332|      0|	return _cairo_scaled_font_create_in_error (status);
 1333|       |
 1334|     84|    return scaled_font;
 1335|     84|}

cairo_device_reference:
  208|     84|{
  209|     84|    if (device == NULL ||
  ------------------
  |  Branch (209:9): [True: 84, False: 0]
  ------------------
  210|      0|	CAIRO_REFERENCE_COUNT_IS_INVALID (&device->ref_count))
  ------------------
  |  |   58|      0|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|      0|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|      0|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  211|     84|    {
  212|     84|	return device;
  213|     84|    }
  214|       |
  215|     84|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&device->ref_count));
  ------------------
  |  Branch (215:5): [True: 0, False: 0]
  |  Branch (215:5): [True: 0, False: 0]
  ------------------
  216|      0|    _cairo_reference_count_inc (&device->ref_count);
  ------------------
  |  |   47|      0|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|      0|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
  217|       |
  218|      0|    return device;
  219|      0|}

_cairo_error:
   66|    587|{
   67|    587|    CAIRO_ENSURE_UNIQUE;
  ------------------
  |  |  183|    587|#define CAIRO_ENSURE_UNIQUE    do { } while (0)
  |  |  ------------------
  |  |  |  Branch (183:46): [Folded, False: 587]
  |  |  ------------------
  ------------------
   68|    587|    assert (_cairo_status_is_error (status));
  ------------------
  |  Branch (68:5): [True: 0, False: 587]
  |  Branch (68:5): [True: 0, False: 0]
  |  Branch (68:5): [True: 587, False: 0]
  |  Branch (68:5): [True: 587, False: 0]
  ------------------
   69|       |
   70|    587|    return status;
   71|    587|}

_cairo_font_face_init:
   95|      3|{
   96|      3|    CAIRO_MUTEX_INITIALIZE ();
  ------------------
  |  |  173|      3|#define CAIRO_MUTEX_INITIALIZE		CAIRO_MUTEX_IMPL_INITIALIZE
  |  |  ------------------
  |  |  |  |   88|      3|#  define CAIRO_MUTEX_IMPL_INITIALIZE() CAIRO_MUTEX_IMPL_NOOP
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|      3|#define CAIRO_MUTEX_IMPL_NOOP	do {/*no-op*/} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (53:53): [Folded, False: 3]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   97|       |
   98|      3|    font_face->status = CAIRO_STATUS_SUCCESS;
   99|      3|    CAIRO_REFERENCE_COUNT_INIT (&font_face->ref_count, 1);
  ------------------
  |  |   51|      3|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  100|      3|    font_face->backend = backend;
  101|       |
  102|      3|    _cairo_user_data_array_init (&font_face->user_data);
  103|      3|}
cairo_font_face_reference:
  123|     86|{
  124|     86|    if (font_face == NULL ||
  ------------------
  |  Branch (124:9): [True: 0, False: 86]
  ------------------
  125|     86|	CAIRO_REFERENCE_COUNT_IS_INVALID (&font_face->ref_count))
  ------------------
  |  |   58|     86|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     86|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     86|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 86]
  |  |  ------------------
  ------------------
  126|      0|	return font_face;
  127|       |
  128|       |    /* We would normally assert that we have a reference here but we
  129|       |     * can't get away with that due to the zombie case as documented
  130|       |     * in _cairo_ft_font_face_destroy. */
  131|       |
  132|     86|    _cairo_reference_count_inc (&font_face->ref_count);
  ------------------
  |  |   47|     86|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|     86|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
  133|       |
  134|     86|    return font_face;
  135|     86|}
cairo_font_face_destroy:
  171|     85|{
  172|     85|    if (font_face == NULL ||
  ------------------
  |  Branch (172:9): [True: 0, False: 85]
  ------------------
  173|     85|	CAIRO_REFERENCE_COUNT_IS_INVALID (&font_face->ref_count))
  ------------------
  |  |   58|     85|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     85|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     85|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 85]
  |  |  ------------------
  ------------------
  174|      0|	return;
  175|       |
  176|     85|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&font_face->ref_count));
  ------------------
  |  Branch (176:5): [True: 0, False: 85]
  |  Branch (176:5): [True: 85, False: 0]
  ------------------
  177|       |
  178|       |    /* We allow resurrection to deal with some memory management for the
  179|       |     * FreeType backend where cairo_ft_font_face_t and cairo_ft_unscaled_font_t
  180|       |     * need to effectively mutually reference each other
  181|       |     */
  182|     85|    if (__put (&font_face->ref_count))
  ------------------
  |  Branch (182:9): [True: 85, False: 0]
  ------------------
  183|     85|	return;
  184|       |
  185|      0|    if (! font_face->backend->destroy (font_face))
  ------------------
  |  Branch (185:9): [True: 0, False: 0]
  ------------------
  186|      0|	return;
  187|       |
  188|      0|    _cairo_user_data_array_fini (&font_face->user_data);
  189|       |
  190|      0|    free (font_face);
  191|      0|}
_cairo_unscaled_font_init:
  308|      1|{
  309|      1|    CAIRO_REFERENCE_COUNT_INIT (&unscaled_font->ref_count, 1);
  ------------------
  |  |   51|      1|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  310|      1|    unscaled_font->backend = backend;
  311|      1|}
_cairo_unscaled_font_reference:
  315|      2|{
  316|      2|    if (unscaled_font == NULL)
  ------------------
  |  Branch (316:9): [True: 0, False: 2]
  ------------------
  317|      0|	return NULL;
  318|       |
  319|      2|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&unscaled_font->ref_count));
  ------------------
  |  Branch (319:5): [True: 0, False: 2]
  |  Branch (319:5): [True: 2, False: 0]
  ------------------
  320|       |
  321|      2|    _cairo_reference_count_inc (&unscaled_font->ref_count);
  ------------------
  |  |   47|      2|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|      2|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
  322|       |
  323|      2|    return unscaled_font;
  324|      2|}
_cairo_unscaled_font_destroy:
  328|      1|{
  329|      1|    if (unscaled_font == NULL)
  ------------------
  |  Branch (329:9): [True: 0, False: 1]
  ------------------
  330|      0|	return;
  331|       |
  332|      1|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&unscaled_font->ref_count));
  ------------------
  |  Branch (332:5): [True: 0, False: 1]
  |  Branch (332:5): [True: 1, False: 0]
  ------------------
  333|       |
  334|      1|    if (__put (&unscaled_font->ref_count))
  ------------------
  |  Branch (334:9): [True: 1, False: 0]
  ------------------
  335|      1|	return;
  336|       |
  337|      0|    if (! unscaled_font->backend->destroy (unscaled_font))
  ------------------
  |  Branch (337:9): [True: 0, False: 0]
  ------------------
  338|      0|	return;
  339|       |
  340|      0|    free (unscaled_font);
  341|      0|}
cairo-font-face.c:__put:
  139|     86|{
  140|     86|    int c, old;
  141|       |
  142|     86|    c = CAIRO_REFERENCE_COUNT_GET_VALUE(v);
  ------------------
  |  |   53|     86|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  ------------------
  143|     86|    while (c != 1 && (old = _cairo_atomic_int_cmpxchg_return_old(&v->ref_count, c, c - 1)) != c)
  ------------------
  |  |  111|     86|  _cairo_atomic_int_cmpxchg_return_old_impl(x, oldv, newv)
  ------------------
  |  Branch (143:12): [True: 86, False: 0]
  |  Branch (143:22): [True: 0, False: 86]
  ------------------
  144|      0|	c = old;
  145|       |
  146|     86|    return c != 1;
  147|     86|}

_cairo_font_options_init_default:
   73|    254|{
   74|    254|    options->antialias = CAIRO_ANTIALIAS_DEFAULT;
   75|    254|    options->subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
   76|    254|    options->lcd_filter = CAIRO_LCD_FILTER_DEFAULT;
   77|    254|    options->hint_style = CAIRO_HINT_STYLE_DEFAULT;
   78|    254|    options->hint_metrics = CAIRO_HINT_METRICS_DEFAULT;
   79|    254|    options->round_glyph_positions = CAIRO_ROUND_GLYPH_POS_DEFAULT;
   80|    254|    options->variations = NULL;
   81|    254|    options->color_mode = CAIRO_COLOR_MODE_DEFAULT;
   82|    254|    options->palette_index = CAIRO_COLOR_PALETTE_DEFAULT;
  ------------------
  |  | 1517|    254|#define CAIRO_COLOR_PALETTE_DEFAULT 0
  ------------------
   83|       |    options->custom_palette = NULL;
   84|    254|    options->custom_palette_size = 0;
   85|    254|}
_cairo_font_options_init_copy:
   90|     88|{
   91|     88|    options->antialias = other->antialias;
   92|     88|    options->subpixel_order = other->subpixel_order;
   93|     88|    options->lcd_filter = other->lcd_filter;
   94|     88|    options->hint_style = other->hint_style;
   95|     88|    options->hint_metrics = other->hint_metrics;
   96|     88|    options->round_glyph_positions = other->round_glyph_positions;
   97|     88|    options->variations = other->variations ? strdup (other->variations) : NULL;
  ------------------
  |  Branch (97:27): [True: 0, False: 88]
  ------------------
   98|     88|    options->color_mode = other->color_mode;
   99|     88|    options->palette_index = other->palette_index;
  100|     88|    options->custom_palette_size = other->custom_palette_size;
  101|     88|    options->custom_palette = NULL;
  102|     88|    if (other->custom_palette) {
  ------------------
  |  Branch (102:9): [True: 0, False: 88]
  ------------------
  103|      0|        options->custom_palette = (cairo_palette_color_t *) malloc (sizeof (cairo_palette_color_t) * options->custom_palette_size);
  104|      0|        memcpy (options->custom_palette, other->custom_palette, sizeof (cairo_palette_color_t) * options->custom_palette_size);
  105|      0|    }
  106|     88|}
_cairo_font_options_fini:
  209|    254|{
  210|    254|    free (options->variations);
  211|    254|    free (options->custom_palette);
  212|    254|}
cairo_font_options_status:
  247|    673|{
  248|    673|    if (options == NULL)
  ------------------
  |  Branch (248:9): [True: 0, False: 673]
  ------------------
  249|      0|	return CAIRO_STATUS_NULL_POINTER;
  250|    673|    else if (options == (cairo_font_options_t *) &_cairo_font_options_nil)
  ------------------
  |  Branch (250:14): [True: 0, False: 673]
  ------------------
  251|      0|	return CAIRO_STATUS_NO_MEMORY;
  252|    673|    else
  253|    673|	return CAIRO_STATUS_SUCCESS;
  254|    673|}
cairo_font_options_merge:
  271|     84|{
  272|     84|    if (cairo_font_options_status (options))
  ------------------
  |  Branch (272:9): [True: 0, False: 84]
  ------------------
  273|      0|	return;
  274|       |
  275|     84|    if (cairo_font_options_status ((cairo_font_options_t *) other))
  ------------------
  |  Branch (275:9): [True: 0, False: 84]
  ------------------
  276|      0|	return;
  277|       |
  278|     84|    if (other->antialias != CAIRO_ANTIALIAS_DEFAULT)
  ------------------
  |  Branch (278:9): [True: 0, False: 84]
  ------------------
  279|      0|	options->antialias = other->antialias;
  280|     84|    if (other->subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT)
  ------------------
  |  Branch (280:9): [True: 0, False: 84]
  ------------------
  281|      0|	options->subpixel_order = other->subpixel_order;
  282|     84|    if (other->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
  ------------------
  |  Branch (282:9): [True: 0, False: 84]
  ------------------
  283|      0|	options->lcd_filter = other->lcd_filter;
  284|     84|    if (other->hint_style != CAIRO_HINT_STYLE_DEFAULT)
  ------------------
  |  Branch (284:9): [True: 0, False: 84]
  ------------------
  285|      0|	options->hint_style = other->hint_style;
  286|     84|    if (other->hint_metrics != CAIRO_HINT_METRICS_DEFAULT)
  ------------------
  |  Branch (286:9): [True: 0, False: 84]
  ------------------
  287|      0|	options->hint_metrics = other->hint_metrics;
  288|     84|    if (other->round_glyph_positions != CAIRO_ROUND_GLYPH_POS_DEFAULT)
  ------------------
  |  Branch (288:9): [True: 0, False: 84]
  ------------------
  289|      0|	options->round_glyph_positions = other->round_glyph_positions;
  290|       |
  291|     84|    if (other->variations) {
  ------------------
  |  Branch (291:9): [True: 0, False: 84]
  ------------------
  292|      0|      if (options->variations) {
  ------------------
  |  Branch (292:11): [True: 0, False: 0]
  ------------------
  293|      0|        char *p;
  294|       |
  295|       |        /* 'merge' variations by concatenating - later entries win */
  296|      0|        p = malloc (strlen (other->variations) + strlen (options->variations) + 2);
  297|      0|        p[0] = 0;
  298|      0|        strcat (p, options->variations);
  299|      0|        strcat (p, ",");
  300|      0|        strcat (p, other->variations);
  301|      0|        free (options->variations);
  302|      0|        options->variations = p;
  303|      0|      }
  304|      0|      else {
  305|      0|        options->variations = strdup (other->variations);
  306|      0|      }
  307|      0|    }
  308|       |
  309|     84|    if (other->color_mode != CAIRO_COLOR_MODE_DEFAULT)
  ------------------
  |  Branch (309:9): [True: 0, False: 84]
  ------------------
  310|      0|	options->color_mode = other->color_mode;
  311|     84|    if (other->palette_index != CAIRO_COLOR_PALETTE_DEFAULT)
  ------------------
  |  | 1517|     84|#define CAIRO_COLOR_PALETTE_DEFAULT 0
  ------------------
  |  Branch (311:9): [True: 0, False: 84]
  ------------------
  312|      0|	options->palette_index = other->palette_index;
  313|     84|    if (other->custom_palette) {
  ------------------
  |  Branch (313:9): [True: 0, False: 84]
  ------------------
  314|      0|        options->custom_palette_size = other->custom_palette_size;
  315|      0|        free (options->custom_palette);
  316|      0|        options->custom_palette = (cairo_palette_color_t *) malloc (sizeof (cairo_palette_color_t) * options->custom_palette_size);
  317|      0|        memcpy (options->custom_palette, other->custom_palette, sizeof (cairo_palette_color_t) * options->custom_palette_size);
  318|      0|    }
  319|     84|}
cairo_font_options_equal:
  337|     83|{
  338|     83|    if (cairo_font_options_status ((cairo_font_options_t *) options))
  ------------------
  |  Branch (338:9): [True: 0, False: 83]
  ------------------
  339|      0|	return FALSE;
  ------------------
  |  |  102|      0|#define FALSE 0
  ------------------
  340|     83|    if (cairo_font_options_status ((cairo_font_options_t *) other))
  ------------------
  |  Branch (340:9): [True: 0, False: 83]
  ------------------
  341|      0|	return FALSE;
  ------------------
  |  |  102|      0|#define FALSE 0
  ------------------
  342|       |
  343|     83|    if (options == other)
  ------------------
  |  Branch (343:9): [True: 0, False: 83]
  ------------------
  344|      0|	return TRUE;
  ------------------
  |  |  106|      0|#define TRUE 1
  ------------------
  345|       |
  346|     83|    return (options->antialias == other->antialias &&
  ------------------
  |  Branch (346:13): [True: 83, False: 0]
  ------------------
  347|     83|	    options->subpixel_order == other->subpixel_order &&
  ------------------
  |  Branch (347:6): [True: 83, False: 0]
  ------------------
  348|     83|	    options->lcd_filter == other->lcd_filter &&
  ------------------
  |  Branch (348:6): [True: 83, False: 0]
  ------------------
  349|     83|	    options->hint_style == other->hint_style &&
  ------------------
  |  Branch (349:6): [True: 83, False: 0]
  ------------------
  350|     83|	    options->hint_metrics == other->hint_metrics &&
  ------------------
  |  Branch (350:6): [True: 83, False: 0]
  ------------------
  351|     83|	    options->round_glyph_positions == other->round_glyph_positions &&
  ------------------
  |  Branch (351:6): [True: 83, False: 0]
  ------------------
  352|     83|            ((options->variations == NULL && other->variations == NULL) ||
  ------------------
  |  Branch (352:15): [True: 83, False: 0]
  |  Branch (352:46): [True: 83, False: 0]
  ------------------
  353|      0|             (options->variations != NULL && other->variations != NULL &&
  ------------------
  |  Branch (353:15): [True: 0, False: 0]
  |  Branch (353:46): [True: 0, False: 0]
  ------------------
  354|      0|              strcmp (options->variations, other->variations) == 0)) &&
  ------------------
  |  Branch (354:15): [True: 0, False: 0]
  ------------------
  355|     83|	    options->color_mode == other->color_mode &&
  ------------------
  |  Branch (355:6): [True: 83, False: 0]
  ------------------
  356|     83|	    options->palette_index == other->palette_index &&
  ------------------
  |  Branch (356:6): [True: 83, False: 0]
  ------------------
  357|     83|            ((options->custom_palette == NULL && other->custom_palette == NULL) ||
  ------------------
  |  Branch (357:15): [True: 83, False: 0]
  |  Branch (357:50): [True: 83, False: 0]
  ------------------
  358|      0|             (options->custom_palette != NULL && other->custom_palette != NULL &&
  ------------------
  |  Branch (358:15): [True: 0, False: 0]
  |  Branch (358:50): [True: 0, False: 0]
  ------------------
  359|      0|              options->custom_palette_size == other->custom_palette_size &&
  ------------------
  |  Branch (359:15): [True: 0, False: 0]
  ------------------
  360|      0|              memcmp (options->custom_palette, other->custom_palette,
  ------------------
  |  Branch (360:15): [True: 0, False: 0]
  ------------------
  361|      0|                      sizeof (cairo_palette_color_t) * options->custom_palette_size) == 0)));
  362|     83|}
cairo_font_options_hash:
  380|      2|{
  381|      2|    unsigned long hash = 0;
  382|       |
  383|      2|    if (cairo_font_options_status ((cairo_font_options_t *) options))
  ------------------
  |  Branch (383:9): [True: 0, False: 2]
  ------------------
  384|      0|	options = &_cairo_font_options_nil; /* force default values */
  385|       |
  386|      2|    if (options->variations)
  ------------------
  |  Branch (386:9): [True: 0, False: 2]
  ------------------
  387|      0|      hash = _cairo_string_hash (options->variations, strlen (options->variations));
  388|       |
  389|      2|    hash ^= options->palette_index;
  390|       |
  391|      2|    return ((options->antialias) |
  392|      2|	    (options->subpixel_order << 4) |
  393|      2|	    (options->lcd_filter << 8) |
  394|      2|	    (options->hint_style << 12) |
  395|      2|	    (options->hint_metrics << 16) |
  396|      2|            (options->color_mode << 20)) ^ hash;
  397|      2|}
_cairo_font_options_set_round_glyph_positions:
  530|     84|{
  531|     84|    if (cairo_font_options_status (options))
  ------------------
  |  Branch (531:9): [True: 0, False: 84]
  ------------------
  532|      0|	return;
  533|       |
  534|     84|    options->round_glyph_positions = round;
  535|     84|}
cairo_font_options_set_hint_metrics:
  611|     84|{
  612|     84|    if (cairo_font_options_status (options))
  ------------------
  |  Branch (612:9): [True: 0, False: 84]
  ------------------
  613|      0|	return;
  614|       |
  615|     84|    options->hint_metrics = hint_metrics;
  616|     84|}

cairo-default-context.c:_freed_pool_get:
   80|     84|{
   81|     84|    void *ptr;
   82|     84|    int i;
   83|       |
   84|     84|    i = _cairo_atomic_int_get_relaxed (&pool->top) - 1;
   85|     84|    if (i < 0)
  ------------------
  |  Branch (85:9): [True: 1, False: 83]
  ------------------
   86|      1|	i = 0;
   87|       |
   88|     84|    ptr = _atomic_fetch (&pool->pool[i]);
   89|     84|    if (likely (ptr != NULL)) {
  ------------------
  |  |  144|     84|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 83, False: 1]
  |  |  ------------------
  ------------------
   90|     83|	_cairo_atomic_int_set_relaxed (&pool->top, i);
   91|     83|	return ptr;
   92|     83|    }
   93|       |
   94|       |    /* either empty or contended */
   95|      1|    return _freed_pool_get_search (pool);
   96|     84|}
cairo-default-context.c:_atomic_fetch:
   59|     84|{
   60|     84|    void *ptr;
   61|       |
   62|     84|    do {
   63|     84|        ptr = _cairo_atomic_ptr_get (slot);
   64|     84|    } while (! _cairo_atomic_ptr_cmpxchg (slot, ptr, NULL));
  ------------------
  |  |  121|     84|  _cairo_atomic_ptr_cmpxchg_impl(x, oldv, newv)
  ------------------
  |  Branch (64:14): [True: 0, False: 84]
  ------------------
   65|       |
   66|     84|    return ptr;
   67|     84|}
cairo-default-context.c:_freed_pool_put:
  103|     84|{
  104|     84|    int i;
  105|       |
  106|     84|    i = _cairo_atomic_int_get_relaxed (&pool->top);
  107|     84|    if (likely (i < ARRAY_LENGTH (pool->pool) &&
  ------------------
  |  |  144|    168|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 84, False: 0]
  |  |  |  Branch (144:44): [True: 84, False: 0]
  |  |  |  Branch (144:44): [True: 84, False: 0]
  |  |  ------------------
  ------------------
  108|     84|		_atomic_store (&pool->pool[i], ptr)))
  109|     84|    {
  110|     84|	_cairo_atomic_int_set_relaxed (&pool->top, i + 1);
  111|     84|	return;
  112|     84|    }
  113|       |
  114|       |    /* either full or contended */
  115|      0|    _freed_pool_put_search (pool, ptr);
  116|      0|}
cairo-default-context.c:_atomic_store:
   71|     84|{
   72|     84|    return _cairo_atomic_ptr_cmpxchg (slot, NULL, ptr);
  ------------------
  |  |  121|     84|  _cairo_atomic_ptr_cmpxchg_impl(x, oldv, newv)
  ------------------
   73|     84|}
cairo-freed-pool.c:_atomic_fetch:
   59|     16|{
   60|     16|    void *ptr;
   61|       |
   62|     16|    do {
   63|     16|        ptr = _cairo_atomic_ptr_get (slot);
   64|     16|    } while (! _cairo_atomic_ptr_cmpxchg (slot, ptr, NULL));
  ------------------
  |  |  121|     16|  _cairo_atomic_ptr_cmpxchg_impl(x, oldv, newv)
  ------------------
  |  Branch (64:14): [True: 0, False: 16]
  ------------------
   65|       |
   66|     16|    return ptr;
   67|     16|}

_freed_pool_get_search:
   46|      1|{
   47|      1|    void *ptr;
   48|      1|    int i;
   49|       |
   50|     17|    for (i = ARRAY_LENGTH (pool->pool); i--;) {
  ------------------
  |  |  122|      1|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
  |  Branch (50:41): [True: 16, False: 1]
  ------------------
   51|     16|	ptr = _atomic_fetch (&pool->pool[i]);
   52|     16|	if (ptr != NULL) {
  ------------------
  |  Branch (52:6): [True: 0, False: 16]
  ------------------
   53|      0|	    _cairo_atomic_int_set_relaxed (&pool->top, i);
   54|      0|	    return ptr;
   55|      0|	}
   56|     16|    }
   57|       |
   58|       |    /* empty */
   59|      1|    _cairo_atomic_int_set_relaxed (&pool->top, 0);
   60|       |    return NULL;
   61|      1|}

_cairo_scaled_font_is_ft:
 2124|      1|{
 2125|      1|    return scaled_font->backend == &_cairo_ft_scaled_font_backend;
 2126|      1|}
cairo-ft-font.c:_cairo_ft_scaled_font_is_vertical:
 4693|      1|{
 4694|      1|    cairo_ft_scaled_font_t *ft_scaled_font;
 4695|       |
 4696|      1|    if (!_cairo_scaled_font_is_ft (scaled_font))
  ------------------
  |  Branch (4696:9): [True: 0, False: 1]
  ------------------
 4697|      0|	return FALSE;
  ------------------
  |  |  102|      0|#define FALSE 0
  ------------------
 4698|       |
 4699|      1|    ft_scaled_font = (cairo_ft_scaled_font_t *) scaled_font;
 4700|      1|    if (ft_scaled_font->ft_options.load_flags & FT_LOAD_VERTICAL_LAYOUT)
  ------------------
  |  | 3505|      1|#define FT_LOAD_VERTICAL_LAYOUT              ( 1L << 4  )
  ------------------
  |  Branch (4700:9): [True: 0, False: 1]
  ------------------
 4701|      0|	return TRUE;
  ------------------
  |  |  106|      0|#define TRUE 1
  ------------------
 4702|      1|    return FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
 4703|      1|}
cairo-ft-font.c:_cairo_ft_font_face_create_for_toy:
 3840|      1|{
 3841|      1|    cairo_font_face_t *font_face = (cairo_font_face_t *) &_cairo_font_face_nil;
 3842|      1|    FcPattern *pattern;
 3843|      1|    int fcslant;
 3844|      1|    int fcweight;
 3845|       |
 3846|      1|    pattern = FcPatternCreate ();
 3847|      1|    if (!pattern) {
  ------------------
  |  Branch (3847:9): [True: 0, False: 1]
  ------------------
 3848|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3849|      0|	return font_face->status;
 3850|      0|    }
 3851|       |
 3852|      1|    if (!FcPatternAddString (pattern,
  ------------------
  |  Branch (3852:9): [True: 0, False: 1]
  ------------------
 3853|      1|		             FC_FAMILY, (unsigned char *) toy_face->family))
  ------------------
  |  |   81|      1|#define FC_FAMILY	    "family"		/* String */
  ------------------
 3854|      0|    {
 3855|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3856|      0|	goto FREE_PATTERN;
 3857|      0|    }
 3858|       |
 3859|      1|    switch (toy_face->slant)
 3860|      1|    {
 3861|      0|    case CAIRO_FONT_SLANT_ITALIC:
  ------------------
  |  Branch (3861:5): [True: 0, False: 1]
  ------------------
 3862|      0|        fcslant = FC_SLANT_ITALIC;
  ------------------
  |  |  168|      0|#define FC_SLANT_ITALIC		    100
  ------------------
 3863|      0|        break;
 3864|      0|    case CAIRO_FONT_SLANT_OBLIQUE:
  ------------------
  |  Branch (3864:5): [True: 0, False: 1]
  ------------------
 3865|      0|	fcslant = FC_SLANT_OBLIQUE;
  ------------------
  |  |  169|      0|#define FC_SLANT_OBLIQUE	    110
  ------------------
 3866|      0|        break;
 3867|      1|    case CAIRO_FONT_SLANT_NORMAL:
  ------------------
  |  Branch (3867:5): [True: 1, False: 0]
  ------------------
 3868|      1|    default:
  ------------------
  |  Branch (3868:5): [True: 0, False: 1]
  ------------------
 3869|      1|        fcslant = FC_SLANT_ROMAN;
  ------------------
  |  |  167|      1|#define FC_SLANT_ROMAN		    0
  ------------------
 3870|      1|        break;
 3871|      1|    }
 3872|       |
 3873|      1|    if (!FcPatternAddInteger (pattern, FC_SLANT, fcslant)) {
  ------------------
  |  |   83|      1|#define FC_SLANT	    "slant"		/* Int */
  ------------------
  |  Branch (3873:9): [True: 0, False: 1]
  ------------------
 3874|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3875|      0|	goto FREE_PATTERN;
 3876|      0|    }
 3877|       |
 3878|      1|    switch (toy_face->weight)
 3879|      1|    {
 3880|      0|    case CAIRO_FONT_WEIGHT_BOLD:
  ------------------
  |  Branch (3880:5): [True: 0, False: 1]
  ------------------
 3881|      0|        fcweight = FC_WEIGHT_BOLD;
  ------------------
  |  |  159|      0|#define FC_WEIGHT_BOLD		    200
  ------------------
 3882|      0|        break;
 3883|      1|    case CAIRO_FONT_WEIGHT_NORMAL:
  ------------------
  |  Branch (3883:5): [True: 1, False: 0]
  ------------------
 3884|      1|    default:
  ------------------
  |  Branch (3884:5): [True: 0, False: 1]
  ------------------
 3885|      1|        fcweight = FC_WEIGHT_MEDIUM;
  ------------------
  |  |  156|      1|#define FC_WEIGHT_MEDIUM	    100
  ------------------
 3886|      1|        break;
 3887|      1|    }
 3888|       |
 3889|      1|    if (!FcPatternAddInteger (pattern, FC_WEIGHT, fcweight)) {
  ------------------
  |  |   84|      1|#define FC_WEIGHT	    "weight"		/* Int */
  ------------------
  |  Branch (3889:9): [True: 0, False: 1]
  ------------------
 3890|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3891|      0|	goto FREE_PATTERN;
 3892|      0|    }
 3893|       |
 3894|      1|    font_face = _cairo_ft_font_face_create_for_pattern (pattern);
 3895|       |
 3896|      1| FREE_PATTERN:
 3897|      1|    FcPatternDestroy (pattern);
 3898|       |
 3899|      1|    *font_face_out = font_face;
 3900|      1|    return font_face->status;
 3901|      1|}
cairo-ft-font.c:_cairo_ft_font_face_scaled_font_create:
 2021|      1|{
 2022|      1|    cairo_ft_font_face_t *font_face = abstract_font_face;
 2023|      1|    cairo_ft_scaled_font_t *scaled_font;
 2024|      1|    FT_Face face;
 2025|      1|    FT_Size_Metrics *metrics;
 2026|      1|    cairo_font_extents_t fs_metrics;
 2027|      1|    cairo_status_t status;
 2028|      1|    cairo_ft_unscaled_font_t *unscaled;
 2029|       |
 2030|      1|    assert (font_face->unscaled);
  ------------------
  |  Branch (2030:5): [True: 0, False: 1]
  |  Branch (2030:5): [True: 1, False: 0]
  ------------------
 2031|       |
 2032|      1|    face = _cairo_ft_unscaled_font_lock_face (font_face->unscaled);
 2033|      1|    if (unlikely (face == NULL)) /* backend error */
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2034|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 2035|       |
 2036|      1|    scaled_font = _cairo_calloc (sizeof (cairo_ft_scaled_font_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
 2037|      1|    if (unlikely (scaled_font == NULL)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2038|      0|	status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 2039|      0|	goto FAIL;
 2040|      0|    }
 2041|       |
 2042|      1|    scaled_font->unscaled = unscaled = font_face->unscaled;
 2043|      1|    _cairo_unscaled_font_reference (&unscaled->base);
 2044|       |
 2045|      1|    _cairo_font_options_init_copy (&scaled_font->ft_options.base, options);
 2046|      1|    _cairo_ft_options_merge (&scaled_font->ft_options, &font_face->ft_options);
 2047|       |
 2048|      1|    status = _cairo_scaled_font_init (&scaled_font->base,
 2049|      1|			              &font_face->base,
 2050|      1|				      font_matrix, ctm, options,
 2051|      1|				      &_cairo_ft_scaled_font_backend);
 2052|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2053|      0|	goto CLEANUP_SCALED_FONT;
 2054|       |
 2055|      1|    status = _cairo_ft_unscaled_font_set_scale (unscaled,
 2056|      1|				                &scaled_font->base.scale);
 2057|      1|    if (unlikely (status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2058|       |	/* This can only fail if we encounter an error with the underlying
 2059|       |	 * font, so propagate the error back to the font-face. */
 2060|      0|	_cairo_ft_unscaled_font_unlock_face (unscaled);
 2061|      0|	_cairo_unscaled_font_destroy (&unscaled->base);
 2062|      0|	free (scaled_font);
 2063|      0|	return status;
 2064|      0|    }
 2065|       |
 2066|       |
 2067|      1|    metrics = &face->size->metrics;
 2068|       |
 2069|       |    /*
 2070|       |     * Get to unscaled metrics so that the upper level can get back to
 2071|       |     * user space
 2072|       |     *
 2073|       |     * Also use this path for bitmap-only fonts.  The other branch uses
 2074|       |     * face members that are only relevant for scalable fonts.  This is
 2075|       |     * detected by simply checking for units_per_EM==0.
 2076|       |     */
 2077|      1|    if (scaled_font->base.options.hint_metrics != CAIRO_HINT_METRICS_OFF ||
  ------------------
  |  Branch (2077:9): [True: 1, False: 0]
  ------------------
 2078|      1|	face->units_per_EM == 0) {
  ------------------
  |  Branch (2078:2): [True: 0, False: 0]
  ------------------
 2079|      1|	fs_metrics.ascent =        SCALE (DOUBLE_FROM_26_6 (metrics->ascender), unscaled->y_scale);
  ------------------
  |  |  111|      1|#define SCALE(a,b) ((b) == 0 ? 0.0 : (a) / (b))
  |  |  ------------------
  |  |  |  Branch (111:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2080|      1|	fs_metrics.descent =       SCALE (DOUBLE_FROM_26_6 (- metrics->descender), unscaled->y_scale);
  ------------------
  |  |  111|      1|#define SCALE(a,b) ((b) == 0 ? 0.0 : (a) / (b))
  |  |  ------------------
  |  |  |  Branch (111:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2081|      1|	fs_metrics.height =        SCALE (DOUBLE_FROM_26_6 (metrics->height), unscaled->y_scale);
  ------------------
  |  |  111|      1|#define SCALE(a,b) ((b) == 0 ? 0.0 : (a) / (b))
  |  |  ------------------
  |  |  |  Branch (111:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2082|      1|	if (!_cairo_ft_scaled_font_is_vertical (&scaled_font->base)) {
  ------------------
  |  Branch (2082:6): [True: 1, False: 0]
  ------------------
 2083|      1|	    fs_metrics.max_x_advance = SCALE (DOUBLE_FROM_26_6 (metrics->max_advance), unscaled->x_scale);
  ------------------
  |  |  111|      1|#define SCALE(a,b) ((b) == 0 ? 0.0 : (a) / (b))
  |  |  ------------------
  |  |  |  Branch (111:21): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2084|      1|	    fs_metrics.max_y_advance = 0;
 2085|      1|	} else {
 2086|      0|	    fs_metrics.max_x_advance = 0;
 2087|      0|	    fs_metrics.max_y_advance = SCALE (DOUBLE_FROM_26_6 (metrics->max_advance), unscaled->y_scale);
  ------------------
  |  |  111|      0|#define SCALE(a,b) ((b) == 0 ? 0.0 : (a) / (b))
  |  |  ------------------
  |  |  |  Branch (111:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2088|      0|	}
 2089|      1|    } else {
 2090|      0|	double scale = face->units_per_EM;
 2091|       |
 2092|      0|	fs_metrics.ascent =        face->ascender / scale;
 2093|      0|	fs_metrics.descent =       - face->descender / scale;
 2094|      0|	fs_metrics.height =        face->height / scale;
 2095|      0|	if (!_cairo_ft_scaled_font_is_vertical (&scaled_font->base)) {
  ------------------
  |  Branch (2095:6): [True: 0, False: 0]
  ------------------
 2096|      0|	    fs_metrics.max_x_advance = face->max_advance_width / scale;
 2097|      0|	    fs_metrics.max_y_advance = 0;
 2098|      0|	} else {
 2099|      0|	    fs_metrics.max_x_advance = 0;
 2100|      0|	    fs_metrics.max_y_advance = face->max_advance_height / scale;
 2101|      0|	}
 2102|      0|    }
 2103|       |
 2104|      1|    status = _cairo_scaled_font_set_metrics (&scaled_font->base, &fs_metrics);
 2105|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 2106|      0|	goto CLEANUP_SCALED_FONT;
 2107|       |
 2108|      1|    _cairo_ft_unscaled_font_unlock_face (unscaled);
 2109|       |
 2110|      1|    *font_out = &scaled_font->base;
 2111|      1|    return CAIRO_STATUS_SUCCESS;
 2112|       |
 2113|      0|  CLEANUP_SCALED_FONT:
 2114|      0|    _cairo_unscaled_font_destroy (&unscaled->base);
 2115|      0|    free (scaled_font);
 2116|      0|  FAIL:
 2117|      0|    _cairo_ft_unscaled_font_unlock_face (font_face->unscaled);
 2118|      0|    *font_out = _cairo_scaled_font_create_in_error (status);
 2119|      0|    return CAIRO_STATUS_SUCCESS; /* non-backend error */
 2120|      0|}
cairo-ft-font.c:_cairo_ft_options_merge:
 1924|      1|{
 1925|      1|    int load_flags = other->load_flags;
 1926|      1|    int load_target = FT_LOAD_TARGET_NORMAL;
  ------------------
  |  | 3618|      1|#define FT_LOAD_TARGET_NORMAL  FT_LOAD_TARGET_( FT_RENDER_MODE_NORMAL )
  |  |  ------------------
  |  |  |  | 3616|      1|#define FT_LOAD_TARGET_( x )   ( FT_STATIC_CAST( FT_Int32, (x) & 15 ) << 16 )
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      1|#define FT_STATIC_CAST( type, var )       (type)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1927|       |
 1928|       |    /* clear load target mode */
 1929|      1|    load_flags &= ~(FT_LOAD_TARGET_(FT_LOAD_TARGET_MODE(other->load_flags)));
  ------------------
  |  | 3616|      1|#define FT_LOAD_TARGET_( x )   ( FT_STATIC_CAST( FT_Int32, (x) & 15 ) << 16 )
  |  |  ------------------
  |  |  |  |  129|      1|#define FT_STATIC_CAST( type, var )       (type)(var)
  |  |  ------------------
  ------------------
 1930|       |
 1931|      1|    if (load_flags & FT_LOAD_NO_HINTING)
  ------------------
  |  | 3502|      1|#define FT_LOAD_NO_HINTING                   ( 1L << 1  )
  ------------------
  |  Branch (1931:9): [True: 0, False: 1]
  ------------------
 1932|      0|	other->base.hint_style = CAIRO_HINT_STYLE_NONE;
 1933|       |
 1934|      1|    if (other->base.antialias == CAIRO_ANTIALIAS_NONE ||
  ------------------
  |  Branch (1934:9): [True: 0, False: 1]
  ------------------
 1935|      1|	options->base.antialias == CAIRO_ANTIALIAS_NONE) {
  ------------------
  |  Branch (1935:2): [True: 0, False: 1]
  ------------------
 1936|      0|	options->base.antialias = CAIRO_ANTIALIAS_NONE;
 1937|      0|	options->base.subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
 1938|      0|    }
 1939|       |
 1940|      1|    if (other->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL &&
  ------------------
  |  Branch (1940:9): [True: 0, False: 1]
  ------------------
 1941|      0|	options->base.antialias == CAIRO_ANTIALIAS_DEFAULT) {
  ------------------
  |  Branch (1941:2): [True: 0, False: 0]
  ------------------
 1942|      0|	options->base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
 1943|      0|	options->base.subpixel_order = other->base.subpixel_order;
 1944|      0|    }
 1945|       |
 1946|      1|    if (options->base.hint_style == CAIRO_HINT_STYLE_DEFAULT)
  ------------------
  |  Branch (1946:9): [True: 1, False: 0]
  ------------------
 1947|      1|	options->base.hint_style = other->base.hint_style;
 1948|       |
 1949|      1|    if (other->base.hint_style == CAIRO_HINT_STYLE_NONE)
  ------------------
  |  Branch (1949:9): [True: 0, False: 1]
  ------------------
 1950|      0|	options->base.hint_style = CAIRO_HINT_STYLE_NONE;
 1951|       |
 1952|      1|    if (options->base.lcd_filter == CAIRO_LCD_FILTER_DEFAULT)
  ------------------
  |  Branch (1952:9): [True: 1, False: 0]
  ------------------
 1953|      1|	options->base.lcd_filter = other->base.lcd_filter;
 1954|       |
 1955|      1|    if (other->base.lcd_filter == CAIRO_LCD_FILTER_NONE)
  ------------------
  |  Branch (1955:9): [True: 0, False: 1]
  ------------------
 1956|      0|	options->base.lcd_filter = CAIRO_LCD_FILTER_NONE;
 1957|       |
 1958|      1|    if (options->base.antialias == CAIRO_ANTIALIAS_NONE) {
  ------------------
  |  Branch (1958:9): [True: 0, False: 1]
  ------------------
 1959|      0|	if (options->base.hint_style == CAIRO_HINT_STYLE_NONE)
  ------------------
  |  Branch (1959:6): [True: 0, False: 0]
  ------------------
 1960|      0|	    load_flags |= FT_LOAD_NO_HINTING;
  ------------------
  |  | 3502|      0|#define FT_LOAD_NO_HINTING                   ( 1L << 1  )
  ------------------
 1961|      0|	else
 1962|      0|	    load_target = FT_LOAD_TARGET_MONO;
  ------------------
  |  | 3620|      0|#define FT_LOAD_TARGET_MONO    FT_LOAD_TARGET_( FT_RENDER_MODE_MONO   )
  |  |  ------------------
  |  |  |  | 3616|      0|#define FT_LOAD_TARGET_( x )   ( FT_STATIC_CAST( FT_Int32, (x) & 15 ) << 16 )
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      0|#define FT_STATIC_CAST( type, var )       (type)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1963|      0|	load_flags |= FT_LOAD_MONOCHROME;
  ------------------
  |  | 3512|      0|#define FT_LOAD_MONOCHROME                   ( 1L << 12 )
  ------------------
 1964|      1|    } else {
 1965|      1|	switch (options->base.hint_style) {
  ------------------
  |  Branch (1965:10): [True: 1, False: 0]
  ------------------
 1966|      0|	case CAIRO_HINT_STYLE_NONE:
  ------------------
  |  Branch (1966:2): [True: 0, False: 1]
  ------------------
 1967|      0|	    load_flags |= FT_LOAD_NO_HINTING;
  ------------------
  |  | 3502|      0|#define FT_LOAD_NO_HINTING                   ( 1L << 1  )
  ------------------
 1968|      0|	    break;
 1969|      0|	case CAIRO_HINT_STYLE_SLIGHT:
  ------------------
  |  Branch (1969:2): [True: 0, False: 1]
  ------------------
 1970|      0|	    load_target = FT_LOAD_TARGET_LIGHT;
  ------------------
  |  | 3619|      0|#define FT_LOAD_TARGET_LIGHT   FT_LOAD_TARGET_( FT_RENDER_MODE_LIGHT  )
  |  |  ------------------
  |  |  |  | 3616|      0|#define FT_LOAD_TARGET_( x )   ( FT_STATIC_CAST( FT_Int32, (x) & 15 ) << 16 )
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      0|#define FT_STATIC_CAST( type, var )       (type)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1971|      0|	    break;
 1972|      0|	case CAIRO_HINT_STYLE_MEDIUM:
  ------------------
  |  Branch (1972:2): [True: 0, False: 1]
  ------------------
 1973|      0|	    break;
 1974|      1|	case CAIRO_HINT_STYLE_FULL:
  ------------------
  |  Branch (1974:2): [True: 1, False: 0]
  ------------------
 1975|      1|	case CAIRO_HINT_STYLE_DEFAULT:
  ------------------
  |  Branch (1975:2): [True: 0, False: 1]
  ------------------
 1976|      1|	    if (options->base.antialias == CAIRO_ANTIALIAS_SUBPIXEL) {
  ------------------
  |  Branch (1976:10): [True: 0, False: 1]
  ------------------
 1977|      0|		switch (options->base.subpixel_order) {
  ------------------
  |  Branch (1977:11): [True: 0, False: 0]
  ------------------
 1978|      0|		case CAIRO_SUBPIXEL_ORDER_DEFAULT:
  ------------------
  |  Branch (1978:3): [True: 0, False: 0]
  ------------------
 1979|      0|		case CAIRO_SUBPIXEL_ORDER_RGB:
  ------------------
  |  Branch (1979:3): [True: 0, False: 0]
  ------------------
 1980|      0|		case CAIRO_SUBPIXEL_ORDER_BGR:
  ------------------
  |  Branch (1980:3): [True: 0, False: 0]
  ------------------
 1981|      0|		    load_target = FT_LOAD_TARGET_LCD;
  ------------------
  |  | 3621|      0|#define FT_LOAD_TARGET_LCD     FT_LOAD_TARGET_( FT_RENDER_MODE_LCD    )
  |  |  ------------------
  |  |  |  | 3616|      0|#define FT_LOAD_TARGET_( x )   ( FT_STATIC_CAST( FT_Int32, (x) & 15 ) << 16 )
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      0|#define FT_STATIC_CAST( type, var )       (type)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1982|      0|		    break;
 1983|      0|		case CAIRO_SUBPIXEL_ORDER_VRGB:
  ------------------
  |  Branch (1983:3): [True: 0, False: 0]
  ------------------
 1984|      0|		case CAIRO_SUBPIXEL_ORDER_VBGR:
  ------------------
  |  Branch (1984:3): [True: 0, False: 0]
  ------------------
 1985|      0|		    load_target = FT_LOAD_TARGET_LCD_V;
  ------------------
  |  | 3622|      0|#define FT_LOAD_TARGET_LCD_V   FT_LOAD_TARGET_( FT_RENDER_MODE_LCD_V  )
  |  |  ------------------
  |  |  |  | 3616|      0|#define FT_LOAD_TARGET_( x )   ( FT_STATIC_CAST( FT_Int32, (x) & 15 ) << 16 )
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|      0|#define FT_STATIC_CAST( type, var )       (type)(var)
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1986|      0|		break;
 1987|      0|		}
 1988|      0|	    }
 1989|      1|	    break;
 1990|      1|	}
 1991|      1|    }
 1992|       |
 1993|      1|    if (other->base.variations) {
  ------------------
  |  Branch (1993:9): [True: 0, False: 1]
  ------------------
 1994|      0|      if (options->base.variations) {
  ------------------
  |  Branch (1994:11): [True: 0, False: 0]
  ------------------
 1995|      0|        char *p;
 1996|       |
 1997|       |        /* 'merge' variations by concatenating - later entries win */
 1998|      0|        p = malloc (strlen (other->base.variations) + strlen (options->base.variations) + 2);
 1999|      0|        p[0] = 0;
 2000|      0|        strcat (p, other->base.variations);
 2001|      0|        strcat (p, ",");
 2002|      0|        strcat (p, options->base.variations);
 2003|      0|        free (options->base.variations);
 2004|      0|        options->base.variations = p;
 2005|      0|      }
 2006|      0|      else {
 2007|      0|        options->base.variations = strdup (other->base.variations);
 2008|      0|      }
 2009|      0|    }
 2010|       |
 2011|      1|    options->load_flags = load_flags | load_target;
 2012|      1|    options->synth_flags = other->synth_flags;
 2013|      1|}
cairo-ft-font.c:_cairo_ft_font_face_get_implementation:
 3976|      1|{
 3977|       |    /* The handling of font options is different depending on how the
 3978|       |     * font face was created. When the user creates a font face with
 3979|       |     * cairo_ft_font_face_create_for_ft_face(), then the load flags
 3980|       |     * passed in augment the load flags for the options.  But for
 3981|       |     * cairo_ft_font_face_create_for_pattern(), the load flags are
 3982|       |     * derived from a pattern where the user has called
 3983|       |     * cairo_ft_font_options_substitute(), so *just* use those load
 3984|       |     * flags and ignore the options.
 3985|       |     */
 3986|       |
 3987|      1|#if CAIRO_HAS_FC_FONT
 3988|      1|    cairo_ft_font_face_t      *font_face = abstract_face;
 3989|       |
 3990|       |    /* If we have an unresolved pattern, resolve it and create
 3991|       |     * unscaled font.  Otherwise, use the ones stored in font_face.
 3992|       |     */
 3993|      1|    if (font_face->pattern) {
  ------------------
  |  Branch (3993:9): [True: 1, False: 0]
  ------------------
 3994|      1|	cairo_font_face_t *resolved;
 3995|       |
 3996|       |	/* Cache the resolved font whilst the FcConfig remains consistent. */
 3997|      1|	resolved = font_face->resolved_font_face;
 3998|      1|	if (resolved != NULL) {
  ------------------
  |  Branch (3998:6): [True: 0, False: 1]
  ------------------
 3999|      0|	    if (! FcInitBringUptoDate ()) {
  ------------------
  |  Branch (3999:10): [True: 0, False: 0]
  ------------------
 4000|      0|		_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4001|      0|		return (cairo_font_face_t *) &_cairo_font_face_nil;
 4002|      0|	    }
 4003|       |
 4004|      0|	    if (font_face->resolved_config == FcConfigGetCurrent ())
  ------------------
  |  Branch (4004:10): [True: 0, False: 0]
  ------------------
 4005|      0|		return cairo_font_face_reference (resolved);
 4006|       |
 4007|      0|	    cairo_font_face_destroy (resolved);
 4008|      0|	    font_face->resolved_font_face = NULL;
 4009|      0|	}
 4010|       |
 4011|      1|	resolved = _cairo_ft_resolve_pattern (font_face->pattern,
 4012|      1|					      font_matrix,
 4013|      1|					      ctm,
 4014|      1|					      options);
 4015|      1|	if (unlikely (resolved->status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4016|      0|	    return resolved;
 4017|       |
 4018|      1|	font_face->resolved_font_face = cairo_font_face_reference (resolved);
 4019|      1|	font_face->resolved_config = FcConfigGetCurrent ();
 4020|       |
 4021|      1|	return resolved;
 4022|      1|    }
 4023|      0|#endif
 4024|       |
 4025|      0|    return abstract_face;
 4026|      1|}
cairo-ft-font.c:_cairo_ft_resolve_pattern:
 4292|      1|{
 4293|      1|    cairo_status_t status;
 4294|       |
 4295|      1|    cairo_matrix_t scale;
 4296|      1|    FcPattern *resolved;
 4297|      1|    cairo_ft_font_transform_t sf;
 4298|      1|    FcResult result;
 4299|      1|    cairo_ft_unscaled_font_t *unscaled;
 4300|      1|    cairo_ft_options_t ft_options;
 4301|      1|    cairo_font_face_t *font_face;
 4302|       |
 4303|      1|    scale = *ctm;
 4304|      1|    scale.x0 = scale.y0 = 0;
 4305|      1|    cairo_matrix_multiply (&scale,
 4306|      1|                           font_matrix,
 4307|      1|                           &scale);
 4308|       |
 4309|      1|    status = _compute_transform (&sf, &scale, NULL);
 4310|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4311|      0|	return (cairo_font_face_t *)&_cairo_font_face_nil;
 4312|       |
 4313|      1|    pattern = FcPatternDuplicate (pattern);
 4314|      1|    if (pattern == NULL)
  ------------------
  |  Branch (4314:9): [True: 0, False: 1]
  ------------------
 4315|      0|	return (cairo_font_face_t *)&_cairo_font_face_nil;
 4316|       |
 4317|      1|    if (! FcPatternAddDouble (pattern, FC_PIXEL_SIZE, sf.y_scale)) {
  ------------------
  |  |   87|      1|#define FC_PIXEL_SIZE	    "pixelsize"		/* Double */
  ------------------
  |  Branch (4317:9): [True: 0, False: 1]
  ------------------
 4318|      0|	font_face = (cairo_font_face_t *)&_cairo_font_face_nil;
 4319|      0|	goto FREE_PATTERN;
 4320|      0|    }
 4321|       |
 4322|      1|    if (! FcConfigSubstitute (NULL, pattern, FcMatchPattern)) {
  ------------------
  |  Branch (4322:9): [True: 0, False: 1]
  ------------------
 4323|      0|	font_face = (cairo_font_face_t *)&_cairo_font_face_nil;
 4324|      0|	goto FREE_PATTERN;
 4325|      0|    }
 4326|       |
 4327|      1|    status = _cairo_ft_font_options_substitute (font_options, pattern);
 4328|      1|    if (status) {
  ------------------
  |  Branch (4328:9): [True: 0, False: 1]
  ------------------
 4329|      0|	font_face = (cairo_font_face_t *)&_cairo_font_face_nil;
 4330|      0|	goto FREE_PATTERN;
 4331|      0|    }
 4332|       |
 4333|      1|    FcDefaultSubstitute (pattern);
 4334|       |
 4335|      1|    status = _cairo_ft_unscaled_font_create_for_pattern (pattern, &unscaled);
 4336|      1|    if (unlikely (status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4337|      0|	font_face = (cairo_font_face_t *)&_cairo_font_face_nil;
 4338|      0|	goto FREE_PATTERN;
 4339|      0|    }
 4340|       |
 4341|      1|    if (unscaled == NULL) {
  ------------------
  |  Branch (4341:9): [True: 1, False: 0]
  ------------------
 4342|      1|	resolved = FcFontMatch (NULL, pattern, &result);
 4343|      1|	if (!resolved) {
  ------------------
  |  Branch (4343:6): [True: 0, False: 1]
  ------------------
 4344|       |	    /* We failed to find any font. Substitute twin so that the user can
 4345|       |	     * see something (and hopefully recognise that the font is missing)
 4346|       |	     * and not just receive a NO_MEMORY error during rendering.
 4347|       |	     */
 4348|      0|	    font_face = _cairo_font_face_twin_create_fallback ();
 4349|      0|	    goto FREE_PATTERN;
 4350|      0|	}
 4351|       |
 4352|      1|	status = _cairo_ft_unscaled_font_create_for_pattern (resolved, &unscaled);
 4353|      1|	if (unlikely (status || unscaled == NULL)) {
  ------------------
  |  |  145|      2|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  |  Branch (145:46): [True: 0, False: 1]
  |  |  |  Branch (145:46): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4354|      0|	    font_face = (cairo_font_face_t *)&_cairo_font_face_nil;
 4355|      0|	    goto FREE_RESOLVED;
 4356|      0|	}
 4357|      1|    } else
 4358|      0|	resolved = pattern;
 4359|       |
 4360|      1|    _get_pattern_ft_options (resolved, &ft_options);
 4361|      1|    font_face = _cairo_ft_font_face_create (unscaled, &ft_options);
 4362|      1|     _cairo_ft_options_fini (&ft_options);
 4363|      1|    _cairo_unscaled_font_destroy (&unscaled->base);
 4364|       |
 4365|      1|FREE_RESOLVED:
 4366|      1|    if (resolved != pattern)
  ------------------
  |  Branch (4366:9): [True: 1, False: 0]
  ------------------
 4367|      1|	FcPatternDestroy (resolved);
 4368|       |
 4369|      1|FREE_PATTERN:
 4370|      1|    FcPatternDestroy (pattern);
 4371|       |
 4372|      1|    return font_face;
 4373|      1|}
cairo-ft-font.c:_compute_transform:
  786|      2|{
  787|      2|    cairo_status_t status;
  788|      2|    double x_scale, y_scale;
  789|      2|    cairo_matrix_t normalized = *scale;
  790|       |
  791|       |    /* The font matrix has x and y "scale" components which we extract and
  792|       |     * use as character scale values. These influence the way freetype
  793|       |     * chooses hints, as well as selecting different bitmaps in
  794|       |     * hand-rendered fonts. We also copy the normalized matrix to
  795|       |     * freetype's transformation.
  796|       |     */
  797|       |
  798|      2|    status = _cairo_matrix_compute_basis_scale_factors (scale,
  799|      2|						  &x_scale, &y_scale,
  800|      2|						  1);
  801|      2|    if (unlikely (status))
  ------------------
  |  |  145|      2|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 2]
  |  |  ------------------
  ------------------
  802|      0|	return status;
  803|       |
  804|       |    /* FreeType docs say this about x_scale and y_scale:
  805|       |     * "A character width or height smaller than 1pt is set to 1pt;"
  806|       |     * So, we cap them from below at 1.0 and let the FT transform
  807|       |     * take care of sub-1.0 scaling. */
  808|      2|    if (x_scale < 1.0)
  ------------------
  |  Branch (808:9): [True: 0, False: 2]
  ------------------
  809|      0|      x_scale = 1.0;
  810|      2|    if (y_scale < 1.0)
  ------------------
  |  Branch (810:9): [True: 0, False: 2]
  ------------------
  811|      0|      y_scale = 1.0;
  812|       |
  813|      2|    if (unscaled && (unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) == 0) {
  ------------------
  |  | 1413|      1|#define FT_FACE_FLAG_SCALABLE          ( 1L <<  0 )
  ------------------
  |  Branch (813:9): [True: 1, False: 1]
  |  Branch (813:21): [True: 0, False: 1]
  ------------------
  814|      0|	double min_distance = DBL_MAX;
  815|      0|	cairo_bool_t magnify = TRUE;
  ------------------
  |  |  106|      0|#define TRUE 1
  ------------------
  816|      0|	int i;
  817|      0|	double best_x_size = 0;
  818|      0|	double best_y_size = 0;
  819|       |
  820|      0|	for (i = 0; i < unscaled->face->num_fixed_sizes; i++) {
  ------------------
  |  Branch (820:14): [True: 0, False: 0]
  ------------------
  821|      0|	    double x_size = unscaled->face->available_sizes[i].x_ppem / 64.;
  822|      0|	    double y_size = unscaled->face->available_sizes[i].y_ppem / 64.;
  823|      0|	    double distance = y_size - y_scale;
  824|       |
  825|       |	    /*
  826|       |	     * distance is positive if current strike is larger than desired
  827|       |	     * size, and negative if smaller.
  828|       |	     *
  829|       |	     * We like to prefer down-scaling to upscaling.
  830|       |	     */
  831|       |
  832|      0|	    if ((magnify && distance >= 0) || fabs (distance) <= min_distance) {
  ------------------
  |  Branch (832:11): [True: 0, False: 0]
  |  Branch (832:22): [True: 0, False: 0]
  |  Branch (832:40): [True: 0, False: 0]
  ------------------
  833|      0|		magnify = distance < 0;
  834|      0|		min_distance = fabs (distance);
  835|      0|		best_x_size = x_size;
  836|      0|		best_y_size = y_size;
  837|      0|	    }
  838|      0|	}
  839|       |
  840|      0|	x_scale = best_x_size;
  841|      0|	y_scale = best_y_size;
  842|      0|    }
  843|       |
  844|      2|    sf->x_scale = x_scale;
  845|      2|    sf->y_scale = y_scale;
  846|       |
  847|      2|    cairo_matrix_scale (&normalized, 1.0 / x_scale, 1.0 / y_scale);
  848|       |
  849|      2|    _cairo_matrix_get_affine (&normalized,
  850|      2|			      &sf->shape[0][0], &sf->shape[0][1],
  851|      2|			      &sf->shape[1][0], &sf->shape[1][1],
  852|      2|			      NULL, NULL);
  853|       |
  854|      2|    return CAIRO_STATUS_SUCCESS;
  855|      2|}
cairo-ft-font.c:_cairo_ft_font_options_substitute:
 4145|      1|{
 4146|      1|    FcValue v;
 4147|       |
 4148|      1|    if (options->antialias != CAIRO_ANTIALIAS_DEFAULT)
  ------------------
  |  Branch (4148:9): [True: 0, False: 1]
  ------------------
 4149|      0|    {
 4150|      0|	if (FcPatternGet (pattern, FC_ANTIALIAS, 0, &v) == FcResultNoMatch)
  ------------------
  |  |   90|      0|#define FC_ANTIALIAS	    "antialias"		/* Bool (depends) */
  ------------------
  |  Branch (4150:6): [True: 0, False: 0]
  ------------------
 4151|      0|	{
 4152|      0|	    if (! FcPatternAddBool (pattern,
  ------------------
  |  Branch (4152:10): [True: 0, False: 0]
  ------------------
 4153|      0|			            FC_ANTIALIAS,
  ------------------
  |  |   90|      0|#define FC_ANTIALIAS	    "antialias"		/* Bool (depends) */
  ------------------
 4154|      0|				    options->antialias != CAIRO_ANTIALIAS_NONE))
 4155|      0|		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 4156|       |
 4157|      0|	    if (options->antialias != CAIRO_ANTIALIAS_SUBPIXEL) {
  ------------------
  |  Branch (4157:10): [True: 0, False: 0]
  ------------------
 4158|      0|		FcPatternDel (pattern, FC_RGBA);
  ------------------
  |  |  109|      0|#define FC_RGBA		    "rgba"		/* Int */
  ------------------
 4159|      0|		if (! FcPatternAddInteger (pattern, FC_RGBA, FC_RGBA_NONE))
  ------------------
  |  |  109|      0|#define FC_RGBA		    "rgba"		/* Int */
  ------------------
              		if (! FcPatternAddInteger (pattern, FC_RGBA, FC_RGBA_NONE))
  ------------------
  |  |  192|      0|#define FC_RGBA_NONE	    5
  ------------------
  |  Branch (4159:7): [True: 0, False: 0]
  ------------------
 4160|      0|		    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 4161|      0|	    }
 4162|      0|	}
 4163|      0|    }
 4164|       |
 4165|      1|    if (options->antialias != CAIRO_ANTIALIAS_DEFAULT)
  ------------------
  |  Branch (4165:9): [True: 0, False: 1]
  ------------------
 4166|      0|    {
 4167|      0|	if (FcPatternGet (pattern, FC_RGBA, 0, &v) == FcResultNoMatch)
  ------------------
  |  |  109|      0|#define FC_RGBA		    "rgba"		/* Int */
  ------------------
  |  Branch (4167:6): [True: 0, False: 0]
  ------------------
 4168|      0|	{
 4169|      0|	    int rgba;
 4170|       |
 4171|      0|	    if (options->antialias == CAIRO_ANTIALIAS_SUBPIXEL) {
  ------------------
  |  Branch (4171:10): [True: 0, False: 0]
  ------------------
 4172|      0|		switch (options->subpixel_order) {
 4173|      0|		case CAIRO_SUBPIXEL_ORDER_DEFAULT:
  ------------------
  |  Branch (4173:3): [True: 0, False: 0]
  ------------------
 4174|      0|		case CAIRO_SUBPIXEL_ORDER_RGB:
  ------------------
  |  Branch (4174:3): [True: 0, False: 0]
  ------------------
 4175|      0|		default:
  ------------------
  |  Branch (4175:3): [True: 0, False: 0]
  ------------------
 4176|      0|		    rgba = FC_RGBA_RGB;
  ------------------
  |  |  188|      0|#define FC_RGBA_RGB	    1
  ------------------
 4177|      0|		    break;
 4178|      0|		case CAIRO_SUBPIXEL_ORDER_BGR:
  ------------------
  |  Branch (4178:3): [True: 0, False: 0]
  ------------------
 4179|      0|		    rgba = FC_RGBA_BGR;
  ------------------
  |  |  189|      0|#define FC_RGBA_BGR	    2
  ------------------
 4180|      0|		    break;
 4181|      0|		case CAIRO_SUBPIXEL_ORDER_VRGB:
  ------------------
  |  Branch (4181:3): [True: 0, False: 0]
  ------------------
 4182|      0|		    rgba = FC_RGBA_VRGB;
  ------------------
  |  |  190|      0|#define FC_RGBA_VRGB	    3
  ------------------
 4183|      0|		    break;
 4184|      0|		case CAIRO_SUBPIXEL_ORDER_VBGR:
  ------------------
  |  Branch (4184:3): [True: 0, False: 0]
  ------------------
 4185|      0|		    rgba = FC_RGBA_VBGR;
  ------------------
  |  |  191|      0|#define FC_RGBA_VBGR	    4
  ------------------
 4186|      0|		    break;
 4187|      0|		}
 4188|      0|	    } else {
 4189|      0|		rgba = FC_RGBA_NONE;
  ------------------
  |  |  192|      0|#define FC_RGBA_NONE	    5
  ------------------
 4190|      0|	    }
 4191|       |
 4192|      0|	    if (! FcPatternAddInteger (pattern, FC_RGBA, rgba))
  ------------------
  |  |  109|      0|#define FC_RGBA		    "rgba"		/* Int */
  ------------------
  |  Branch (4192:10): [True: 0, False: 0]
  ------------------
 4193|      0|		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 4194|      0|	}
 4195|      0|    }
 4196|       |
 4197|      1|    if (options->lcd_filter != CAIRO_LCD_FILTER_DEFAULT)
  ------------------
  |  Branch (4197:9): [True: 0, False: 1]
  ------------------
 4198|      0|    {
 4199|      0|	if (FcPatternGet (pattern, FC_LCD_FILTER, 0, &v) == FcResultNoMatch)
  ------------------
  |  |  124|      0|#define FC_LCD_FILTER	    "lcdfilter"		/* Int */
  ------------------
  |  Branch (4199:6): [True: 0, False: 0]
  ------------------
 4200|      0|	{
 4201|      0|	    int lcd_filter;
 4202|       |
 4203|      0|	    switch (options->lcd_filter) {
 4204|      0|	    case CAIRO_LCD_FILTER_NONE:
  ------------------
  |  Branch (4204:6): [True: 0, False: 0]
  ------------------
 4205|      0|		lcd_filter = FT_LCD_FILTER_NONE;
 4206|      0|		break;
 4207|      0|	    case CAIRO_LCD_FILTER_INTRA_PIXEL:
  ------------------
  |  Branch (4207:6): [True: 0, False: 0]
  ------------------
 4208|      0|		lcd_filter = FT_LCD_FILTER_LEGACY;
 4209|      0|		break;
 4210|      0|	    case CAIRO_LCD_FILTER_FIR3:
  ------------------
  |  Branch (4210:6): [True: 0, False: 0]
  ------------------
 4211|      0|		lcd_filter = FT_LCD_FILTER_LIGHT;
 4212|      0|		break;
 4213|      0|	    default:
  ------------------
  |  Branch (4213:6): [True: 0, False: 0]
  ------------------
 4214|      0|	    case CAIRO_LCD_FILTER_DEFAULT:
  ------------------
  |  Branch (4214:6): [True: 0, False: 0]
  ------------------
 4215|      0|	    case CAIRO_LCD_FILTER_FIR5:
  ------------------
  |  Branch (4215:6): [True: 0, False: 0]
  ------------------
 4216|      0|		lcd_filter = FT_LCD_FILTER_DEFAULT;
 4217|      0|		break;
 4218|      0|	    }
 4219|       |
 4220|      0|	    if (! FcPatternAddInteger (pattern, FC_LCD_FILTER, lcd_filter))
  ------------------
  |  |  124|      0|#define FC_LCD_FILTER	    "lcdfilter"		/* Int */
  ------------------
  |  Branch (4220:10): [True: 0, False: 0]
  ------------------
 4221|      0|		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 4222|      0|	}
 4223|      0|    }
 4224|       |
 4225|      1|    if (options->hint_style != CAIRO_HINT_STYLE_DEFAULT)
  ------------------
  |  Branch (4225:9): [True: 0, False: 1]
  ------------------
 4226|      0|    {
 4227|      0|	if (FcPatternGet (pattern, FC_HINTING, 0, &v) == FcResultNoMatch)
  ------------------
  |  |   91|      0|#define FC_HINTING	    "hinting"		/* Bool (true) */
  ------------------
  |  Branch (4227:6): [True: 0, False: 0]
  ------------------
 4228|      0|	{
 4229|      0|	    if (! FcPatternAddBool (pattern,
  ------------------
  |  Branch (4229:10): [True: 0, False: 0]
  ------------------
 4230|      0|			            FC_HINTING,
  ------------------
  |  |   91|      0|#define FC_HINTING	    "hinting"		/* Bool (true) */
  ------------------
 4231|      0|				    options->hint_style != CAIRO_HINT_STYLE_NONE))
 4232|      0|		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 4233|      0|	}
 4234|       |
 4235|      0|	if (FcPatternGet (pattern, FC_HINT_STYLE, 0, &v) == FcResultNoMatch)
  ------------------
  |  |   92|      0|#define FC_HINT_STYLE	    "hintstyle"		/* Int */
  ------------------
  |  Branch (4235:6): [True: 0, False: 0]
  ------------------
 4236|      0|	{
 4237|      0|	    int hint_style;
 4238|       |
 4239|      0|	    switch (options->hint_style) {
 4240|      0|	    case CAIRO_HINT_STYLE_NONE:
  ------------------
  |  Branch (4240:6): [True: 0, False: 0]
  ------------------
 4241|      0|		hint_style = FC_HINT_NONE;
  ------------------
  |  |  195|      0|#define FC_HINT_NONE        0
  ------------------
 4242|      0|		break;
 4243|      0|	    case CAIRO_HINT_STYLE_SLIGHT:
  ------------------
  |  Branch (4243:6): [True: 0, False: 0]
  ------------------
 4244|      0|		hint_style = FC_HINT_SLIGHT;
  ------------------
  |  |  196|      0|#define FC_HINT_SLIGHT      1
  ------------------
 4245|      0|		break;
 4246|      0|	    case CAIRO_HINT_STYLE_MEDIUM:
  ------------------
  |  Branch (4246:6): [True: 0, False: 0]
  ------------------
 4247|      0|		hint_style = FC_HINT_MEDIUM;
  ------------------
  |  |  197|      0|#define FC_HINT_MEDIUM      2
  ------------------
 4248|      0|		break;
 4249|      0|	    case CAIRO_HINT_STYLE_FULL:
  ------------------
  |  Branch (4249:6): [True: 0, False: 0]
  ------------------
 4250|      0|	    case CAIRO_HINT_STYLE_DEFAULT:
  ------------------
  |  Branch (4250:6): [True: 0, False: 0]
  ------------------
 4251|      0|	    default:
  ------------------
  |  Branch (4251:6): [True: 0, False: 0]
  ------------------
 4252|      0|		hint_style = FC_HINT_FULL;
  ------------------
  |  |  198|      0|#define FC_HINT_FULL        3
  ------------------
 4253|      0|		break;
 4254|      0|	    }
 4255|       |
 4256|      0|	    if (! FcPatternAddInteger (pattern, FC_HINT_STYLE, hint_style))
  ------------------
  |  |   92|      0|#define FC_HINT_STYLE	    "hintstyle"		/* Int */
  ------------------
  |  Branch (4256:10): [True: 0, False: 0]
  ------------------
 4257|      0|		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 4258|      0|	}
 4259|      0|    }
 4260|       |
 4261|      1|    return CAIRO_STATUS_SUCCESS;
 4262|      1|}
cairo-ft-font.c:_cairo_ft_unscaled_font_create_for_pattern:
  614|      2|{
  615|      2|    FT_Face font_face = NULL;
  616|      2|    char *filename = NULL;
  617|      2|    int id = 0;
  618|      2|    FcResult ret;
  619|       |
  620|      2|    ret = FcPatternGetFTFace (pattern, FC_FT_FACE, 0, &font_face);
  ------------------
  |  |  100|      2|#define FC_FT_FACE	    "ftface"		/* FT_Face */
  ------------------
  621|      2|    if (ret == FcResultMatch)
  ------------------
  |  Branch (621:9): [True: 0, False: 2]
  ------------------
  622|      0|	goto DONE;
  623|      2|    if (ret == FcResultOutOfMemory)
  ------------------
  |  Branch (623:9): [True: 0, False: 2]
  ------------------
  624|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  625|       |
  626|      2|    ret = FcPatternGetString (pattern, FC_FILE, 0, (FcChar8 **) &filename);
  ------------------
  |  |   98|      2|#define FC_FILE		    "file"		/* String */
  ------------------
  627|      2|    if (ret == FcResultOutOfMemory)
  ------------------
  |  Branch (627:9): [True: 0, False: 2]
  ------------------
  628|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  629|      2|    if (ret == FcResultMatch) {
  ------------------
  |  Branch (629:9): [True: 1, False: 1]
  ------------------
  630|      1|	if (access (filename, R_OK) == 0) {
  ------------------
  |  Branch (630:6): [True: 1, False: 0]
  ------------------
  631|       |	    /* If FC_INDEX is not set, we just use 0 */
  632|      1|	    ret = FcPatternGetInteger (pattern, FC_INDEX, 0, &id);
  ------------------
  |  |   99|      1|#define FC_INDEX	    "index"		/* Int */
  ------------------
  633|      1|	    if (ret == FcResultOutOfMemory)
  ------------------
  |  Branch (633:10): [True: 0, False: 1]
  ------------------
  634|      0|		return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  635|       |
  636|      1|	    goto DONE;
  637|      1|	} else
  638|      0|	    return _cairo_error (CAIRO_STATUS_FILE_NOT_FOUND);
  639|      1|    }
  640|       |
  641|       |    /* The pattern contains neither a face nor a filename, resolve it later. */
  642|      1|    *out = NULL;
  643|      1|    return CAIRO_STATUS_SUCCESS;
  644|       |
  645|      1|DONE:
  646|       |    return _cairo_ft_unscaled_font_create_internal (font_face != NULL,
  647|      1|						    filename, id, font_face,
  648|      1|						    out);
  649|      2|}
cairo-ft-font.c:_cairo_ft_unscaled_font_create_internal:
  559|      1|{
  560|      1|    cairo_ft_unscaled_font_t key, *unscaled;
  561|      1|    cairo_ft_unscaled_font_map_t *font_map;
  562|      1|    cairo_status_t status;
  563|       |
  564|      1|    font_map = _cairo_ft_unscaled_font_map_lock ();
  565|      1|    if (unlikely (font_map == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  566|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  567|       |
  568|      1|    _cairo_ft_unscaled_font_init_key (&key, from_face, filename, id, font_face);
  569|       |
  570|       |    /* Return existing unscaled font if it exists in the hash table. */
  571|      1|    unscaled = _cairo_hash_table_lookup (font_map->hash_table,
  572|      1|					 &key.base.hash_entry);
  573|      1|    if (unscaled != NULL) {
  ------------------
  |  Branch (573:9): [True: 0, False: 1]
  ------------------
  574|      0|	_cairo_unscaled_font_reference (&unscaled->base);
  575|      0|	goto DONE;
  576|      0|    }
  577|       |
  578|       |    /* Otherwise create it and insert into hash table. */
  579|      1|    unscaled = _cairo_calloc (sizeof (cairo_ft_unscaled_font_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
  580|      1|    if (unlikely (unscaled == NULL)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  581|      0|	status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
  582|      0|	goto UNWIND_FONT_MAP_LOCK;
  583|      0|    }
  584|       |
  585|      1|    status = _cairo_ft_unscaled_font_init (unscaled, from_face, filename, id, font_face);
  586|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  587|      0|	goto UNWIND_UNSCALED_MALLOC;
  588|       |
  589|      1|    assert (unscaled->base.hash_entry.hash == key.base.hash_entry.hash);
  ------------------
  |  Branch (589:5): [True: 0, False: 1]
  |  Branch (589:5): [True: 1, False: 0]
  ------------------
  590|      1|    status = _cairo_hash_table_insert (font_map->hash_table,
  591|      1|				       &unscaled->base.hash_entry);
  592|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  593|      0|	goto UNWIND_UNSCALED_FONT_INIT;
  594|       |
  595|      1|DONE:
  596|      1|    _cairo_ft_unscaled_font_map_unlock ();
  597|      1|    *out = unscaled;
  598|      1|    return CAIRO_STATUS_SUCCESS;
  599|       |
  600|      0|UNWIND_UNSCALED_FONT_INIT:
  601|      0|    _cairo_ft_unscaled_font_fini (unscaled);
  602|      0|UNWIND_UNSCALED_MALLOC:
  603|      0|    free (unscaled);
  604|      0|UNWIND_FONT_MAP_LOCK:
  605|      0|    _cairo_ft_unscaled_font_map_unlock ();
  606|      0|    return status;
  607|      0|}
cairo-ft-font.c:_cairo_ft_unscaled_font_map_lock:
  388|      2|{
  389|      2|    CAIRO_MUTEX_INITIALIZE ();
  ------------------
  |  |  173|      2|#define CAIRO_MUTEX_INITIALIZE		CAIRO_MUTEX_IMPL_INITIALIZE
  |  |  ------------------
  |  |  |  |   88|      2|#  define CAIRO_MUTEX_IMPL_INITIALIZE() CAIRO_MUTEX_IMPL_NOOP
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|      2|#define CAIRO_MUTEX_IMPL_NOOP	do {/*no-op*/} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (53:53): [Folded, False: 2]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  390|       |
  391|      2|    CAIRO_MUTEX_LOCK (_cairo_ft_unscaled_font_map_mutex);
  ------------------
  |  |  175|      2|#define CAIRO_MUTEX_LOCK		CAIRO_MUTEX_IMPL_LOCK
  |  |  ------------------
  |  |  |  |  206|      2|# define CAIRO_MUTEX_IMPL_LOCK(mutex) pthread_mutex_lock (&(mutex))
  |  |  ------------------
  ------------------
  392|       |
  393|      2|    if (unlikely (cairo_ft_unscaled_font_map == NULL)) {
  ------------------
  |  |  145|      2|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 1, False: 1]
  |  |  ------------------
  ------------------
  394|      1|	if (unlikely (_cairo_ft_unscaled_font_map_create ())) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  395|      0|	    CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
  ------------------
  |  |  177|      0|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|      0|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  396|      0|	    return NULL;
  397|      0|	}
  398|      1|    }
  399|       |
  400|      2|    return cairo_ft_unscaled_font_map;
  401|      2|}
cairo-ft-font.c:_cairo_ft_unscaled_font_map_create:
  311|      1|{
  312|      1|    cairo_ft_unscaled_font_map_t *font_map;
  313|       |
  314|       |    /* This function is only intended to be called from
  315|       |     * _cairo_ft_unscaled_font_map_lock. So we'll crash if we can
  316|       |     * detect some other call path. */
  317|      1|    assert (cairo_ft_unscaled_font_map == NULL);
  ------------------
  |  Branch (317:5): [True: 0, False: 1]
  |  Branch (317:5): [True: 1, False: 0]
  ------------------
  318|       |
  319|      1|    font_map = _cairo_calloc (sizeof (cairo_ft_unscaled_font_map_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
  320|      1|    if (unlikely (font_map == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  321|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  322|       |
  323|      1|    font_map->hash_table =
  324|      1|	_cairo_hash_table_create (_cairo_ft_unscaled_font_keys_equal);
  325|       |
  326|      1|    if (unlikely (font_map->hash_table == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  327|      0|	goto FAIL;
  328|       |
  329|      1|    if (unlikely (FT_Init_FreeType (&font_map->ft_library)))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  330|      0|	goto FAIL;
  331|       |
  332|      1|    font_map->num_open_faces = 0;
  333|       |
  334|      1|    cairo_ft_unscaled_font_map = font_map;
  335|      1|    return CAIRO_STATUS_SUCCESS;
  336|       |
  337|      0|FAIL:
  338|      0|    if (font_map->hash_table)
  ------------------
  |  Branch (338:9): [True: 0, False: 0]
  ------------------
  339|      0|	_cairo_hash_table_destroy (font_map->hash_table);
  340|      0|    free (font_map);
  341|       |
  342|      0|    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  343|      1|}
cairo-ft-font.c:_cairo_ft_unscaled_font_init_key:
  415|      2|{
  416|      2|    uintptr_t hash;
  417|       |
  418|      2|    key->from_face = from_face;
  419|      2|    key->filename = filename;
  420|      2|    key->id = id;
  421|      2|    key->face = face;
  422|       |
  423|      2|    hash = _cairo_hash_string (filename);
  424|       |    /* the constants are just arbitrary primes */
  425|      2|    hash += ((uintptr_t) id) * 1607;
  426|      2|    hash += ((uintptr_t) face) * 2137;
  427|       |
  428|      2|    key->base.hash_entry.hash = hash;
  429|      2|}
cairo-ft-font.c:_cairo_ft_unscaled_font_init:
  458|      1|{
  459|      1|    _cairo_unscaled_font_init (&unscaled->base,
  460|      1|			       &cairo_ft_unscaled_font_backend);
  461|       |
  462|      1|    unscaled->variations = NULL;
  463|       |
  464|      1|    if (from_face) {
  ------------------
  |  Branch (464:9): [True: 0, False: 1]
  ------------------
  465|      0|	FT_MM_Var *ft_mm_var;
  466|      0|	unscaled->from_face = TRUE;
  ------------------
  |  |  106|      0|#define TRUE 1
  ------------------
  467|      0|	_cairo_ft_unscaled_font_init_key (unscaled, TRUE, NULL, id, face);
  ------------------
  |  |  106|      0|#define TRUE 1
  ------------------
  468|       |
  469|       |
  470|      0|        unscaled->have_color = FT_HAS_COLOR (face) != 0;
  ------------------
  |  | 1690|      0|          ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )
  |  |  ------------------
  |  |  |  | 1427|      0|#define FT_FACE_FLAG_COLOR             ( 1L << 14 )
  |  |  ------------------
  ------------------
  471|      0|        unscaled->have_color_set = TRUE;
  ------------------
  |  |  106|      0|#define TRUE 1
  ------------------
  472|      0|	if (FT_Get_MM_Var (face, &ft_mm_var) == 0) {
  ------------------
  |  Branch (472:6): [True: 0, False: 0]
  ------------------
  473|      0|	    unscaled->variations = _cairo_calloc_ab (ft_mm_var->num_axis, sizeof (FT_Fixed));
  474|      0|	    if (unscaled->variations)
  ------------------
  |  Branch (474:10): [True: 0, False: 0]
  ------------------
  475|      0|		FT_Get_Var_Design_Coordinates (face, ft_mm_var->num_axis, unscaled->variations);
  476|      0|	    FT_Done_MM_Var (face->glyph->library, ft_mm_var);
  477|      0|	}
  478|      1|    } else {
  479|      1|	char *filename_copy;
  480|       |
  481|      1|	unscaled->from_face = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  482|      1|	unscaled->face = NULL;
  483|       |
  484|      1|	filename_copy = strdup (filename);
  485|      1|	if (unlikely (filename_copy == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  486|      0|	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  487|       |
  488|      1|	_cairo_ft_unscaled_font_init_key (unscaled, FALSE, filename_copy, id, NULL);
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  489|       |
  490|      1|	unscaled->have_color_set = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  491|      1|    }
  492|       |
  493|      1|    unscaled->have_scale = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  494|      1|    CAIRO_MUTEX_INIT (unscaled->mutex);
  ------------------
  |  |  178|      1|#define CAIRO_MUTEX_INIT		CAIRO_MUTEX_IMPL_INIT
  |  |  ------------------
  |  |  |  |   92|      1|# define CAIRO_MUTEX_IMPL_INIT(mutex) do {				\
  |  |  |  |   93|      1|      cairo_mutex_t _tmp_mutex = CAIRO_MUTEX_IMPL_NIL_INITIALIZER;	\
  |  |  |  |  ------------------
  |  |  |  |  |  |  217|      1|# define CAIRO_MUTEX_IMPL_NIL_INITIALIZER PTHREAD_MUTEX_INITIALIZER
  |  |  |  |  ------------------
  |  |  |  |   94|      1|      memcpy (&(mutex), &_tmp_mutex, sizeof (_tmp_mutex));	\
  |  |  |  |   95|      1|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (95:12): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  495|      1|    unscaled->lock_count = 0;
  496|       |
  497|      1|    unscaled->faces = NULL;
  498|       |
  499|      1|    return CAIRO_STATUS_SUCCESS;
  500|      1|}
cairo-ft-font.c:_cairo_ft_unscaled_font_map_unlock:
  405|      2|{
  406|      2|    CAIRO_MUTEX_UNLOCK (_cairo_ft_unscaled_font_map_mutex);
  ------------------
  |  |  177|      2|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|      2|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  407|      2|}
cairo-ft-font.c:_cairo_ft_font_face_create_for_pattern:
 4043|      1|{
 4044|      1|    cairo_ft_font_face_t *font_face;
 4045|       |
 4046|      1|    font_face = _cairo_calloc (sizeof (cairo_ft_font_face_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
 4047|      1|    if (unlikely (font_face == NULL)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4048|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4049|      0|	return (cairo_font_face_t *) &_cairo_font_face_nil;
 4050|      0|    }
 4051|       |
 4052|      1|    font_face->unscaled = NULL;
 4053|       |
 4054|      1|    _get_pattern_ft_options (pattern, &font_face->ft_options);
 4055|       |
 4056|      1|    font_face->next = NULL;
 4057|       |
 4058|      1|    font_face->pattern = FcPatternDuplicate (pattern);
 4059|      1|    if (unlikely (font_face->pattern == NULL)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4060|      0|	free (font_face);
 4061|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4062|      0|	return (cairo_font_face_t *) &_cairo_font_face_nil;
 4063|      0|    }
 4064|       |
 4065|      1|    font_face->resolved_font_face = NULL;
 4066|      1|    font_face->resolved_config = NULL;
 4067|       |
 4068|      1|    _cairo_font_face_init (&font_face->base, &_cairo_ft_font_face_backend);
 4069|       |
 4070|      1|    return &font_face->base;
 4071|      1|}
cairo-ft-font.c:_get_pattern_ft_options:
 1779|      2|{
 1780|      2|    FcBool antialias, vertical_layout, hinting, autohint, bitmap, embolden;
 1781|      2|    cairo_ft_options_t ft_options;
 1782|      2|    int rgba;
 1783|      2|    int hintstyle;
 1784|      2|    char *variations;
 1785|       |
 1786|      2|    _cairo_font_options_init_default (&ft_options.base);
 1787|      2|    ft_options.load_flags = FT_LOAD_DEFAULT;
  ------------------
  |  | 3500|      2|#define FT_LOAD_DEFAULT                      0x0
  ------------------
 1788|      2|    ft_options.synth_flags = 0;
 1789|       |
 1790|       |    /* Check whether to force use of embedded bitmaps */
 1791|      2|    if (FcPatternGetBool (pattern,
  ------------------
  |  Branch (1791:9): [True: 1, False: 1]
  ------------------
 1792|      2|			  FC_EMBEDDED_BITMAP, 0, &bitmap) != FcResultMatch)
  ------------------
  |  |  122|      2|#define FC_EMBEDDED_BITMAP  "embeddedbitmap"	/* Bool - true to enable embedded bitmaps */
  ------------------
 1793|      1|	bitmap = FcFalse;
  ------------------
  |  |   77|      1|#define FcFalse		0
  ------------------
 1794|       |
 1795|       |    /* disable antialiasing if requested */
 1796|      2|    if (FcPatternGetBool (pattern,
  ------------------
  |  Branch (1796:9): [True: 2, False: 0]
  ------------------
 1797|      2|			  FC_ANTIALIAS, 0, &antialias) != FcResultMatch)
  ------------------
  |  |   90|      2|#define FC_ANTIALIAS	    "antialias"		/* Bool (depends) */
  ------------------
 1798|      2|	antialias = FcTrue;
  ------------------
  |  |   78|      2|#define FcTrue		1
  ------------------
 1799|       |
 1800|      2|    if (antialias) {
  ------------------
  |  Branch (1800:9): [True: 2, False: 0]
  ------------------
 1801|      2|	cairo_subpixel_order_t subpixel_order;
 1802|      2|	int lcd_filter;
 1803|       |
 1804|       |	/* disable hinting if requested */
 1805|      2|	if (FcPatternGetBool (pattern,
  ------------------
  |  Branch (1805:6): [True: 1, False: 1]
  ------------------
 1806|      2|			      FC_HINTING, 0, &hinting) != FcResultMatch)
  ------------------
  |  |   91|      2|#define FC_HINTING	    "hinting"		/* Bool (true) */
  ------------------
 1807|      1|	    hinting = FcTrue;
  ------------------
  |  |   78|      1|#define FcTrue		1
  ------------------
 1808|       |
 1809|      2|	if (FcPatternGetInteger (pattern,
  ------------------
  |  Branch (1809:6): [True: 2, False: 0]
  ------------------
 1810|      2|				 FC_RGBA, 0, &rgba) != FcResultMatch)
  ------------------
  |  |  109|      2|#define FC_RGBA		    "rgba"		/* Int */
  ------------------
 1811|      2|	    rgba = FC_RGBA_UNKNOWN;
  ------------------
  |  |  187|      2|#define FC_RGBA_UNKNOWN	    0
  ------------------
 1812|       |
 1813|      2|	switch (rgba) {
 1814|      0|	case FC_RGBA_RGB:
  ------------------
  |  |  188|      0|#define FC_RGBA_RGB	    1
  ------------------
  |  Branch (1814:2): [True: 0, False: 2]
  ------------------
 1815|      0|	    subpixel_order = CAIRO_SUBPIXEL_ORDER_RGB;
 1816|      0|	    break;
 1817|      0|	case FC_RGBA_BGR:
  ------------------
  |  |  189|      0|#define FC_RGBA_BGR	    2
  ------------------
  |  Branch (1817:2): [True: 0, False: 2]
  ------------------
 1818|      0|	    subpixel_order = CAIRO_SUBPIXEL_ORDER_BGR;
 1819|      0|	    break;
 1820|      0|	case FC_RGBA_VRGB:
  ------------------
  |  |  190|      0|#define FC_RGBA_VRGB	    3
  ------------------
  |  Branch (1820:2): [True: 0, False: 2]
  ------------------
 1821|      0|	    subpixel_order = CAIRO_SUBPIXEL_ORDER_VRGB;
 1822|      0|	    break;
 1823|      0|	case FC_RGBA_VBGR:
  ------------------
  |  |  191|      0|#define FC_RGBA_VBGR	    4
  ------------------
  |  Branch (1823:2): [True: 0, False: 2]
  ------------------
 1824|      0|	    subpixel_order = CAIRO_SUBPIXEL_ORDER_VBGR;
 1825|      0|	    break;
 1826|      2|	case FC_RGBA_UNKNOWN:
  ------------------
  |  |  187|      2|#define FC_RGBA_UNKNOWN	    0
  ------------------
  |  Branch (1826:2): [True: 2, False: 0]
  ------------------
 1827|      2|	case FC_RGBA_NONE:
  ------------------
  |  |  192|      2|#define FC_RGBA_NONE	    5
  ------------------
  |  Branch (1827:2): [True: 0, False: 2]
  ------------------
 1828|      2|	default:
  ------------------
  |  Branch (1828:2): [True: 0, False: 2]
  ------------------
 1829|      2|	    subpixel_order = CAIRO_SUBPIXEL_ORDER_DEFAULT;
 1830|      2|	    break;
 1831|      2|	}
 1832|       |
 1833|      2|	if (subpixel_order != CAIRO_SUBPIXEL_ORDER_DEFAULT) {
  ------------------
  |  Branch (1833:6): [True: 0, False: 2]
  ------------------
 1834|      0|	    ft_options.base.subpixel_order = subpixel_order;
 1835|      0|	    ft_options.base.antialias = CAIRO_ANTIALIAS_SUBPIXEL;
 1836|      0|	}
 1837|       |
 1838|      2|	if (FcPatternGetInteger (pattern,
  ------------------
  |  Branch (1838:6): [True: 0, False: 2]
  ------------------
 1839|      2|				 FC_LCD_FILTER, 0, &lcd_filter) == FcResultMatch)
  ------------------
  |  |  124|      2|#define FC_LCD_FILTER	    "lcdfilter"		/* Int */
  ------------------
 1840|      0|	{
 1841|      0|	    switch (lcd_filter) {
  ------------------
  |  Branch (1841:14): [True: 0, False: 0]
  ------------------
 1842|      0|	    case FC_LCD_NONE:
  ------------------
  |  |  201|      0|#define FC_LCD_NONE	    0
  ------------------
  |  Branch (1842:6): [True: 0, False: 0]
  ------------------
 1843|      0|		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_NONE;
 1844|      0|		break;
 1845|      0|	    case FC_LCD_DEFAULT:
  ------------------
  |  |  202|      0|#define FC_LCD_DEFAULT	    1
  ------------------
  |  Branch (1845:6): [True: 0, False: 0]
  ------------------
 1846|      0|		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR5;
 1847|      0|		break;
 1848|      0|	    case FC_LCD_LIGHT:
  ------------------
  |  |  203|      0|#define FC_LCD_LIGHT	    2
  ------------------
  |  Branch (1848:6): [True: 0, False: 0]
  ------------------
 1849|      0|		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_FIR3;
 1850|      0|		break;
 1851|      0|	    case FC_LCD_LEGACY:
  ------------------
  |  |  204|      0|#define FC_LCD_LEGACY	    3
  ------------------
  |  Branch (1851:6): [True: 0, False: 0]
  ------------------
 1852|      0|		ft_options.base.lcd_filter = CAIRO_LCD_FILTER_INTRA_PIXEL;
 1853|      0|		break;
 1854|      0|	    }
 1855|      0|	}
 1856|       |
 1857|      2|	if (FcPatternGetInteger (pattern,
  ------------------
  |  Branch (1857:6): [True: 1, False: 1]
  ------------------
 1858|      2|				 FC_HINT_STYLE, 0, &hintstyle) != FcResultMatch)
  ------------------
  |  |   92|      2|#define FC_HINT_STYLE	    "hintstyle"		/* Int */
  ------------------
 1859|      1|	    hintstyle = FC_HINT_FULL;
  ------------------
  |  |  198|      1|#define FC_HINT_FULL        3
  ------------------
 1860|       |
 1861|      2|	if (!hinting)
  ------------------
  |  Branch (1861:6): [True: 0, False: 2]
  ------------------
 1862|      0|	    hintstyle = FC_HINT_NONE;
  ------------------
  |  |  195|      0|#define FC_HINT_NONE        0
  ------------------
 1863|       |
 1864|      2|	switch (hintstyle) {
 1865|      0|	case FC_HINT_NONE:
  ------------------
  |  |  195|      0|#define FC_HINT_NONE        0
  ------------------
  |  Branch (1865:2): [True: 0, False: 2]
  ------------------
 1866|      0|	    ft_options.base.hint_style = CAIRO_HINT_STYLE_NONE;
 1867|      0|	    break;
 1868|      0|	case FC_HINT_SLIGHT:
  ------------------
  |  |  196|      0|#define FC_HINT_SLIGHT      1
  ------------------
  |  Branch (1868:2): [True: 0, False: 2]
  ------------------
 1869|      0|	    ft_options.base.hint_style = CAIRO_HINT_STYLE_SLIGHT;
 1870|      0|	    break;
 1871|      0|	case FC_HINT_MEDIUM:
  ------------------
  |  |  197|      0|#define FC_HINT_MEDIUM      2
  ------------------
  |  Branch (1871:2): [True: 0, False: 2]
  ------------------
 1872|      0|	default:
  ------------------
  |  Branch (1872:2): [True: 0, False: 2]
  ------------------
 1873|      0|	    ft_options.base.hint_style = CAIRO_HINT_STYLE_MEDIUM;
 1874|      0|	    break;
 1875|      2|	case FC_HINT_FULL:
  ------------------
  |  |  198|      2|#define FC_HINT_FULL        3
  ------------------
  |  Branch (1875:2): [True: 2, False: 0]
  ------------------
 1876|      2|	    ft_options.base.hint_style = CAIRO_HINT_STYLE_FULL;
 1877|      2|	    break;
 1878|      2|	}
 1879|       |
 1880|       |	/* Force embedded bitmaps off if no hinting requested */
 1881|      2|	if (ft_options.base.hint_style == CAIRO_HINT_STYLE_NONE)
  ------------------
  |  Branch (1881:6): [True: 0, False: 2]
  ------------------
 1882|      0|	  bitmap = FcFalse;
  ------------------
  |  |   77|      0|#define FcFalse		0
  ------------------
 1883|       |
 1884|      2|	if (!bitmap)
  ------------------
  |  Branch (1884:6): [True: 1, False: 1]
  ------------------
 1885|      1|	    ft_options.load_flags |= FT_LOAD_NO_BITMAP;
  ------------------
  |  | 3504|      1|#define FT_LOAD_NO_BITMAP                    ( 1L << 3  )
  ------------------
 1886|       |
 1887|      2|    } else {
 1888|      0|	ft_options.base.antialias = CAIRO_ANTIALIAS_NONE;
 1889|      0|    }
 1890|       |
 1891|       |    /* force autohinting if requested */
 1892|      2|    if (FcPatternGetBool (pattern,
  ------------------
  |  Branch (1892:9): [True: 1, False: 1]
  ------------------
 1893|      2|			  FC_AUTOHINT, 0, &autohint) != FcResultMatch)
  ------------------
  |  |   94|      2|#define FC_AUTOHINT	    "autohint"		/* Bool (false) */
  ------------------
 1894|      1|	autohint = FcFalse;
  ------------------
  |  |   77|      1|#define FcFalse		0
  ------------------
 1895|       |
 1896|      2|    if (autohint)
  ------------------
  |  Branch (1896:9): [True: 0, False: 2]
  ------------------
 1897|      0|	ft_options.load_flags |= FT_LOAD_FORCE_AUTOHINT;
  ------------------
  |  | 3506|      0|#define FT_LOAD_FORCE_AUTOHINT               ( 1L << 5  )
  ------------------
 1898|       |
 1899|      2|    if (FcPatternGetBool (pattern,
  ------------------
  |  Branch (1899:9): [True: 1, False: 1]
  ------------------
 1900|      2|			  FC_VERTICAL_LAYOUT, 0, &vertical_layout) != FcResultMatch)
  ------------------
  |  |   93|      2|#define FC_VERTICAL_LAYOUT  "verticallayout"	/* Bool (false) */
  ------------------
 1901|      1|	vertical_layout = FcFalse;
  ------------------
  |  |   77|      1|#define FcFalse		0
  ------------------
 1902|       |
 1903|      2|    if (vertical_layout)
  ------------------
  |  Branch (1903:9): [True: 0, False: 2]
  ------------------
 1904|      0|	ft_options.load_flags |= FT_LOAD_VERTICAL_LAYOUT;
  ------------------
  |  | 3505|      0|#define FT_LOAD_VERTICAL_LAYOUT              ( 1L << 4  )
  ------------------
 1905|       |
 1906|      2|    if (FcPatternGetBool (pattern,
  ------------------
  |  Branch (1906:9): [True: 2, False: 0]
  ------------------
 1907|      2|			  FC_EMBOLDEN, 0, &embolden) != FcResultMatch)
  ------------------
  |  |  121|      2|#define FC_EMBOLDEN	    "embolden"		/* Bool - true if emboldening needed*/
  ------------------
 1908|      2|	embolden = FcFalse;
  ------------------
  |  |   77|      2|#define FcFalse		0
  ------------------
 1909|       |
 1910|      2|    if (embolden)
  ------------------
  |  Branch (1910:9): [True: 0, False: 2]
  ------------------
 1911|      0|	ft_options.synth_flags |= CAIRO_FT_SYNTHESIZE_BOLD;
 1912|       |
 1913|      2|    if (FcPatternGetString (pattern, FC_FONT_VARIATIONS, 0, (FcChar8 **) &variations) == FcResultMatch) {
  ------------------
  |  |  126|      2|#define FC_FONT_VARIATIONS  "fontvariations"	/* String */
  ------------------
  |  Branch (1913:9): [True: 0, False: 2]
  ------------------
 1914|      0|      ft_options.base.variations = strdup (variations);
 1915|      0|    }
 1916|       |
 1917|      2|    *ret = ft_options;
 1918|      2|}
cairo-ft-font.c:_cairo_ft_font_face_create:
 4077|      1|{
 4078|      1|    cairo_ft_font_face_t *font_face, **prev_font_face;
 4079|       |
 4080|       |    /* Looked for an existing matching font face */
 4081|      1|    for (font_face = unscaled->faces, prev_font_face = &unscaled->faces;
 4082|      1|	 font_face;
  ------------------
  |  Branch (4082:3): [True: 0, False: 1]
  ------------------
 4083|      1|	 prev_font_face = &font_face->next, font_face = font_face->next)
 4084|      0|    {
 4085|      0|	if (font_face->ft_options.load_flags == ft_options->load_flags &&
  ------------------
  |  Branch (4085:6): [True: 0, False: 0]
  ------------------
 4086|      0|	    font_face->ft_options.synth_flags == ft_options->synth_flags &&
  ------------------
  |  Branch (4086:6): [True: 0, False: 0]
  ------------------
 4087|      0|	    cairo_font_options_equal (&font_face->ft_options.base, &ft_options->base))
  ------------------
  |  Branch (4087:6): [True: 0, False: 0]
  ------------------
 4088|      0|	{
 4089|      0|	    if (font_face->base.status) {
  ------------------
  |  Branch (4089:10): [True: 0, False: 0]
  ------------------
 4090|       |		/* The font_face has been left in an error state, abandon it. */
 4091|      0|		*prev_font_face = font_face->next;
 4092|      0|		break;
 4093|      0|	    }
 4094|       |
 4095|      0|	    if (font_face->unscaled == NULL) {
  ------------------
  |  Branch (4095:10): [True: 0, False: 0]
  ------------------
 4096|       |		/* Resurrect this "zombie" font_face (from
 4097|       |		 * _cairo_ft_font_face_destroy), switching its unscaled_font
 4098|       |		 * from owner to ownee. */
 4099|      0|		font_face->unscaled = unscaled;
 4100|      0|		_cairo_unscaled_font_reference (&unscaled->base);
 4101|      0|		return &font_face->base;
 4102|      0|	    } else
 4103|      0|		return cairo_font_face_reference (&font_face->base);
 4104|      0|	}
 4105|      0|    }
 4106|       |
 4107|       |    /* No match found, create a new one */
 4108|      1|    font_face = _cairo_calloc (sizeof (cairo_ft_font_face_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
 4109|      1|    if (unlikely (!font_face)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 4110|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 4111|      0|	return (cairo_font_face_t *)&_cairo_font_face_nil;
 4112|      0|    }
 4113|       |
 4114|      1|    font_face->unscaled = unscaled;
 4115|      1|    _cairo_unscaled_font_reference (&unscaled->base);
 4116|       |
 4117|      1|    _cairo_ft_options_init_copy (&font_face->ft_options, ft_options);
 4118|       |
 4119|      1|    if (unscaled->faces && unscaled->faces->unscaled == NULL) {
  ------------------
  |  Branch (4119:9): [True: 0, False: 1]
  |  Branch (4119:28): [True: 0, False: 0]
  ------------------
 4120|       |	/* This "zombie" font_face (from _cairo_ft_font_face_destroy)
 4121|       |	 * is no longer needed. */
 4122|      0|	assert (unscaled->from_face && unscaled->faces->next == NULL);
  ------------------
  |  Branch (4122:2): [True: 0, False: 0]
  |  Branch (4122:2): [True: 0, False: 0]
  |  Branch (4122:2): [True: 0, False: 0]
  |  Branch (4122:2): [True: 0, False: 0]
  ------------------
 4123|      0|	cairo_font_face_destroy (&unscaled->faces->base);
 4124|      0|	unscaled->faces = NULL;
 4125|      0|    }
 4126|       |
 4127|      1|    font_face->next = unscaled->faces;
 4128|      1|    unscaled->faces = font_face;
 4129|       |
 4130|      1|#if CAIRO_HAS_FC_FONT
 4131|      1|    font_face->pattern = NULL;
 4132|      1|#endif
 4133|       |
 4134|      1|    _cairo_font_face_init (&font_face->base, &_cairo_ft_font_face_backend);
 4135|       |
 4136|      1|    return &font_face->base;
 4137|      1|}
cairo-ft-font.c:_cairo_ft_options_init_copy:
  211|      1|{
  212|      1|    _cairo_font_options_init_copy (&options->base, &other->base);
  213|      1|    options->load_flags = other->load_flags;
  214|      1|    options->synth_flags = other->synth_flags;
  215|      1|}
cairo-ft-font.c:_cairo_ft_options_fini:
  219|      1|{
  220|      1|    _cairo_font_options_fini (&options->base);
  221|      1|}
cairo-ft-font.c:_cairo_ft_unscaled_font_lock_face:
  713|      1|{
  714|      1|    cairo_ft_unscaled_font_map_t *font_map;
  715|      1|    FT_Face face = NULL;
  716|      1|    FT_Error error;
  717|       |
  718|      1|    CAIRO_MUTEX_LOCK (unscaled->mutex);
  ------------------
  |  |  175|      1|#define CAIRO_MUTEX_LOCK		CAIRO_MUTEX_IMPL_LOCK
  |  |  ------------------
  |  |  |  |  206|      1|# define CAIRO_MUTEX_IMPL_LOCK(mutex) pthread_mutex_lock (&(mutex))
  |  |  ------------------
  ------------------
  719|      1|    unscaled->lock_count++;
  720|       |
  721|      1|    if (unscaled->face)
  ------------------
  |  Branch (721:9): [True: 0, False: 1]
  ------------------
  722|      0|	return unscaled->face;
  723|       |
  724|       |    /* If this unscaled font was created from an FT_Face then we just
  725|       |     * returned it above. */
  726|      1|    assert (!unscaled->from_face);
  ------------------
  |  Branch (726:5): [True: 0, False: 1]
  |  Branch (726:5): [True: 1, False: 0]
  ------------------
  727|       |
  728|      1|    font_map = _cairo_ft_unscaled_font_map_lock ();
  729|      1|    {
  730|      1|	assert (font_map != NULL);
  ------------------
  |  Branch (730:2): [True: 0, False: 1]
  |  Branch (730:2): [True: 1, False: 0]
  ------------------
  731|       |
  732|      1|	while (font_map->num_open_faces >= MAX_OPEN_FACES)
  ------------------
  |  |  115|      1|#define MAX_OPEN_FACES 10
  ------------------
  |  Branch (732:9): [True: 0, False: 1]
  ------------------
  733|      0|	{
  734|      0|	    cairo_ft_unscaled_font_t *entry;
  735|       |
  736|      0|	    entry = _cairo_hash_table_random_entry (font_map->hash_table,
  737|      0|						    _has_unlocked_face);
  738|      0|	    if (entry == NULL)
  ------------------
  |  Branch (738:10): [True: 0, False: 0]
  ------------------
  739|      0|		break;
  740|       |
  741|      0|	    _font_map_release_face_lock_held (font_map, entry);
  742|      0|	}
  743|      1|    }
  744|      1|    _cairo_ft_unscaled_font_map_unlock ();
  745|       |
  746|      1|    error = FT_New_Face (font_map->ft_library,
  747|      1|			 unscaled->filename,
  748|      1|			 unscaled->id,
  749|      1|			 &face);
  750|      1|    if (error)
  ------------------
  |  Branch (750:9): [True: 0, False: 1]
  ------------------
  751|      0|    {
  752|      0|	unscaled->lock_count--;
  753|      0|	CAIRO_MUTEX_UNLOCK (unscaled->mutex);
  ------------------
  |  |  177|      0|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|      0|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  754|      0|	_cairo_error_throw (_cairo_ft_to_cairo_error (error));
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  755|      0|	return NULL;
  756|      0|    }
  757|       |
  758|      1|    unscaled->face = face;
  759|       |
  760|      1|    unscaled->have_color = FT_HAS_COLOR (face) != 0;
  ------------------
  |  | 1690|      1|          ( !!( (face)->face_flags & FT_FACE_FLAG_COLOR ) )
  |  |  ------------------
  |  |  |  | 1427|      1|#define FT_FACE_FLAG_COLOR             ( 1L << 14 )
  |  |  ------------------
  ------------------
  761|      1|    unscaled->have_color_set = TRUE;
  ------------------
  |  |  106|      1|#define TRUE 1
  ------------------
  762|       |
  763|      1|    font_map->num_open_faces++;
  764|       |
  765|      1|    return face;
  766|      1|}
cairo-ft-font.c:_cairo_ft_unscaled_font_set_scale:
  863|      1|{
  864|      1|    cairo_status_t status;
  865|      1|    cairo_ft_font_transform_t sf;
  866|      1|    FT_Matrix mat;
  867|      1|    FT_Error error;
  868|       |
  869|      1|    assert (unscaled->face != NULL);
  ------------------
  |  Branch (869:5): [True: 0, False: 1]
  |  Branch (869:5): [True: 1, False: 0]
  ------------------
  870|       |
  871|      1|    if (unscaled->have_scale &&
  ------------------
  |  Branch (871:9): [True: 0, False: 1]
  ------------------
  872|      0|	scale->xx == unscaled->current_scale.xx &&
  ------------------
  |  Branch (872:2): [True: 0, False: 0]
  ------------------
  873|      0|	scale->yx == unscaled->current_scale.yx &&
  ------------------
  |  Branch (873:2): [True: 0, False: 0]
  ------------------
  874|      0|	scale->xy == unscaled->current_scale.xy &&
  ------------------
  |  Branch (874:2): [True: 0, False: 0]
  ------------------
  875|      0|	scale->yy == unscaled->current_scale.yy)
  ------------------
  |  Branch (875:2): [True: 0, False: 0]
  ------------------
  876|      0|	return CAIRO_STATUS_SUCCESS;
  877|       |
  878|      1|    unscaled->have_scale = TRUE;
  ------------------
  |  |  106|      1|#define TRUE 1
  ------------------
  879|      1|    unscaled->current_scale = *scale;
  880|       |
  881|      1|    status = _compute_transform (&sf, scale, unscaled);
  882|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  883|      0|	return status;
  884|       |
  885|      1|    unscaled->x_scale = sf.x_scale;
  886|      1|    unscaled->y_scale = sf.y_scale;
  887|       |
  888|      1|    mat.xx = DOUBLE_TO_16_16(sf.shape[0][0]);
  ------------------
  |  |   84|      1|#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
  ------------------
  889|      1|    mat.yx = - DOUBLE_TO_16_16(sf.shape[0][1]);
  ------------------
  |  |   84|      1|#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
  ------------------
  890|      1|    mat.xy = - DOUBLE_TO_16_16(sf.shape[1][0]);
  ------------------
  |  |   84|      1|#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
  ------------------
  891|      1|    mat.yy = DOUBLE_TO_16_16(sf.shape[1][1]);
  ------------------
  |  |   84|      1|#define DOUBLE_TO_16_16(d) ((FT_Fixed)((d) * 65536.0))
  ------------------
  892|       |
  893|      1|    unscaled->have_shape = (mat.xx != 0x10000 ||
  ------------------
  |  Branch (893:29): [True: 0, False: 1]
  ------------------
  894|      1|			    mat.yx != 0x00000 ||
  ------------------
  |  Branch (894:8): [True: 0, False: 1]
  ------------------
  895|      1|			    mat.xy != 0x00000 ||
  ------------------
  |  Branch (895:8): [True: 0, False: 1]
  ------------------
  896|      1|			    mat.yy != 0x10000);
  ------------------
  |  Branch (896:8): [True: 0, False: 1]
  ------------------
  897|       |
  898|      1|    unscaled->Current_Shape = mat;
  899|      1|    cairo_matrix_init (&unscaled->current_shape,
  900|      1|		       sf.shape[0][0], sf.shape[0][1],
  901|      1|		       sf.shape[1][0], sf.shape[1][1],
  902|      1|		       0.0, 0.0);
  903|       |
  904|      1|    FT_Set_Transform(unscaled->face, &mat, NULL);
  905|       |
  906|      1|    error = FT_Set_Char_Size (unscaled->face,
  907|      1|			      sf.x_scale * 64.0 + .5,
  908|      1|			      sf.y_scale * 64.0 + .5,
  909|      1|			      0, 0);
  910|      1|    if (error)
  ------------------
  |  Branch (910:9): [True: 0, False: 1]
  ------------------
  911|      0|      return _cairo_error (_cairo_ft_to_cairo_error (error));
  912|       |
  913|      1|    return CAIRO_STATUS_SUCCESS;
  914|      1|}
cairo-ft-font.c:_cairo_ft_unscaled_font_unlock_face:
  773|      1|{
  774|      1|    assert (unscaled->lock_count > 0);
  ------------------
  |  Branch (774:5): [True: 0, False: 1]
  |  Branch (774:5): [True: 1, False: 0]
  ------------------
  775|       |
  776|      1|    unscaled->lock_count--;
  777|       |
  778|      1|    CAIRO_MUTEX_UNLOCK (unscaled->mutex);
  ------------------
  |  |  177|      1|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|      1|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  779|      1|}

_cairo_gstate_init:
   87|     84|{
   88|     84|    VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t)));
   89|       |
   90|     84|    gstate->next = NULL;
   91|       |
   92|     84|    gstate->op = CAIRO_GSTATE_OPERATOR_DEFAULT;
  ------------------
  |  |  722|     84|#define CAIRO_GSTATE_OPERATOR_DEFAULT	CAIRO_OPERATOR_OVER
  ------------------
   93|     84|    gstate->opacity = 1.;
   94|       |
   95|     84|    gstate->tolerance = CAIRO_GSTATE_TOLERANCE_DEFAULT;
  ------------------
  |  |  723|     84|#define CAIRO_GSTATE_TOLERANCE_DEFAULT	0.1
  ------------------
   96|     84|    gstate->antialias = CAIRO_ANTIALIAS_DEFAULT;
   97|       |
   98|     84|    _cairo_stroke_style_init (&gstate->stroke_style);
   99|       |
  100|     84|    gstate->fill_rule = CAIRO_GSTATE_FILL_RULE_DEFAULT;
  ------------------
  |  |  724|     84|#define CAIRO_GSTATE_FILL_RULE_DEFAULT	CAIRO_FILL_RULE_WINDING
  ------------------
  101|       |
  102|     84|    gstate->font_face = NULL;
  103|     84|    gstate->scaled_font = NULL;
  104|     84|    gstate->previous_scaled_font = NULL;
  105|       |
  106|     84|    cairo_matrix_init_scale (&gstate->font_matrix,
  107|     84|			     CAIRO_GSTATE_DEFAULT_FONT_SIZE,
  ------------------
  |  |  729|     84|#define CAIRO_GSTATE_DEFAULT_FONT_SIZE  10.0
  ------------------
  108|     84|			     CAIRO_GSTATE_DEFAULT_FONT_SIZE);
  ------------------
  |  |  729|     84|#define CAIRO_GSTATE_DEFAULT_FONT_SIZE  10.0
  ------------------
  109|       |
  110|     84|    _cairo_font_options_init_default (&gstate->font_options);
  111|       |
  112|     84|    gstate->clip = NULL;
  113|       |
  114|     84|    gstate->target = cairo_surface_reference (target);
  115|     84|    gstate->parent_target = NULL;
  116|     84|    gstate->original_target = cairo_surface_reference (target);
  117|       |
  118|     84|    gstate->device_transform_observer.callback = _cairo_gstate_update_device_transform;
  119|     84|    cairo_list_add (&gstate->device_transform_observer.link,
  120|     84|		    &gstate->target->device_transform_observers);
  121|       |
  122|     84|    gstate->is_identity = _cairo_matrix_is_identity (&gstate->target->device_transform);
  123|     84|    cairo_matrix_init_identity (&gstate->ctm);
  124|     84|    gstate->ctm_inverse = gstate->ctm;
  125|     84|    gstate->source_ctm_inverse = gstate->ctm;
  126|       |
  127|     84|    gstate->source = (cairo_pattern_t *) &_cairo_pattern_black.base;
  128|       |
  129|       |    /* Now that the gstate is fully initialized and ready for the eventual
  130|       |     * _cairo_gstate_fini(), we can check for errors (and not worry about
  131|       |     * the resource deallocation). */
  132|     84|    return target->status;
  133|     84|}
_cairo_gstate_fini:
  195|     84|{
  196|     84|    _cairo_stroke_style_fini (&gstate->stroke_style);
  197|     84|    _cairo_font_options_fini (&gstate->font_options);
  198|       |
  199|     84|    cairo_font_face_destroy (gstate->font_face);
  200|     84|    gstate->font_face = NULL;
  201|       |
  202|     84|    cairo_scaled_font_destroy (gstate->previous_scaled_font);
  203|     84|    gstate->previous_scaled_font = NULL;
  204|       |
  205|     84|    cairo_scaled_font_destroy (gstate->scaled_font);
  206|     84|    gstate->scaled_font = NULL;
  207|       |
  208|     84|    _cairo_clip_destroy (gstate->clip);
  209|       |
  210|     84|    cairo_list_del (&gstate->device_transform_observer.link);
  211|       |
  212|     84|    cairo_surface_destroy (gstate->target);
  213|     84|    gstate->target = NULL;
  214|       |
  215|     84|    cairo_surface_destroy (gstate->parent_target);
  216|     84|    gstate->parent_target = NULL;
  217|       |
  218|     84|    cairo_surface_destroy (gstate->original_target);
  219|     84|    gstate->original_target = NULL;
  220|       |
  221|     84|    cairo_pattern_destroy (gstate->source);
  222|     84|    gstate->source = NULL;
  223|       |
  224|     84|    VG (VALGRIND_MAKE_MEM_UNDEFINED (gstate, sizeof (cairo_gstate_t)));
  225|     84|}
_cairo_gstate_get_scaled_font:
 1788|     84|{
 1789|     84|    cairo_status_t status;
 1790|       |
 1791|     84|    status = _cairo_gstate_ensure_scaled_font (gstate);
 1792|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1793|      0|	return status;
 1794|       |
 1795|     84|    *scaled_font = gstate->scaled_font;
 1796|       |
 1797|     84|    return CAIRO_STATUS_SUCCESS;
 1798|     84|}
cairo-gstate.c:_cairo_gstate_ensure_font_face:
 1879|     84|{
 1880|     84|    cairo_font_face_t *font_face;
 1881|       |
 1882|     84|    if (gstate->font_face != NULL)
  ------------------
  |  Branch (1882:9): [True: 0, False: 84]
  ------------------
 1883|      0|	return gstate->font_face->status;
 1884|       |
 1885|       |
 1886|     84|    font_face = cairo_toy_font_face_create (CAIRO_FONT_FAMILY_DEFAULT,
  ------------------
  |  |  712|     84|#define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT
  |  |  ------------------
  |  |  |  |  692|     84|#define CAIRO_FT_FONT_FAMILY_DEFAULT     ""
  |  |  ------------------
  ------------------
 1887|     84|					    CAIRO_FONT_SLANT_DEFAULT,
  ------------------
  |  |  686|     84|#define CAIRO_FONT_SLANT_DEFAULT   CAIRO_FONT_SLANT_NORMAL
  ------------------
 1888|     84|					    CAIRO_FONT_WEIGHT_DEFAULT);
  ------------------
  |  |  687|     84|#define CAIRO_FONT_WEIGHT_DEFAULT  CAIRO_FONT_WEIGHT_NORMAL
  ------------------
 1889|     84|    if (font_face->status)
  ------------------
  |  Branch (1889:9): [True: 0, False: 84]
  ------------------
 1890|      0|	return font_face->status;
 1891|       |
 1892|     84|    gstate->font_face = font_face;
 1893|       |
 1894|     84|    return CAIRO_STATUS_SUCCESS;
 1895|     84|}
cairo-gstate.c:_cairo_gstate_ensure_scaled_font:
 1899|     84|{
 1900|     84|    cairo_status_t status;
 1901|     84|    cairo_font_options_t options;
 1902|     84|    cairo_scaled_font_t *scaled_font;
 1903|     84|    cairo_matrix_t font_ctm;
 1904|       |
 1905|     84|    if (gstate->scaled_font != NULL)
  ------------------
  |  Branch (1905:9): [True: 0, False: 84]
  ------------------
 1906|      0|	return gstate->scaled_font->status;
 1907|       |
 1908|     84|    status = _cairo_gstate_ensure_font_face (gstate);
 1909|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1910|      0|	return status;
 1911|       |
 1912|     84|    cairo_surface_get_font_options (gstate->target, &options);
 1913|     84|    cairo_font_options_merge (&options, &gstate->font_options);
 1914|       |
 1915|     84|    cairo_matrix_multiply (&font_ctm,
 1916|     84|			   &gstate->ctm,
 1917|     84|			   &gstate->target->device_transform);
 1918|       |
 1919|     84|    scaled_font = cairo_scaled_font_create (gstate->font_face,
 1920|     84|				            &gstate->font_matrix,
 1921|     84|					    &font_ctm,
 1922|     84|					    &options);
 1923|       |
 1924|     84|    _cairo_font_options_fini (&options);
 1925|       |
 1926|     84|    status = cairo_scaled_font_status (scaled_font);
 1927|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1928|      0|	return status;
 1929|       |
 1930|     84|    gstate->scaled_font = scaled_font;
 1931|       |
 1932|     84|    return CAIRO_STATUS_SUCCESS;
 1933|     84|}

_cairo_hash_table_create:
  164|      5|{
  165|      5|    cairo_hash_table_t *hash_table;
  166|       |
  167|      5|    hash_table = _cairo_calloc (sizeof (cairo_hash_table_t));
  ------------------
  |  |   79|      5|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 5, Folded]
  |  |  ------------------
  ------------------
  168|      5|    if (unlikely (hash_table == NULL)) {
  ------------------
  |  |  145|      5|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  169|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  170|      0|	return NULL;
  171|      0|    }
  172|       |
  173|      5|    if (keys_equal == NULL)
  ------------------
  |  Branch (173:9): [True: 1, False: 4]
  ------------------
  174|      1|	hash_table->keys_equal = _cairo_hash_table_uid_keys_equal;
  175|      4|    else
  176|      4|	hash_table->keys_equal = keys_equal;
  177|       |
  178|      5|    memset (&hash_table->cache, 0, sizeof (hash_table->cache));
  179|      5|    hash_table->table_size = &hash_table_sizes[0];
  180|       |
  181|      5|    hash_table->entries = _cairo_calloc_ab (*hash_table->table_size,
  182|      5|				  sizeof (cairo_hash_entry_t *));
  183|      5|    if (unlikely (hash_table->entries == NULL)) {
  ------------------
  |  |  145|      5|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  184|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  185|      0|	free (hash_table);
  186|      0|	return NULL;
  187|      0|    }
  188|       |
  189|      5|    hash_table->live_entries = 0;
  190|      5|    hash_table->free_entries = *hash_table->table_size;
  191|      5|    hash_table->iterating = 0;
  192|       |
  193|      5|    return hash_table;
  194|      5|}
_cairo_hash_table_lookup:
  340|    170|{
  341|    170|    cairo_hash_entry_t *entry;
  342|    170|    unsigned long table_size, i, idx, step;
  343|    170|    uintptr_t hash = key->hash;
  344|       |
  345|    170|    entry = hash_table->cache[hash & 31];
  346|    170|    if (entry && entry->hash == hash && hash_table->keys_equal (key, entry))
  ------------------
  |  Branch (346:9): [True: 166, False: 4]
  |  Branch (346:18): [True: 166, False: 0]
  |  Branch (346:41): [True: 166, False: 0]
  ------------------
  347|    166|	return entry;
  348|       |
  349|      4|    table_size = *hash_table->table_size;
  350|      4|    idx = hash % table_size;
  351|       |
  352|      4|    entry = hash_table->entries[idx];
  353|      4|    if (ENTRY_IS_LIVE (entry)) {
  ------------------
  |  |   60|      4|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      4|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  |  |  |  Branch (60:30): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  354|      0|	if (entry->hash == hash && hash_table->keys_equal (key, entry))
  ------------------
  |  Branch (354:6): [True: 0, False: 0]
  |  Branch (354:29): [True: 0, False: 0]
  ------------------
  355|      0|		goto insert_cache;
  356|      4|    } else if (ENTRY_IS_FREE (entry))
  ------------------
  |  |   58|      4|#define ENTRY_IS_FREE(entry) ((entry) == NULL)
  |  |  ------------------
  |  |  |  Branch (58:30): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  357|      4|	return NULL;
  358|       |
  359|      0|    i = 1;
  360|      0|    step = 1 + hash % (table_size - 2);
  361|      0|    do {
  362|      0|	idx += step;
  363|      0|	if (idx >= table_size)
  ------------------
  |  Branch (363:6): [True: 0, False: 0]
  ------------------
  364|      0|	    idx -= table_size;
  365|       |
  366|      0|	entry = hash_table->entries[idx];
  367|      0|	if (ENTRY_IS_LIVE (entry)) {
  ------------------
  |  |   60|      0|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      0|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  |  |  |  Branch (60:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  368|      0|	    if (entry->hash == hash && hash_table->keys_equal (key, entry))
  ------------------
  |  Branch (368:10): [True: 0, False: 0]
  |  Branch (368:33): [True: 0, False: 0]
  ------------------
  369|      0|		    goto insert_cache;
  370|      0|	} else if (ENTRY_IS_FREE (entry))
  ------------------
  |  |   58|      0|#define ENTRY_IS_FREE(entry) ((entry) == NULL)
  |  |  ------------------
  |  |  |  Branch (58:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  371|      0|	    return NULL;
  372|      0|    } while (++i < table_size);
  ------------------
  |  Branch (372:14): [True: 0, False: 0]
  ------------------
  373|       |
  374|      0|    ASSERT_NOT_REACHED;
  ------------------
  |  |  140|      0|#define ASSERT_NOT_REACHED		\
  |  |  141|      0|do {					\
  |  |  142|      0|    assert (!"reached");		\
  |  |  143|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (143:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (374:5): [Folded, False: 0]
  |  Branch (374:5): [Folded, False: 0]
  ------------------
  375|      0|    return NULL;
  376|       |
  377|      0|insert_cache:
  378|      0|    hash_table->cache[hash & 31] = entry;
  379|      0|    return entry;
  380|      0|}
_cairo_hash_table_insert:
  457|      4|{
  458|      4|    cairo_hash_entry_t **entry;
  459|      4|    cairo_status_t status;
  460|       |
  461|       |    /* Insert is illegal while an iterator is running. */
  462|      4|    assert (hash_table->iterating == 0);
  ------------------
  |  Branch (462:5): [True: 0, False: 4]
  |  Branch (462:5): [True: 4, False: 0]
  ------------------
  463|       |
  464|      4|    status = _cairo_hash_table_manage (hash_table);
  465|      4|    if (unlikely (status))
  ------------------
  |  |  145|      4|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 4]
  |  |  ------------------
  ------------------
  466|      0|	return status;
  467|       |
  468|      4|    entry = _cairo_hash_table_lookup_unique_key (hash_table, key_and_value);
  469|       |
  470|      4|    if (ENTRY_IS_FREE (*entry))
  ------------------
  |  |   58|      4|#define ENTRY_IS_FREE(entry) ((entry) == NULL)
  |  |  ------------------
  |  |  |  Branch (58:30): [True: 4, False: 0]
  |  |  ------------------
  ------------------
  471|      4|	hash_table->free_entries--;
  472|       |
  473|      4|    *entry = key_and_value;
  474|      4|    hash_table->cache[key_and_value->hash & 31] = key_and_value;
  475|      4|    hash_table->live_entries++;
  476|       |
  477|      4|    return CAIRO_STATUS_SUCCESS;
  478|      4|}
cairo-hash.c:_cairo_hash_table_manage:
  269|      4|{
  270|      4|    cairo_hash_table_t tmp;
  271|      4|    unsigned long new_size, i;
  272|       |
  273|       |    /* Keep between 12.5% and 50% entries in the hash table alive and
  274|       |     * at least 25% free. */
  275|      4|    unsigned long live_high = *hash_table->table_size >> 1;
  276|      4|    unsigned long live_low = live_high >> 2;
  277|      4|    unsigned long free_low = live_high >> 1;
  278|       |
  279|      4|    tmp = *hash_table;
  280|       |
  281|      4|    if (hash_table->live_entries > live_high)
  ------------------
  |  Branch (281:9): [True: 0, False: 4]
  ------------------
  282|      0|    {
  283|      0|	tmp.table_size = hash_table->table_size + 1;
  284|       |	/* This code is being abused if we can't make a table big enough. */
  285|      0|	assert (tmp.table_size - hash_table_sizes <
  ------------------
  |  Branch (285:2): [True: 0, False: 0]
  |  Branch (285:2): [True: 0, False: 0]
  ------------------
  286|      0|		ARRAY_LENGTH (hash_table_sizes));
  287|      0|    }
  288|      4|    else if (hash_table->live_entries < live_low)
  ------------------
  |  Branch (288:14): [True: 4, False: 0]
  ------------------
  289|      4|    {
  290|       |	/* Can't shrink if we're at the smallest size */
  291|      4|	if (hash_table->table_size == &hash_table_sizes[0])
  ------------------
  |  Branch (291:6): [True: 4, False: 0]
  ------------------
  292|      4|	    tmp.table_size = hash_table->table_size;
  293|      0|	else
  294|      0|	    tmp.table_size = hash_table->table_size - 1;
  295|      4|    }
  296|       |
  297|      4|    if (tmp.table_size == hash_table->table_size &&
  ------------------
  |  Branch (297:9): [True: 4, False: 0]
  ------------------
  298|      4|	hash_table->free_entries > free_low)
  ------------------
  |  Branch (298:2): [True: 4, False: 0]
  ------------------
  299|      4|    {
  300|       |	/* The number of live entries is within the desired bounds
  301|       |	 * (we're not going to resize the table) and we have enough
  302|       |	 * free entries. Do nothing. */
  303|      4|	return CAIRO_STATUS_SUCCESS;
  304|      4|    }
  305|       |
  306|      0|    new_size = *tmp.table_size;
  307|      0|    tmp.entries = _cairo_calloc_ab (new_size, sizeof (cairo_hash_entry_t*));
  308|      0|    if (unlikely (tmp.entries == NULL))
  ------------------
  |  |  145|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  309|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  310|       |
  311|      0|    for (i = 0; i < *hash_table->table_size; ++i) {
  ------------------
  |  Branch (311:17): [True: 0, False: 0]
  ------------------
  312|      0|	if (ENTRY_IS_LIVE (hash_table->entries[i])) {
  ------------------
  |  |   60|      0|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      0|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  |  |  |  Branch (60:30): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  313|      0|	    *_cairo_hash_table_lookup_unique_key (&tmp, hash_table->entries[i])
  314|      0|		= hash_table->entries[i];
  315|      0|	}
  316|      0|    }
  317|       |
  318|      0|    free (hash_table->entries);
  319|      0|    hash_table->entries = tmp.entries;
  320|      0|    hash_table->table_size = tmp.table_size;
  321|      0|    hash_table->free_entries = new_size - hash_table->live_entries;
  322|       |
  323|      0|    return CAIRO_STATUS_SUCCESS;
  324|      0|}
cairo-hash.c:_cairo_hash_table_lookup_unique_key:
  228|      4|{
  229|      4|    unsigned long table_size, i, idx, step;
  230|      4|    cairo_hash_entry_t **entry;
  231|       |
  232|      4|    table_size = *hash_table->table_size;
  233|      4|    idx = key->hash % table_size;
  234|       |
  235|      4|    entry = &hash_table->entries[idx];
  236|      4|    if (! ENTRY_IS_LIVE (*entry))
  ------------------
  |  |   60|      4|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      4|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  ------------------
  |  Branch (236:9): [True: 4, False: 0]
  ------------------
  237|      4|	return entry;
  238|       |
  239|      0|    i = 1;
  240|      0|    step = 1 + key->hash % (table_size - 2);
  241|      0|    do {
  242|      0|	idx += step;
  243|      0|	if (idx >= table_size)
  ------------------
  |  Branch (243:6): [True: 0, False: 0]
  ------------------
  244|      0|	    idx -= table_size;
  245|       |
  246|      0|	entry = &hash_table->entries[idx];
  247|      0|	if (! ENTRY_IS_LIVE (*entry))
  ------------------
  |  |   60|      0|#define ENTRY_IS_LIVE(entry) ((entry) >  DEAD_ENTRY)
  |  |  ------------------
  |  |  |  |   56|      0|#define DEAD_ENTRY ((cairo_hash_entry_t *) 0x1)
  |  |  ------------------
  ------------------
  |  Branch (247:6): [True: 0, False: 0]
  ------------------
  248|      0|	    return entry;
  249|      0|    } while (++i < table_size);
  ------------------
  |  Branch (249:14): [True: 0, False: 0]
  ------------------
  250|       |
  251|      0|    ASSERT_NOT_REACHED;
  ------------------
  |  |  140|      0|#define ASSERT_NOT_REACHED		\
  |  |  141|      0|do {					\
  |  |  142|      0|    assert (!"reached");		\
  |  |  143|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (143:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (251:5): [Folded, False: 0]
  |  Branch (251:5): [Folded, False: 0]
  ------------------
  252|      0|    return NULL;
  253|      0|}

_cairo_image_traps_compositor_get:
 1275|      1|{
 1276|      1|    static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT;
  ------------------
  |  |  537|      1|#define CAIRO_ATOMIC_ONCE_INIT          CAIRO_ATOMIC_ONCE_UNINITIALIZED
  |  |  ------------------
  |  |  |  |  534|      1|#define CAIRO_ATOMIC_ONCE_UNINITIALIZED (0)
  |  |  ------------------
  ------------------
 1277|      1|    static cairo_traps_compositor_t compositor;
 1278|       |
 1279|      1|    if (_cairo_atomic_init_once_enter(&once)) {
  ------------------
  |  Branch (1279:9): [True: 1, False: 0]
  ------------------
 1280|      1|	_cairo_traps_compositor_init(&compositor,
 1281|      1|				     &__cairo_no_compositor);
 1282|      1|	compositor.acquire = acquire;
 1283|      1|	compositor.release = release;
 1284|      1|	compositor.set_clip_region = set_clip_region;
 1285|      1|	compositor.pattern_to_surface = _cairo_image_source_create_for_pattern;
 1286|      1|	compositor.draw_image_boxes = draw_image_boxes;
 1287|       |	//compositor.copy_boxes = copy_boxes;
 1288|      1|	compositor.fill_boxes = fill_boxes;
 1289|      1|	compositor.check_composite = check_composite;
 1290|      1|	compositor.composite = composite;
 1291|      1|	compositor.lerp = lerp;
 1292|       |	//compositor.check_composite_boxes = check_composite_boxes;
 1293|      1|	compositor.composite_boxes = composite_boxes;
 1294|       |	//compositor.check_composite_traps = check_composite_traps;
 1295|      1|	compositor.composite_traps = composite_traps;
 1296|       |	//compositor.check_composite_tristrip = check_composite_traps;
 1297|      1|	compositor.composite_tristrip = composite_tristrip;
 1298|      1|	compositor.check_composite_glyphs = check_composite_glyphs;
 1299|      1|	compositor.composite_glyphs = composite_glyphs;
 1300|       |
 1301|      1|	_cairo_atomic_init_once_leave(&once);
 1302|      1|    }
 1303|       |
 1304|      1|    return &compositor.base;
 1305|      1|}
_cairo_image_spans_compositor_get:
 3144|     84|{
 3145|     84|    static cairo_atomic_once_t once = CAIRO_ATOMIC_ONCE_INIT;
  ------------------
  |  |  537|     84|#define CAIRO_ATOMIC_ONCE_INIT          CAIRO_ATOMIC_ONCE_UNINITIALIZED
  |  |  ------------------
  |  |  |  |  534|     84|#define CAIRO_ATOMIC_ONCE_UNINITIALIZED (0)
  |  |  ------------------
  ------------------
 3146|     84|    static cairo_spans_compositor_t spans;
 3147|     84|    static cairo_compositor_t shape;
 3148|       |
 3149|     84|    if (_cairo_atomic_init_once_enter(&once)) {
  ------------------
  |  Branch (3149:9): [True: 1, False: 83]
  ------------------
 3150|      1|	_cairo_shape_mask_compositor_init (&shape,
 3151|      1|					   _cairo_image_traps_compositor_get());
 3152|      1|	shape.glyphs = NULL;
 3153|       |
 3154|      1|	_cairo_spans_compositor_init (&spans, &shape);
 3155|       |
 3156|      1|	spans.flags = 0;
 3157|       |#if PIXMAN_HAS_OP_LERP
 3158|       |	spans.flags |= CAIRO_SPANS_COMPOSITOR_HAS_LERP;
 3159|       |#endif
 3160|       |
 3161|       |	//spans.acquire = acquire;
 3162|       |	//spans.release = release;
 3163|      1|	spans.fill_boxes = fill_boxes;
 3164|      1|	spans.draw_image_boxes = draw_image_boxes;
 3165|       |	//spans.copy_boxes = copy_boxes;
 3166|      1|	spans.pattern_to_surface = _cairo_image_source_create_for_pattern;
 3167|       |	//spans.check_composite_boxes = check_composite_boxes;
 3168|      1|	spans.composite_boxes = composite_boxes;
 3169|       |	//spans.check_span_renderer = check_span_renderer;
 3170|      1|	spans.renderer_init = span_renderer_init;
 3171|      1|	spans.renderer_fini = span_renderer_fini;
 3172|       |
 3173|      1|	_cairo_atomic_init_once_leave(&once);
 3174|      1|    }
 3175|       |
 3176|     84|    return &spans.base;
 3177|     84|}

_cairo_format_from_pixman_format:
   94|     84|{
   95|     84|    switch (pixman_format) {
   96|     12|    case PIXMAN_rgba_float:
  ------------------
  |  Branch (96:5): [True: 12, False: 72]
  ------------------
   97|     12|	return CAIRO_FORMAT_RGBA128F;
   98|     22|    case PIXMAN_rgb_float:
  ------------------
  |  Branch (98:5): [True: 22, False: 62]
  ------------------
   99|     22|	return CAIRO_FORMAT_RGB96F;
  100|     10|    case PIXMAN_a8r8g8b8:
  ------------------
  |  Branch (100:5): [True: 10, False: 74]
  ------------------
  101|     10|	return CAIRO_FORMAT_ARGB32;
  102|      0|    case PIXMAN_x2r10g10b10:
  ------------------
  |  Branch (102:5): [True: 0, False: 84]
  ------------------
  103|      0|	return CAIRO_FORMAT_RGB30;
  104|     40|    case PIXMAN_x8r8g8b8:
  ------------------
  |  Branch (104:5): [True: 40, False: 44]
  ------------------
  105|     40|	return CAIRO_FORMAT_RGB24;
  106|      0|    case PIXMAN_a8:
  ------------------
  |  Branch (106:5): [True: 0, False: 84]
  ------------------
  107|      0|	return CAIRO_FORMAT_A8;
  108|      0|    case PIXMAN_a1:
  ------------------
  |  Branch (108:5): [True: 0, False: 84]
  ------------------
  109|      0|	return CAIRO_FORMAT_A1;
  110|      0|    case PIXMAN_r5g6b5:
  ------------------
  |  Branch (110:5): [True: 0, False: 84]
  ------------------
  111|      0|	return CAIRO_FORMAT_RGB16_565;
  112|      0|    case PIXMAN_r8g8b8a8: case PIXMAN_r8g8b8x8:
  ------------------
  |  Branch (112:5): [True: 0, False: 84]
  |  Branch (112:27): [True: 0, False: 84]
  ------------------
  113|      0|    case PIXMAN_a8r8g8b8_sRGB:
  ------------------
  |  Branch (113:5): [True: 0, False: 84]
  ------------------
  114|      0|#if HAS_PIXMAN_r8g8b8_sRGB
  115|      0|    case PIXMAN_r8g8b8_sRGB:
  ------------------
  |  Branch (115:5): [True: 0, False: 84]
  ------------------
  116|      0|#endif
  117|      0|    case PIXMAN_a8b8g8r8: case PIXMAN_x8b8g8r8: case PIXMAN_r8g8b8:
  ------------------
  |  Branch (117:5): [True: 0, False: 84]
  |  Branch (117:27): [True: 0, False: 84]
  |  Branch (117:49): [True: 0, False: 84]
  ------------------
  118|      0|    case PIXMAN_b8g8r8:   case PIXMAN_b5g6r5:
  ------------------
  |  Branch (118:5): [True: 0, False: 84]
  |  Branch (118:27): [True: 0, False: 84]
  ------------------
  119|      0|    case PIXMAN_a1r5g5b5: case PIXMAN_x1r5g5b5: case PIXMAN_a1b5g5r5:
  ------------------
  |  Branch (119:5): [True: 0, False: 84]
  |  Branch (119:27): [True: 0, False: 84]
  |  Branch (119:49): [True: 0, False: 84]
  ------------------
  120|      0|    case PIXMAN_x1b5g5r5: case PIXMAN_a4r4g4b4: case PIXMAN_x4r4g4b4:
  ------------------
  |  Branch (120:5): [True: 0, False: 84]
  |  Branch (120:27): [True: 0, False: 84]
  |  Branch (120:49): [True: 0, False: 84]
  ------------------
  121|      0|    case PIXMAN_a4b4g4r4: case PIXMAN_x4b4g4r4: case PIXMAN_r3g3b2:
  ------------------
  |  Branch (121:5): [True: 0, False: 84]
  |  Branch (121:27): [True: 0, False: 84]
  |  Branch (121:49): [True: 0, False: 84]
  ------------------
  122|      0|    case PIXMAN_b2g3r3:   case PIXMAN_a2r2g2b2: case PIXMAN_a2b2g2r2:
  ------------------
  |  Branch (122:5): [True: 0, False: 84]
  |  Branch (122:27): [True: 0, False: 84]
  |  Branch (122:49): [True: 0, False: 84]
  ------------------
  123|      0|    case PIXMAN_c8:       case PIXMAN_g8:       case PIXMAN_x4a4:
  ------------------
  |  Branch (123:5): [True: 0, False: 84]
  |  Branch (123:27): [True: 0, False: 84]
  |  Branch (123:49): [True: 0, False: 84]
  ------------------
  124|      0|    case PIXMAN_a4:       case PIXMAN_r1g2b1:   case PIXMAN_b1g2r1:
  ------------------
  |  Branch (124:5): [True: 0, False: 84]
  |  Branch (124:27): [True: 0, False: 84]
  |  Branch (124:49): [True: 0, False: 84]
  ------------------
  125|      0|    case PIXMAN_a1r1g1b1: case PIXMAN_a1b1g1r1: case PIXMAN_c4:
  ------------------
  |  Branch (125:5): [True: 0, False: 84]
  |  Branch (125:27): [True: 0, False: 84]
  |  Branch (125:49): [True: 0, False: 84]
  ------------------
  126|      0|    case PIXMAN_g4:       case PIXMAN_g1:
  ------------------
  |  Branch (126:5): [True: 0, False: 84]
  |  Branch (126:27): [True: 0, False: 84]
  ------------------
  127|      0|    case PIXMAN_yuy2:     case PIXMAN_yv12:
  ------------------
  |  Branch (127:5): [True: 0, False: 84]
  |  Branch (127:27): [True: 0, False: 84]
  ------------------
  128|      0|    case PIXMAN_b8g8r8x8:
  ------------------
  |  Branch (128:5): [True: 0, False: 84]
  ------------------
  129|      0|    case PIXMAN_b8g8r8a8:
  ------------------
  |  Branch (129:5): [True: 0, False: 84]
  ------------------
  130|      0|    case PIXMAN_a2b10g10r10:
  ------------------
  |  Branch (130:5): [True: 0, False: 84]
  ------------------
  131|      0|    case PIXMAN_x2b10g10r10:
  ------------------
  |  Branch (131:5): [True: 0, False: 84]
  ------------------
  132|      0|    case PIXMAN_a2r10g10b10:
  ------------------
  |  Branch (132:5): [True: 0, False: 84]
  ------------------
  133|      0|    case PIXMAN_x14r6g6b6:
  ------------------
  |  Branch (133:5): [True: 0, False: 84]
  ------------------
  134|      0|    default:
  ------------------
  |  Branch (134:5): [True: 0, False: 84]
  ------------------
  135|      0|	return CAIRO_FORMAT_INVALID;
  136|     84|    }
  137|       |
  138|      0|    return CAIRO_FORMAT_INVALID;
  139|     84|}
_cairo_content_from_pixman_format:
  143|     84|{
  144|     84|    cairo_content_t content;
  145|       |
  146|     84|    content = 0;
  147|     84|    if (PIXMAN_FORMAT_RGB (pixman_format))
  ------------------
  |  |  850|     84|#define PIXMAN_FORMAT_RGB(f)	(((f)      ) & 0xfff)
  |  |  ------------------
  |  |  |  Branch (850:30): [True: 84, False: 0]
  |  |  ------------------
  ------------------
  148|     84|	content |= CAIRO_CONTENT_COLOR;
  149|     84|    if (PIXMAN_FORMAT_A (pixman_format))
  ------------------
  |  |  846|     84|#define PIXMAN_FORMAT_A(f)	PIXMAN_FORMAT_RESHIFT(f, 12, 4)
  |  |  ------------------
  |  |  |  |  841|     84|	(((val >> (ofs)) & ((1 << (num)) - 1)) << ((val >> 22) & 3))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (841:2): [True: 22, False: 62]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  150|     22|	content |= CAIRO_CONTENT_ALPHA;
  151|       |
  152|     84|    return content;
  153|     84|}
_cairo_image_surface_init:
  159|     84|{
  160|     84|    surface->parent = NULL;
  161|     84|    surface->pixman_image = pixman_image;
  162|       |
  163|     84|    surface->pixman_format = pixman_format;
  164|     84|    surface->format = _cairo_format_from_pixman_format (pixman_format);
  165|     84|    surface->data = (uint8_t *) pixman_image_get_data (pixman_image);
  166|     84|    surface->owns_data = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
  167|     84|    surface->transparency = CAIRO_IMAGE_UNKNOWN;
  168|     84|    surface->color = CAIRO_IMAGE_UNKNOWN_COLOR;
  169|       |
  170|     84|    surface->width = pixman_image_get_width (pixman_image);
  171|     84|    surface->height = pixman_image_get_height (pixman_image);
  172|     84|    surface->stride = pixman_image_get_stride (pixman_image);
  173|     84|    surface->depth = pixman_image_get_depth (pixman_image);
  174|       |
  175|     84|    surface->base.is_clear = surface->width == 0 || surface->height == 0;
  ------------------
  |  Branch (175:30): [True: 0, False: 84]
  |  Branch (175:53): [True: 0, False: 84]
  ------------------
  176|       |
  177|     84|    surface->compositor = _cairo_image_spans_compositor_get ();
  178|     84|}
_cairo_image_surface_create_for_pixman_image:
  183|     84|{
  184|     84|    cairo_image_surface_t *surface;
  185|       |
  186|     84|    surface = _cairo_calloc (sizeof (cairo_image_surface_t));
  ------------------
  |  |   79|     84|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 84, Folded]
  |  |  ------------------
  ------------------
  187|     84|    if (unlikely (surface == NULL))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  188|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  189|       |
  190|     84|    _cairo_surface_init (&surface->base,
  191|     84|			 &_cairo_image_surface_backend,
  192|     84|			 NULL, /* device */
  193|     84|			 _cairo_content_from_pixman_format (pixman_format),
  194|     84|			 FALSE); /* is_vector */
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
  195|       |
  196|     84|    _cairo_image_surface_init (surface, pixman_image, pixman_format);
  197|       |
  198|     84|    return &surface->base;
  199|     84|}
_cairo_format_to_pixman_format_code:
  326|     84|{
  327|     84|    pixman_format_code_t ret;
  328|     84|    switch (format) {
  329|      0|    case CAIRO_FORMAT_A1:
  ------------------
  |  Branch (329:5): [True: 0, False: 84]
  ------------------
  330|      0|	ret = PIXMAN_a1;
  331|      0|	break;
  332|      0|    case CAIRO_FORMAT_A8:
  ------------------
  |  Branch (332:5): [True: 0, False: 84]
  ------------------
  333|      0|	ret = PIXMAN_a8;
  334|      0|	break;
  335|     40|    case CAIRO_FORMAT_RGB24:
  ------------------
  |  Branch (335:5): [True: 40, False: 44]
  ------------------
  336|     40|	ret = PIXMAN_x8r8g8b8;
  337|     40|	break;
  338|      0|    case CAIRO_FORMAT_RGB30:
  ------------------
  |  Branch (338:5): [True: 0, False: 84]
  ------------------
  339|      0|	ret = PIXMAN_x2r10g10b10;
  340|      0|	break;
  341|      0|    case CAIRO_FORMAT_RGB16_565:
  ------------------
  |  Branch (341:5): [True: 0, False: 84]
  ------------------
  342|      0|	ret = PIXMAN_r5g6b5;
  343|      0|	break;
  344|     22|    case CAIRO_FORMAT_RGB96F:
  ------------------
  |  Branch (344:5): [True: 22, False: 62]
  ------------------
  345|     22|	ret = PIXMAN_rgb_float;
  346|     22|	break;
  347|     12|    case CAIRO_FORMAT_RGBA128F:
  ------------------
  |  Branch (347:5): [True: 12, False: 72]
  ------------------
  348|     12|	ret = PIXMAN_rgba_float;
  349|     12|	break;
  350|     10|    case CAIRO_FORMAT_ARGB32:
  ------------------
  |  Branch (350:5): [True: 10, False: 74]
  ------------------
  351|     10|    case CAIRO_FORMAT_INVALID:
  ------------------
  |  Branch (351:5): [True: 0, False: 84]
  ------------------
  352|     10|    default:
  ------------------
  |  Branch (352:5): [True: 0, False: 84]
  ------------------
  353|     10|	ret = PIXMAN_a8r8g8b8;
  354|     10|	break;
  355|     84|    }
  356|     84|    return ret;
  357|     84|}
_cairo_image_surface_create_with_pixman_format:
  365|     84|{
  366|     84|    cairo_surface_t *surface;
  367|     84|    pixman_image_t *pixman_image;
  368|       |
  369|     84|    if (! _cairo_image_surface_is_size_valid (width, height))
  ------------------
  |  Branch (369:9): [True: 0, False: 84]
  ------------------
  370|      0|    {
  371|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
  372|      0|    }
  373|       |
  374|     84|    pixman_image = pixman_image_create_bits (pixman_format, width, height,
  375|     84|					     (uint32_t *) data, stride);
  376|       |
  377|     84|    if (unlikely (pixman_image == NULL))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  378|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  379|       |
  380|     84|    surface = _cairo_image_surface_create_for_pixman_image (pixman_image,
  381|     84|							    pixman_format);
  382|     84|    if (unlikely (surface->status)) {
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  383|      0|	pixman_image_unref (pixman_image);
  384|      0|	return surface;
  385|      0|    }
  386|       |
  387|       |    /* we can not make any assumptions about the initial state of user data */
  388|     84|    surface->is_clear = data == NULL;
  389|     84|    return surface;
  390|     84|}
cairo_format_stride_for_width:
  469|    292|{
  470|    292|    int bpp;
  471|       |
  472|    292|    if (! CAIRO_FORMAT_VALID (format)) {
  ------------------
  |  | 1556|    292|#define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 &&		\
  |  |  ------------------
  |  |  |  Branch (1556:37): [True: 292, False: 0]
  |  |  ------------------
  |  | 1557|    292|                                    (format) <= CAIRO_FORMAT_RGBA128F)
  |  |  ------------------
  |  |  |  Branch (1557:37): [True: 292, False: 0]
  |  |  ------------------
  ------------------
  473|      0|	_cairo_error_throw (CAIRO_STATUS_INVALID_FORMAT);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  474|      0|	return -1;
  475|      0|    }
  476|       |
  477|    292|    bpp = _cairo_format_bits_per_pixel (format);
  478|    292|    if ((unsigned) (width) >= (INT32_MAX - 7) / (unsigned) (bpp))
  ------------------
  |  Branch (478:9): [True: 0, False: 292]
  ------------------
  479|      0|	return -1;
  480|       |
  481|    292|    return CAIRO_STRIDE_FOR_WIDTH_BPP (width, bpp);
  ------------------
  |  | 1562|    292|   ((((bpp)*(w)+7)/8 + CAIRO_STRIDE_ALIGNMENT-1) & -CAIRO_STRIDE_ALIGNMENT)
  |  |  ------------------
  |  |  |  | 1560|    292|#define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
  |  |  ------------------
  |  |                  ((((bpp)*(w)+7)/8 + CAIRO_STRIDE_ALIGNMENT-1) & -CAIRO_STRIDE_ALIGNMENT)
  |  |  ------------------
  |  |  |  | 1560|    292|#define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
  |  |  ------------------
  ------------------
  482|    292|}
cairo_image_surface_create_for_data:
  535|     86|{
  536|     86|    pixman_format_code_t pixman_format;
  537|     86|    int minstride;
  538|       |
  539|     86|    if (! CAIRO_FORMAT_VALID (format))
  ------------------
  |  | 1556|     86|#define CAIRO_FORMAT_VALID(format) ((format) >= CAIRO_FORMAT_ARGB32 &&		\
  |  |  ------------------
  |  |  |  Branch (1556:37): [True: 86, False: 0]
  |  |  ------------------
  |  | 1557|     86|                                    (format) <= CAIRO_FORMAT_RGBA128F)
  |  |  ------------------
  |  |  |  Branch (1557:37): [True: 86, False: 0]
  |  |  ------------------
  ------------------
  540|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_FORMAT));
  541|       |
  542|     86|    if ((stride & (CAIRO_STRIDE_ALIGNMENT-1)) != 0)
  ------------------
  |  | 1560|     86|#define CAIRO_STRIDE_ALIGNMENT (sizeof (uint32_t))
  ------------------
  |  Branch (542:9): [True: 0, False: 86]
  ------------------
  543|      0|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  544|       |
  545|     86|    if (! _cairo_image_surface_is_size_valid (width, height))
  ------------------
  |  Branch (545:9): [True: 2, False: 84]
  ------------------
  546|      2|	return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_SIZE));
  547|       |
  548|     84|    minstride = cairo_format_stride_for_width (format, width);
  549|     84|    if (stride < 0) {
  ------------------
  |  Branch (549:9): [True: 0, False: 84]
  ------------------
  550|      0|	if (stride > -minstride) {
  ------------------
  |  Branch (550:6): [True: 0, False: 0]
  ------------------
  551|      0|	    return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  552|      0|	}
  553|     84|    } else {
  554|     84|	if (stride < minstride) {
  ------------------
  |  Branch (554:6): [True: 0, False: 84]
  ------------------
  555|      0|	    return _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  556|      0|	}
  557|     84|    }
  558|       |
  559|     84|    pixman_format = _cairo_format_to_pixman_format_code (format);
  560|     84|    return _cairo_image_surface_create_with_pixman_format (data,
  561|     84|							   pixman_format,
  562|     84|							   width, height,
  563|     84|							   stride);
  564|     84|}
_cairo_format_bits_per_pixel:
  736|    292|{
  737|    292|    switch (format) {
  738|     28|    case CAIRO_FORMAT_RGBA128F:
  ------------------
  |  Branch (738:5): [True: 28, False: 264]
  ------------------
  739|     28|	return 128;
  740|     50|    case CAIRO_FORMAT_RGB96F:
  ------------------
  |  Branch (740:5): [True: 50, False: 242]
  ------------------
  741|     50|	return 96;
  742|     78|    case CAIRO_FORMAT_ARGB32:
  ------------------
  |  Branch (742:5): [True: 78, False: 214]
  ------------------
  743|     78|    case CAIRO_FORMAT_RGB30:
  ------------------
  |  Branch (743:5): [True: 0, False: 292]
  ------------------
  744|    214|    case CAIRO_FORMAT_RGB24:
  ------------------
  |  Branch (744:5): [True: 136, False: 156]
  ------------------
  745|    214|	return 32;
  746|      0|    case CAIRO_FORMAT_RGB16_565:
  ------------------
  |  Branch (746:5): [True: 0, False: 292]
  ------------------
  747|      0|	return 16;
  748|      0|    case CAIRO_FORMAT_A8:
  ------------------
  |  Branch (748:5): [True: 0, False: 292]
  ------------------
  749|      0|	return 8;
  750|      0|    case CAIRO_FORMAT_A1:
  ------------------
  |  Branch (750:5): [True: 0, False: 292]
  ------------------
  751|      0|	return 1;
  752|      0|    case CAIRO_FORMAT_INVALID:
  ------------------
  |  Branch (752:5): [True: 0, False: 292]
  ------------------
  753|      0|    default:
  ------------------
  |  Branch (753:5): [True: 0, False: 292]
  ------------------
  754|      0|	ASSERT_NOT_REACHED;
  ------------------
  |  |  140|      0|#define ASSERT_NOT_REACHED		\
  |  |  141|      0|do {					\
  |  |  142|      0|    assert (!"reached");		\
  |  |  143|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (143:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (754:2): [Folded, False: 0]
  |  Branch (754:2): [Folded, False: 0]
  ------------------
  755|      0|	return 0;
  756|    292|    }
  757|    292|}
_cairo_image_surface_finish:
  865|     84|{
  866|     84|    cairo_image_surface_t *surface = abstract_surface;
  867|       |
  868|     84|    if (surface->pixman_image) {
  ------------------
  |  Branch (868:9): [True: 84, False: 0]
  ------------------
  869|     84|	pixman_image_unref (surface->pixman_image);
  870|     84|	surface->pixman_image = NULL;
  871|     84|    }
  872|       |
  873|     84|    if (surface->owns_data) {
  ------------------
  |  Branch (873:9): [True: 84, False: 0]
  ------------------
  874|     84|	free (surface->data);
  875|     84|	surface->data = NULL;
  876|     84|    }
  877|       |
  878|     84|    if (surface->parent) {
  ------------------
  |  Branch (878:9): [True: 0, False: 84]
  ------------------
  879|      0|	cairo_surface_t *parent = surface->parent;
  880|      0|	surface->parent = NULL;
  881|      0|	cairo_surface_destroy (parent);
  882|      0|    }
  883|       |
  884|     84|    return CAIRO_STATUS_SUCCESS;
  885|     84|}
_cairo_image_surface_assume_ownership_of_data:
  889|     84|{
  890|     84|    surface->owns_data = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
  891|     84|}
_cairo_image_surface_get_font_options:
 1041|     84|{
 1042|     84|    _cairo_font_options_init_default (options);
 1043|       |
 1044|     84|    cairo_font_options_set_hint_metrics (options, CAIRO_HINT_METRICS_ON);
 1045|     84|    _cairo_font_options_set_round_glyph_positions (options, CAIRO_ROUND_GLYPH_POS_ON);
 1046|     84|}
cairo-image-surface.c:_cairo_image_surface_is_size_valid:
   87|    170|{
   88|    170|    return 0 <= width  &&  width <= MAX_IMAGE_SIZE &&
  ------------------
  |  |   62|    340|#define MAX_IMAGE_SIZE 32767
  ------------------
  |  Branch (88:12): [True: 170, False: 0]
  |  Branch (88:28): [True: 168, False: 2]
  ------------------
   89|    168|	   0 <= height && height <= MAX_IMAGE_SIZE;
  ------------------
  |  |   62|    168|#define MAX_IMAGE_SIZE 32767
  ------------------
  |  Branch (89:5): [True: 168, False: 0]
  |  Branch (89:20): [True: 168, False: 0]
  ------------------
   90|    170|}

cairo-surface.c:cairo_list_init:
  187|    168|{
  188|    168|    entry->next = entry;
  189|    168|    entry->prev = entry;
  190|    168|}
cairo-surface.c:cairo_list_is_empty:
  345|    252|{
  346|    252|    cairo_list_validate (head);
  347|    252|    return head->next == head;
  348|    252|}
cairo-gstate.c:cairo_list_add:
  212|     84|{
  213|     84|    cairo_list_validate (head);
  214|     84|    cairo_list_validate_is_empty (entry);
  215|     84|    __cairo_list_add (entry, head, head->next);
  216|     84|    cairo_list_validate (head);
  217|     84|}
cairo-gstate.c:__cairo_list_add:
  196|     84|{
  197|     84|    next->prev = entry;
  198|     84|    entry->next = next;
  199|     84|    entry->prev = prev;
  200|     84|    prev->next = entry;
  201|     84|}
cairo-gstate.c:cairo_list_del:
  256|     84|{
  257|     84|    _cairo_list_del (entry);
  258|     84|    cairo_list_init (entry);
  259|     84|}
cairo-gstate.c:_cairo_list_del:
  244|     84|{
  245|     84|    __cairo_list_del (entry->prev, entry->next);
  246|     84|}
cairo-gstate.c:__cairo_list_del:
  237|     84|{
  238|     84|    next->prev = prev;
  239|     84|    prev->next = next;
  240|     84|}
cairo-gstate.c:cairo_list_init:
  187|     84|{
  188|     84|    entry->next = entry;
  189|     84|    entry->prev = entry;
  190|     84|}
cairo-path-fixed.c:cairo_list_init:
  187|     84|{
  188|     84|    entry->next = entry;
  189|     84|    entry->prev = entry;
  190|     84|}
cairo-scaled-font.c:cairo_list_init:
  187|      3|{
  188|      3|    entry->next = entry;
  189|      3|    entry->prev = entry;
  190|      3|}

cairo-png.c:_cairo_malloc_ab:
  100|    416|{
  101|    416|    size_t c;
  102|    416|    if (_cairo_mul_size_t_overflow (a, size, &c))
  ------------------
  |  |  223|    416|#define _cairo_mul_size_t_overflow(a, b, c)  __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c))
  |  |  ------------------
  |  |  |  Branch (223:46): [True: 0, False: 416]
  |  |  ------------------
  ------------------
  103|      0|	return NULL;
  104|       |
  105|    416|    return _cairo_malloc(c);
  ------------------
  |  |   63|    416|   ((size) != 0 ? malloc(size) : NULL)
  |  |  ------------------
  |  |  |  Branch (63:5): [True: 416, False: 0]
  |  |  ------------------
  ------------------
  106|    416|}
cairo-array.c:_cairo_realloc_ab:
  153|  1.85k|{
  154|  1.85k|    size_t c;
  155|  1.85k|    if (_cairo_mul_size_t_overflow (a, size, &c))
  ------------------
  |  |  223|  1.85k|#define _cairo_mul_size_t_overflow(a, b, c)  __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c))
  |  |  ------------------
  |  |  |  Branch (223:46): [True: 0, False: 1.85k]
  |  |  ------------------
  ------------------
  156|      0|	return NULL;
  157|       |
  158|  1.85k|    return realloc(ptr, c);
  159|  1.85k|}
cairo-hash.c:_cairo_calloc_ab:
  125|      5|{
  126|      5|    size_t c;
  127|      5|    if (_cairo_mul_size_t_overflow (a, size, &c))
  ------------------
  |  |  223|      5|#define _cairo_mul_size_t_overflow(a, b, c)  __builtin_mul_overflow((size_t)(a), (size_t)(b), (size_t*)(c))
  |  |  ------------------
  |  |  |  Branch (223:46): [True: 0, False: 5]
  |  |  ------------------
  ------------------
  128|      0|	return NULL;
  129|       |
  130|      5|    return _cairo_calloc(c);
  ------------------
  |  |   79|      5|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 5, False: 0]
  |  |  ------------------
  ------------------
  131|      5|}

cairo_matrix_init_identity:
   82|    252|{
   83|    252|    cairo_matrix_init (matrix,
   84|    252|		       1, 0,
   85|    252|		       0, 1,
   86|    252|		       0, 0);
   87|    252|}
cairo_matrix_init:
  115|    339|{
  116|    339|    matrix->xx = xx; matrix->yx = yx;
  117|    339|    matrix->xy = xy; matrix->yy = yy;
  118|    339|    matrix->x0 = x0; matrix->y0 = y0;
  119|    339|}
_cairo_matrix_get_affine:
  146|      2|{
  147|      2|    *xx  = matrix->xx;
  148|      2|    *yx  = matrix->yx;
  149|       |
  150|      2|    *xy  = matrix->xy;
  151|      2|    *yy  = matrix->yy;
  152|       |
  153|      2|    if (x0)
  ------------------
  |  Branch (153:9): [True: 0, False: 2]
  ------------------
  154|      0|	*x0 = matrix->x0;
  155|      2|    if (y0)
  ------------------
  |  Branch (155:9): [True: 0, False: 2]
  ------------------
  156|      0|	*y0 = matrix->y0;
  157|      2|}
cairo_matrix_init_scale:
  217|     86|{
  218|     86|    cairo_matrix_init (matrix,
  219|     86|		       sx,  0,
  220|     86|		       0, sy,
  221|     86|		       0, 0);
  222|     86|}
cairo_matrix_scale:
  238|      2|{
  239|      2|    cairo_matrix_t tmp;
  240|       |
  241|      2|    cairo_matrix_init_scale (&tmp, sx, sy);
  242|       |
  243|      2|    cairo_matrix_multiply (matrix, &tmp, matrix);
  244|      2|}
cairo_matrix_multiply:
  325|     88|{
  326|     88|    cairo_matrix_t r;
  327|       |
  328|     88|    r.xx = a->xx * b->xx + a->yx * b->xy;
  329|     88|    r.yx = a->xx * b->yx + a->yx * b->yy;
  330|       |
  331|     88|    r.xy = a->xy * b->xx + a->yy * b->xy;
  332|     88|    r.yy = a->xy * b->yx + a->yy * b->yy;
  333|       |
  334|     88|    r.x0 = a->x0 * b->xx + a->y0 * b->xy + b->x0;
  335|     88|    r.y0 = a->x0 * b->yx + a->y0 * b->yy + b->y0;
  336|       |
  337|     88|    *result = r;
  338|     88|}
cairo_matrix_transform_distance:
  375|      3|{
  376|      3|    double new_x, new_y;
  377|       |
  378|      3|    new_x = (matrix->xx * *dx + matrix->xy * *dy);
  379|      3|    new_y = (matrix->yx * *dx + matrix->yy * *dy);
  380|       |
  381|      3|    *dx = new_x;
  382|      3|    *dy = new_y;
  383|      3|}
cairo_matrix_invert:
  572|      1|{
  573|      1|    double det;
  574|       |
  575|       |    /* Simple scaling|translation matrices are quite common... */
  576|      1|    if (matrix->xy == 0. && matrix->yx == 0.) {
  ------------------
  |  Branch (576:9): [True: 1, False: 0]
  |  Branch (576:29): [True: 1, False: 0]
  ------------------
  577|      1|	matrix->x0 = -matrix->x0;
  578|      1|	matrix->y0 = -matrix->y0;
  579|       |
  580|      1|	if (matrix->xx != 1.) {
  ------------------
  |  Branch (580:6): [True: 1, False: 0]
  ------------------
  581|      1|	    if (matrix->xx == 0.)
  ------------------
  |  Branch (581:10): [True: 0, False: 1]
  ------------------
  582|      0|		return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
  583|       |
  584|      1|	    matrix->xx = 1. / matrix->xx;
  585|      1|	    matrix->x0 *= matrix->xx;
  586|      1|	}
  587|       |
  588|      1|	if (matrix->yy != 1.) {
  ------------------
  |  Branch (588:6): [True: 1, False: 0]
  ------------------
  589|      1|	    if (matrix->yy == 0.)
  ------------------
  |  Branch (589:10): [True: 0, False: 1]
  ------------------
  590|      0|		return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
  591|       |
  592|      1|	    matrix->yy = 1. / matrix->yy;
  593|      1|	    matrix->y0 *= matrix->yy;
  594|      1|	}
  595|       |
  596|      1|	return CAIRO_STATUS_SUCCESS;
  597|      1|    }
  598|       |
  599|       |    /* inv (A) = 1/det (A) * adj (A) */
  600|      0|    det = _cairo_matrix_compute_determinant (matrix);
  601|       |
  602|      0|    if (! ISFINITE (det))
  ------------------
  |  |   96|      0|#define ISFINITE(x) isfinite (x)
  ------------------
  |  Branch (602:9): [True: 0, False: 0]
  ------------------
  603|      0|	return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
  604|       |
  605|      0|    if (det == 0)
  ------------------
  |  Branch (605:9): [True: 0, False: 0]
  ------------------
  606|      0|	return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
  607|       |
  608|      0|    _cairo_matrix_compute_adjoint (matrix);
  609|      0|    _cairo_matrix_scalar_multiply (matrix, 1 / det);
  610|       |
  611|      0|    return CAIRO_STATUS_SUCCESS;
  612|      0|}
_cairo_matrix_compute_determinant:
  635|    171|{
  636|    171|    double a, b, c, d;
  637|       |
  638|    171|    a = matrix->xx; b = matrix->yx;
  639|    171|    c = matrix->xy; d = matrix->yy;
  640|       |
  641|    171|    return a*d - b*c;
  642|    171|}
_cairo_matrix_compute_basis_scale_factors:
  661|      3|{
  662|      3|    double det;
  663|       |
  664|      3|    det = _cairo_matrix_compute_determinant (matrix);
  665|       |
  666|      3|    if (! ISFINITE (det))
  ------------------
  |  |   96|      3|#define ISFINITE(x) isfinite (x)
  ------------------
  |  Branch (666:9): [True: 0, False: 3]
  ------------------
  667|      0|	return _cairo_error (CAIRO_STATUS_INVALID_MATRIX);
  668|       |
  669|      3|    if (det == 0)
  ------------------
  |  Branch (669:9): [True: 0, False: 3]
  ------------------
  670|      0|    {
  671|      0|	*basis_scale = *normal_scale = 0;
  672|      0|    }
  673|      3|    else
  674|      3|    {
  675|      3|	double x = x_basis != 0;
  676|      3|	double y = x == 0;
  677|      3|	double major, minor;
  678|       |
  679|      3|	cairo_matrix_transform_distance (matrix, &x, &y);
  680|      3|	major = hypot (x, y);
  681|       |	/*
  682|       |	 * ignore mirroring
  683|       |	 */
  684|      3|	if (det < 0)
  ------------------
  |  Branch (684:6): [True: 0, False: 3]
  ------------------
  685|      0|	    det = -det;
  686|      3|	if (major)
  ------------------
  |  Branch (686:6): [True: 3, False: 0]
  ------------------
  687|      3|	    minor = det / major;
  688|      0|	else
  689|      0|	    minor = 0.0;
  690|      3|	if (x_basis)
  ------------------
  |  Branch (690:6): [True: 3, False: 0]
  ------------------
  691|      3|	{
  692|      3|	    *basis_scale = major;
  693|      3|	    *normal_scale = minor;
  694|      3|	}
  695|      0|	else
  696|      0|	{
  697|      0|	    *basis_scale = minor;
  698|      0|	    *normal_scale = major;
  699|      0|	}
  700|      3|    }
  701|       |
  702|      3|    return CAIRO_STATUS_SUCCESS;
  703|      3|}

cairo_glyph_free:
  234|     84|{
  235|     84|    free (glyphs);
  236|     84|}
_cairo_fopen:
  937|    419|{
  938|    419|    FILE *result;
  939|       |#ifdef _WIN32 /* also defined on x86_64 */
  940|       |    uint16_t *filename_w;
  941|       |    uint16_t *mode_w;
  942|       |    cairo_status_t status;
  943|       |
  944|       |    *file_out = NULL;
  945|       |
  946|       |    if (filename == NULL || mode == NULL) {
  947|       |	errno = EINVAL;
  948|       |	return CAIRO_STATUS_SUCCESS;
  949|       |    }
  950|       |
  951|       |    if ((status = _cairo_utf8_to_utf16 (filename, -1, &filename_w, NULL)) != CAIRO_STATUS_SUCCESS) {
  952|       |	errno = EINVAL;
  953|       |	return status;
  954|       |    }
  955|       |
  956|       |    if ((status = _cairo_utf8_to_utf16 (mode, -1, &mode_w, NULL)) != CAIRO_STATUS_SUCCESS) {
  957|       |	free (filename_w);
  958|       |	errno = EINVAL;
  959|       |	return status;
  960|       |    }
  961|       |
  962|       |    result = _wfopen (filename_w, mode_w);
  963|       |
  964|       |    free (filename_w);
  965|       |    free (mode_w);
  966|       |
  967|       |#else /* Use fopen directly */
  968|       |
  969|    419|#if __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 7)
  970|       |    /* Glibc 2.7 supports the "e" mode flag that opens the file with O_CLOEXEC.
  971|       |     * this avoid the race condition in the fcntl fallback below. */
  972|       |
  973|    419|    char new_mode[20];
  974|    419|    snprintf (new_mode, sizeof (new_mode), "%s%s", mode, "e");
  975|    419|    result = fopen (filename, new_mode);
  976|       |
  977|       |#else /* fopen "e" not available */
  978|       |
  979|       |    result = fopen (filename, mode);
  980|       |
  981|       |#if defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC)
  982|       |    /* Manually set CLOEXEC */
  983|       |    if (result != NULL) {
  984|       |	int fd = fileno (result);
  985|       |	if (fd != -1) {
  986|       |	    int flags = fcntl (fd, F_GETFD);
  987|       |	    if (flags >= 0)
  988|       |		flags = fcntl (fd, F_SETFD, flags | FD_CLOEXEC);
  989|       |	}
  990|       |    }
  991|       |#endif /* defined(HAVE_FCNTL_H) && defined(FD_CLOEXEC) */
  992|       |
  993|       |#endif /* fopen "e" not available */
  994|       |
  995|    419|#endif /* !_WIN32 */
  996|       |
  997|    419|    *file_out = result;
  998|       |
  999|    419|    return CAIRO_STATUS_SUCCESS;
 1000|    419|}
_cairo_string_hash:
 1118|     84|{
 1119|     84|    const signed char *p = (const signed char *) str;
 1120|     84|    unsigned int h = *p;
 1121|       |
 1122|    840|    for (p += 1; len > 0; len--, p++)
  ------------------
  |  Branch (1122:18): [True: 756, False: 84]
  ------------------
 1123|    756|	h = (h << 5) - h + *p;
 1124|       |
 1125|     84|    return h;
 1126|     84|}
_cairo_intern_string:
 1142|     84|{
 1143|     84|    char *str = (char *) *str_inout;
 1144|     84|    cairo_intern_string_t tmpl, *istring;
 1145|     84|    cairo_status_t status = CAIRO_STATUS_SUCCESS;
 1146|       |
 1147|     84|    if (CAIRO_INJECT_FAULT ())
  ------------------
  |  |   47|     84|#define CAIRO_INJECT_FAULT() 0
  |  |  ------------------
  |  |  |  Branch (47:30): [Folded, False: 84]
  |  |  ------------------
  ------------------
 1148|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
 1149|       |
 1150|     84|    if (len < 0)
  ------------------
  |  Branch (1150:9): [True: 84, False: 0]
  ------------------
 1151|     84|	len = strlen (str);
 1152|     84|    tmpl.hash_entry.hash = _cairo_string_hash (str, len);
 1153|     84|    tmpl.len = len;
 1154|     84|    tmpl.string = (char *) str;
 1155|       |
 1156|     84|    CAIRO_MUTEX_LOCK (_cairo_intern_string_mutex);
  ------------------
  |  |  175|     84|#define CAIRO_MUTEX_LOCK		CAIRO_MUTEX_IMPL_LOCK
  |  |  ------------------
  |  |  |  |  206|     84|# define CAIRO_MUTEX_IMPL_LOCK(mutex) pthread_mutex_lock (&(mutex))
  |  |  ------------------
  ------------------
 1157|     84|    if (_cairo_intern_string_ht == NULL) {
  ------------------
  |  Branch (1157:9): [True: 1, False: 83]
  ------------------
 1158|      1|	_cairo_intern_string_ht = _cairo_hash_table_create (_intern_string_equal);
 1159|      1|	if (unlikely (_cairo_intern_string_ht == NULL)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1160|      0|	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 1161|      0|	    goto BAIL;
 1162|      0|	}
 1163|      1|    }
 1164|       |
 1165|     84|    istring = _cairo_hash_table_lookup (_cairo_intern_string_ht,
 1166|     84|					&tmpl.hash_entry);
 1167|     84|    if (istring == NULL) {
  ------------------
  |  Branch (1167:9): [True: 1, False: 83]
  ------------------
 1168|      1|	istring = _cairo_malloc (sizeof (cairo_intern_string_t) + len + 1);
  ------------------
  |  |   63|      1|   ((size) != 0 ? malloc(size) : NULL)
  |  |  ------------------
  |  |  |  Branch (63:5): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1169|      1|	if (likely (istring != NULL)) {
  ------------------
  |  |  144|      1|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1170|      1|	    istring->hash_entry.hash = tmpl.hash_entry.hash;
 1171|      1|	    istring->len = tmpl.len;
 1172|      1|	    istring->string = (char *) (istring + 1);
 1173|      1|	    memcpy (istring->string, str, len);
 1174|      1|	    istring->string[len] = '\0';
 1175|       |
 1176|      1|	    status = _cairo_hash_table_insert (_cairo_intern_string_ht,
 1177|      1|					       &istring->hash_entry);
 1178|      1|	    if (unlikely (status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1179|      0|		free (istring);
 1180|      0|		goto BAIL;
 1181|      0|	    }
 1182|      1|	} else {
 1183|      0|	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 1184|      0|	    goto BAIL;
 1185|      0|	}
 1186|      1|    }
 1187|       |
 1188|     84|    *str_inout = istring->string;
 1189|       |
 1190|     84|  BAIL:
 1191|     84|    CAIRO_MUTEX_UNLOCK (_cairo_intern_string_mutex);
  ------------------
  |  |  177|     84|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|     84|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
 1192|     84|    return status;
 1193|     84|}
cairo-misc.c:_intern_string_equal:
 1130|     83|{
 1131|     83|    const cairo_intern_string_t *a = _a;
 1132|     83|    const cairo_intern_string_t *b = _b;
 1133|       |
 1134|     83|    if (a->len != b->len)
  ------------------
  |  Branch (1134:9): [True: 0, False: 83]
  ------------------
 1135|      0|	return FALSE;
  ------------------
  |  |  102|      0|#define FALSE 0
  ------------------
 1136|       |
 1137|     83|    return memcmp (a->string, b->string, a->len) == 0;
 1138|     83|}

_cairo_output_stream_init:
   77|    419|{
   78|    419|    stream->write_func = write_func;
   79|    419|    stream->flush_func = flush_func;
   80|    419|    stream->close_func = close_func;
   81|    419|    stream->position = 0;
   82|    419|    stream->status = CAIRO_STATUS_SUCCESS;
   83|    419|    stream->closed = FALSE;
  ------------------
  |  |  102|    419|#define FALSE 0
  ------------------
   84|    419|}
_cairo_output_stream_fini:
   88|    419|{
   89|    419|    return _cairo_output_stream_close (stream);
   90|    419|}
_cairo_output_stream_close:
  215|    419|{
  216|    419|    cairo_status_t status;
  217|       |
  218|    419|    if (stream->closed)
  ------------------
  |  Branch (218:9): [True: 0, False: 419]
  ------------------
  219|      0|	return stream->status;
  220|       |
  221|    419|    if (stream == &_cairo_output_stream_nil ||
  ------------------
  |  Branch (221:9): [True: 0, False: 419]
  ------------------
  222|    419|	stream == &_cairo_output_stream_nil_write_error)
  ------------------
  |  Branch (222:2): [True: 0, False: 419]
  ------------------
  223|      0|    {
  224|      0|	return stream->status;
  225|      0|    }
  226|       |
  227|    419|    if (stream->close_func) {
  ------------------
  |  Branch (227:9): [True: 419, False: 0]
  ------------------
  228|    419|	status = stream->close_func (stream);
  229|       |	/* Don't overwrite a pre-existing status failure. */
  230|    419|	if (stream->status == CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (230:6): [True: 419, False: 0]
  ------------------
  231|    419|	    stream->status = status;
  232|    419|    }
  233|       |
  234|    419|    stream->closed = TRUE;
  ------------------
  |  |  106|    419|#define TRUE 1
  ------------------
  235|       |
  236|    419|    return stream->status;
  237|    419|}
_cairo_output_stream_destroy:
  241|    419|{
  242|    419|    cairo_status_t status;
  243|       |
  244|    419|    assert (stream != NULL);
  ------------------
  |  Branch (244:5): [True: 0, False: 419]
  |  Branch (244:5): [True: 419, False: 0]
  ------------------
  245|       |
  246|    419|    if (stream == &_cairo_output_stream_nil ||
  ------------------
  |  Branch (246:9): [True: 0, False: 419]
  ------------------
  247|    419|	stream == &_cairo_output_stream_nil_write_error)
  ------------------
  |  Branch (247:2): [True: 0, False: 419]
  ------------------
  248|      0|    {
  249|      0|	return stream->status;
  250|      0|    }
  251|       |
  252|    419|    status = _cairo_output_stream_fini (stream);
  253|    419|    free (stream);
  254|       |
  255|    419|    return status;
  256|    419|}
_cairo_output_stream_write:
  261|  1.91M|{
  262|  1.91M|    if (length == 0 || stream->status)
  ------------------
  |  Branch (262:9): [True: 194, False: 1.91M]
  |  Branch (262:24): [True: 0, False: 1.91M]
  ------------------
  263|    194|	return;
  264|       |
  265|  1.91M|    if (stream->closed) {
  ------------------
  |  Branch (265:9): [True: 0, False: 1.91M]
  ------------------
  266|      0|	stream->status = CAIRO_STATUS_WRITE_ERROR;
  267|      0|	return;
  268|      0|    }
  269|       |
  270|  1.91M|    stream->status = stream->write_func (stream, data, length);
  271|  1.91M|    stream->position += length;
  272|  1.91M|}
_cairo_memory_stream_create:
  738|    419|{
  739|    419|    memory_stream_t *stream;
  740|       |
  741|    419|    stream = _cairo_calloc (sizeof *stream);
  ------------------
  |  |   79|    419|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 419, Folded]
  |  |  ------------------
  ------------------
  742|    419|    if (unlikely (stream == NULL)) {
  ------------------
  |  |  145|    419|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 419]
  |  |  ------------------
  ------------------
  743|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  744|      0|	return (cairo_output_stream_t *) &_cairo_output_stream_nil;
  745|      0|    }
  746|       |
  747|    419|    _cairo_output_stream_init (&stream->base, memory_write, NULL, memory_close);
  748|    419|    _cairo_array_init (&stream->array, 1);
  749|       |
  750|    419|    return &stream->base;
  751|    419|}
_cairo_memory_stream_destroy:
  757|     84|{
  758|     84|    memory_stream_t *stream;
  759|     84|    cairo_status_t status;
  760|       |
  761|     84|    status = abstract_stream->status;
  762|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  763|      0|	return _cairo_output_stream_destroy (abstract_stream);
  764|       |
  765|     84|    stream = (memory_stream_t *) abstract_stream;
  766|       |
  767|     84|    *length_out = _cairo_array_num_elements (&stream->array);
  768|     84|    *data_out = _cairo_calloc (*length_out);
  ------------------
  |  |   79|     84|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 84, False: 0]
  |  |  ------------------
  ------------------
  769|     84|    if (unlikely (*data_out == NULL)) {
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  770|      0|	status = _cairo_output_stream_destroy (abstract_stream);
  771|      0|	assert (status == CAIRO_STATUS_SUCCESS);
  ------------------
  |  Branch (771:2): [True: 0, False: 0]
  |  Branch (771:2): [True: 0, False: 0]
  ------------------
  772|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  773|      0|    }
  774|     84|    memcpy (*data_out, _cairo_array_index (&stream->array, 0), *length_out);
  775|       |
  776|     84|    return _cairo_output_stream_destroy (abstract_stream);
  777|     84|}
cairo-output-stream.c:memory_write:
  720|  1.91M|{
  721|  1.91M|    memory_stream_t *stream = (memory_stream_t *) base;
  722|       |
  723|  1.91M|    return _cairo_array_append_multiple (&stream->array, data, length);
  724|  1.91M|}
cairo-output-stream.c:memory_close:
  728|    419|{
  729|    419|    memory_stream_t *stream = (memory_stream_t *) base;
  730|       |
  731|    419|    _cairo_array_fini (&stream->array);
  732|       |
  733|    419|    return CAIRO_STATUS_SUCCESS;
  734|    419|}

_cairo_path_fixed_init:
   74|     84|{
   75|     84|    VG (VALGRIND_MAKE_MEM_UNDEFINED (path, sizeof (cairo_path_fixed_t)));
   76|       |
   77|     84|    cairo_list_init (&path->buf.base.link);
   78|       |
   79|     84|    path->buf.base.num_ops = 0;
   80|     84|    path->buf.base.num_points = 0;
   81|     84|    path->buf.base.size_ops = ARRAY_LENGTH (path->buf.op);
  ------------------
  |  |  122|     84|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
   82|     84|    path->buf.base.size_points = ARRAY_LENGTH (path->buf.points);
  ------------------
  |  |  122|     84|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
   83|     84|    path->buf.base.op = path->buf.op;
   84|     84|    path->buf.base.points = path->buf.points;
   85|       |
   86|     84|    path->current_point.x = 0;
   87|     84|    path->current_point.y = 0;
   88|     84|    path->last_move_point = path->current_point;
   89|       |
   90|     84|    path->has_current_point = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
   91|     84|    path->needs_move_to = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
   92|     84|    path->has_extents = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
   93|     84|    path->has_curve_to = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
   94|     84|    path->stroke_is_rectilinear = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
   95|     84|    path->fill_is_rectilinear = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
   96|     84|    path->fill_maybe_region = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
   97|     84|    path->fill_is_empty = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
   98|       |
   99|     84|    path->extents.p1.x = path->extents.p1.y = 0;
  100|     84|    path->extents.p2.x = path->extents.p2.y = 0;
  101|     84|}
_cairo_path_fixed_fini:
  340|     84|{
  341|     84|    cairo_path_buf_t *buf;
  342|       |
  343|     84|    buf = cairo_path_buf_next (cairo_path_head (path));
  ------------------
  |  |   66|     84|    cairo_list_entry ((pos__)->link.next, cairo_path_buf_t, link)
  |  |  ------------------
  |  |  |  |   51|     84|	cairo_container_of(ptr, type, member)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|     84|#define cairo_container_of(ptr, type, member) ({ \
  |  |  |  |  |  |  131|     84|    const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
  |  |  |  |  |  |  132|     84|    (type *) ((char *) mptr__ - offsetof (type, member)); \
  |  |  |  |  |  |  133|     84|})
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  344|     84|    while (buf != cairo_path_head (path)) {
  ------------------
  |  |   62|     84|#define cairo_path_head(path__) (&(path__)->buf.base)
  ------------------
  |  Branch (344:12): [True: 0, False: 84]
  ------------------
  345|      0|	cairo_path_buf_t *this = buf;
  346|      0|	buf = cairo_path_buf_next (buf);
  ------------------
  |  |   66|      0|    cairo_list_entry ((pos__)->link.next, cairo_path_buf_t, link)
  |  |  ------------------
  |  |  |  |   51|      0|	cairo_container_of(ptr, type, member)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      0|#define cairo_container_of(ptr, type, member) ({ \
  |  |  |  |  |  |  131|      0|    const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
  |  |  |  |  |  |  132|      0|    (type *) ((char *) mptr__ - offsetof (type, member)); \
  |  |  |  |  |  |  133|      0|})
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  347|      0|	_cairo_path_buf_destroy (this);
  348|      0|    }
  349|       |
  350|     84|    VG (VALGRIND_MAKE_MEM_UNDEFINED (path, sizeof (cairo_path_fixed_t)));
  351|     84|}

cairo_pattern_destroy:
 1148|     84|{
 1149|     84|    cairo_pattern_type_t type;
 1150|       |
 1151|     84|    if (pattern == NULL ||
  ------------------
  |  Branch (1151:9): [True: 0, False: 84]
  ------------------
 1152|     84|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&pattern->ref_count))
  ------------------
  |  |   58|     84|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     84|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     84|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 84, False: 0]
  |  |  ------------------
  ------------------
 1153|     84|	return;
 1154|       |
 1155|     84|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&pattern->ref_count));
  ------------------
  |  Branch (1155:5): [True: 0, False: 0]
  |  Branch (1155:5): [True: 0, False: 0]
  ------------------
 1156|       |
 1157|      0|    if (! _cairo_reference_count_dec_and_test (&pattern->ref_count))
  ------------------
  |  |   49|      0|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|      0|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (1157:9): [True: 0, False: 0]
  ------------------
 1158|      0|	return;
 1159|       |
 1160|      0|    type = pattern->type;
 1161|      0|    _cairo_pattern_fini (pattern);
 1162|       |
 1163|       |    /* maintain a small cache of freed patterns */
 1164|      0|    if (type < ARRAY_LENGTH (freed_pattern_pool))
  ------------------
  |  |  122|      0|#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))
  ------------------
  |  Branch (1164:9): [True: 0, False: 0]
  ------------------
 1165|      0|	_freed_pool_put (&freed_pattern_pool[type], pattern);
 1166|      0|    else
 1167|      0|	free (pattern);
 1168|      0|}

cairo_image_surface_create_from_png:
  915|    419|{
  916|    419|    struct png_read_closure_t png_closure;
  917|    419|    cairo_surface_t *surface;
  918|    419|    cairo_status_t status;
  919|       |
  920|    419|    status = _cairo_fopen (filename, "rb", (FILE **) &png_closure.closure);
  921|       |
  922|    419|    if (status != CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (922:9): [True: 0, False: 419]
  ------------------
  923|      0|	return _cairo_surface_create_in_error (status);
  924|       |
  925|    419|    if (png_closure.closure == NULL) {
  ------------------
  |  Branch (925:9): [True: 0, False: 419]
  ------------------
  926|      0|	switch (errno) {
  927|      0|	case ENOMEM:
  ------------------
  |  Branch (927:2): [True: 0, False: 0]
  ------------------
  928|      0|	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
  929|      0|	    break;
  930|      0|	case ENOENT:
  ------------------
  |  Branch (930:2): [True: 0, False: 0]
  ------------------
  931|      0|	    status = _cairo_error (CAIRO_STATUS_FILE_NOT_FOUND);
  932|      0|	    break;
  933|      0|	default:
  ------------------
  |  Branch (933:2): [True: 0, False: 0]
  ------------------
  934|      0|	    status = _cairo_error (CAIRO_STATUS_READ_ERROR);
  935|      0|	    break;
  936|      0|	}
  937|      0|	return _cairo_surface_create_in_error (status);
  938|      0|    }
  939|       |
  940|    419|    png_closure.read_func = stdio_read_func;
  941|       |
  942|    419|    surface = read_png (&png_closure);
  943|       |
  944|    419|    fclose (png_closure.closure);
  945|       |
  946|    419|    return surface;
  947|    419|}
cairo-png.c:png_simple_error_callback:
  212|    333|{
  213|    333|    cairo_status_t *error = png_get_error_ptr (png);
  214|       |
  215|       |    /* default to the most likely error */
  216|    333|    if (*error == CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (216:9): [True: 97, False: 236]
  ------------------
  217|     97|	*error = _cairo_error (CAIRO_STATUS_PNG_ERROR);
  218|       |
  219|    333|#ifdef PNG_SETJMP_SUPPORTED
  220|    333|    longjmp (png_jmpbuf (png), 1);
  ------------------
  |  |  953|    333|      (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
  ------------------
  221|    333|#endif
  222|       |
  223|       |    /* if we get here, then we have to choice but to abort ... */
  224|    333|}
cairo-png.c:png_simple_warning_callback:
  229|    649|{
  230|       |    /* png does not expect to abort and will try to tidy up and continue
  231|       |     * loading the image after a warning. So we also want to return the
  232|       |     * (incorrect?) surface.
  233|       |     *
  234|       |     * We use our own warning callback to squelch any attempts by libpng
  235|       |     * to write to stderr as we may not be in control of that output.
  236|       |     */
  237|    649|}
cairo-png.c:stdio_read_func:
  631|  1.91M|{
  632|  1.91M|    FILE *file = closure;
  633|       |
  634|  3.82M|    while (size) {
  ------------------
  |  Branch (634:12): [True: 1.91M, False: 1.91M]
  ------------------
  635|  1.91M|	size_t ret;
  636|       |
  637|  1.91M|	ret = fread (data, 1, size, file);
  638|  1.91M|	size -= ret;
  639|  1.91M|	data += ret;
  640|       |
  641|  1.91M|	if (size && (feof (file) || ferror (file)))
  ------------------
  |  Branch (641:6): [True: 236, False: 1.91M]
  |  Branch (641:15): [True: 236, False: 0]
  |  Branch (641:30): [True: 0, False: 0]
  ------------------
  642|    236|	    return _cairo_error (CAIRO_STATUS_READ_ERROR);
  643|  1.91M|    }
  644|       |
  645|  1.91M|    return CAIRO_STATUS_SUCCESS;
  646|  1.91M|}
cairo-png.c:read_png:
  668|    419|{
  669|    419|    cairo_surface_t * volatile surface;
  670|    419|    png_struct *png = NULL;
  671|    419|    png_info *info;
  672|    419|    png_byte * volatile data = NULL;
  673|    419|    png_byte ** volatile row_pointers = NULL;
  674|    419|    png_uint_32 png_width, png_height;
  675|    419|    int depth, color_type, interlace, stride;
  676|    419|    unsigned int i;
  677|    419|    cairo_format_t format;
  678|    419|    cairo_status_t status;
  679|    419|    unsigned char *mime_data;
  680|    419|    unsigned long mime_data_length;
  681|       |
  682|    419|    png_closure->png_data = _cairo_memory_stream_create ();
  683|       |
  684|       |    /* XXX: Perhaps we'll want some other error handlers? */
  685|    419|    png = png_create_read_struct (PNG_LIBPNG_VER_STRING,
  ------------------
  |  |  281|    419|#define PNG_LIBPNG_VER_STRING "1.6.37"
  ------------------
  686|    419|                                  &status,
  687|    419|	                          png_simple_error_callback,
  688|    419|	                          png_simple_warning_callback);
  689|    419|    if (unlikely (png == NULL)) {
  ------------------
  |  |  145|    419|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 419]
  |  |  ------------------
  ------------------
  690|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  691|      0|	goto BAIL;
  692|      0|    }
  693|       |
  694|    419|    info = png_create_info_struct (png);
  695|    419|    if (unlikely (info == NULL)) {
  ------------------
  |  |  145|    419|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 419]
  |  |  ------------------
  ------------------
  696|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  697|      0|	goto BAIL;
  698|      0|    }
  699|       |
  700|    419|    png_set_read_fn (png, png_closure, stream_read_func);
  701|       |
  702|    419|    status = CAIRO_STATUS_SUCCESS;
  703|    419|#ifdef PNG_SETJMP_SUPPORTED
  704|    419|    if (setjmp (png_jmpbuf (png))) {
  ------------------
  |  Branch (704:9): [True: 333, False: 86]
  ------------------
  705|    333|	surface = _cairo_surface_create_in_error (status);
  706|    333|	goto BAIL;
  707|    333|    }
  708|     86|#endif
  709|       |
  710|     86|    png_read_info (png, info);
  711|       |
  712|     86|#ifndef WORDS_BIGENDIAN
  713|       |    /* libpng treats 16-bit data as big-endian by default. Swapping the
  714|       |     * byte-order on little endian ensures the native-endian data can be
  715|       |     * provided to png_read_image. This does not affect 8-bit data.
  716|       |     */
  717|     86|    png_set_swap (png);
  718|     86|#endif
  719|       |
  720|     86|    png_get_IHDR (png, info,
  721|     86|                  &png_width, &png_height, &depth,
  722|     86|                  &color_type, &interlace, NULL, NULL);
  723|     86|    if (unlikely (status)) { /* catch any early warnings */
  ------------------
  |  |  145|     86|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 86]
  |  |  ------------------
  ------------------
  724|      0|	surface = _cairo_surface_create_in_error (status);
  725|      0|	goto BAIL;
  726|      0|    }
  727|       |
  728|       |    /* convert palette/gray image to rgb */
  729|     86|    if (color_type == PNG_COLOR_TYPE_PALETTE)
  ------------------
  |  |  669|     86|#define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  664|     86|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_PALETTE  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
  |  |  ------------------
  |  |  |  |  663|     86|#define PNG_COLOR_MASK_PALETTE    1
  |  |  ------------------
  ------------------
  |  Branch (729:9): [True: 4, False: 82]
  ------------------
  730|      4|        png_set_palette_to_rgb (png);
  731|       |
  732|       |    /* expand gray bit depth if needed */
  733|     86|    if (color_type == PNG_COLOR_TYPE_GRAY)
  ------------------
  |  |  668|     86|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (733:9): [True: 83, False: 3]
  ------------------
  734|     83|        png_set_expand_gray_1_2_4_to_8 (png);
  735|       |
  736|       |    /* transform transparency to alpha */
  737|     86|    if (png_get_valid (png, info, PNG_INFO_tRNS))
  ------------------
  |  |  736|     86|#define PNG_INFO_tRNS 0x0010U
  ------------------
  |  Branch (737:9): [True: 19, False: 67]
  ------------------
  738|     19|        png_set_tRNS_to_alpha (png);
  739|       |
  740|     86|    if (depth < 8)
  ------------------
  |  Branch (740:9): [True: 67, False: 19]
  ------------------
  741|     67|        png_set_packing (png);
  742|       |
  743|       |    /* convert grayscale to RGB */
  744|     86|    if (color_type == PNG_COLOR_TYPE_GRAY ||
  ------------------
  |  |  668|    172|#define PNG_COLOR_TYPE_GRAY 0
  ------------------
  |  Branch (744:9): [True: 18.4E, False: 125]
  ------------------
  745|    125|	color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
  ------------------
  |  |  672|    125|#define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  665|    125|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (745:2): [True: 19, False: 106]
  ------------------
  746|    102|    {
  747|    102|	png_set_gray_to_rgb (png);
  748|    102|    }
  749|       |
  750|     86|    if (interlace != PNG_INTERLACE_NONE)
  ------------------
  |  |  687|     86|#define PNG_INTERLACE_NONE        0 /* Non-interlaced image */
  ------------------
  |  Branch (750:9): [True: 93, False: 18.4E]
  ------------------
  751|     93|        png_set_interlace_handling (png);
  752|       |
  753|     86|    png_set_filler (png, 0xff, PNG_FILLER_AFTER);
  ------------------
  |  | 1249|     86|#  define PNG_FILLER_AFTER 1
  ------------------
  754|       |
  755|       |    /* recheck header after setting EXPAND options */
  756|     86|    png_read_update_info (png, info);
  757|     86|    png_get_IHDR (png, info,
  758|     86|                  &png_width, &png_height, &depth,
  759|     86|                  &color_type, &interlace, NULL, NULL);
  760|     86|    if ((depth != 8 && depth != 16) ||
  ------------------
  |  Branch (760:10): [True: 44, False: 42]
  |  Branch (760:24): [True: 0, False: 44]
  ------------------
  761|    208|	! (color_type == PNG_COLOR_TYPE_RGB ||
  ------------------
  |  |  670|    416|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  664|    208|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (761:5): [True: 124, False: 84]
  ------------------
  762|     84|	   color_type == PNG_COLOR_TYPE_RGB_ALPHA))
  ------------------
  |  |  671|     84|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|     84|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  665|     84|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (762:5): [True: 84, False: 0]
  ------------------
  763|      0|    {
  764|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_READ_ERROR));
  765|      0|	goto BAIL;
  766|      0|    }
  767|       |
  768|     86|    switch (color_type) {
  769|      0|	default:
  ------------------
  |  Branch (769:2): [True: 0, False: 86]
  ------------------
  770|      0|	    ASSERT_NOT_REACHED;
  ------------------
  |  |  140|      0|#define ASSERT_NOT_REACHED		\
  |  |  141|      0|do {					\
  |  |  142|      0|    assert (!"reached");		\
  |  |  143|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (143:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (770:6): [Folded, False: 0]
  |  Branch (770:6): [Folded, False: 0]
  ------------------
  771|       |	    /* fall-through just in case ;-) */
  772|       |
  773|     84|	case PNG_COLOR_TYPE_RGB_ALPHA:
  ------------------
  |  |  671|     84|#define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  664|     84|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  |  |               #define PNG_COLOR_TYPE_RGB_ALPHA  (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
  |  |  ------------------
  |  |  |  |  665|     84|#define PNG_COLOR_MASK_ALPHA      4
  |  |  ------------------
  ------------------
  |  Branch (773:2): [True: 84, False: 2]
  ------------------
  774|     84|	    if (depth == 8) {
  ------------------
  |  Branch (774:10): [True: 68, False: 16]
  ------------------
  775|     68|		format = CAIRO_FORMAT_ARGB32;
  776|     68|		png_set_read_user_transform_fn (png, premultiply_data);
  777|     68|	    } else {
  778|     16|		format = CAIRO_FORMAT_RGBA128F;
  779|     16|	    }
  780|     84|	    break;
  781|       |
  782|    124|	case PNG_COLOR_TYPE_RGB:
  ------------------
  |  |  670|    124|#define PNG_COLOR_TYPE_RGB        (PNG_COLOR_MASK_COLOR)
  |  |  ------------------
  |  |  |  |  664|    124|#define PNG_COLOR_MASK_COLOR      2
  |  |  ------------------
  ------------------
  |  Branch (782:2): [True: 124, False: 18.4E]
  ------------------
  783|    124|	    if (depth == 8) {
  ------------------
  |  Branch (783:10): [True: 96, False: 28]
  ------------------
  784|     96|		format = CAIRO_FORMAT_RGB24;
  785|     96|		png_set_read_user_transform_fn (png, convert_bytes_to_data);
  786|     96|	    } else {
  787|     28|		format = CAIRO_FORMAT_RGB96F;
  788|     28|	    }
  789|    124|	    break;
  790|     86|    }
  791|       |
  792|    208|    stride = cairo_format_stride_for_width (format, png_width);
  793|    208|    if (stride < 0) {
  ------------------
  |  Branch (793:9): [True: 0, False: 208]
  ------------------
  794|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_STRIDE));
  795|      0|	goto BAIL;
  796|      0|    }
  797|       |
  798|    208|    data = _cairo_malloc_ab (png_height, stride);
  799|    208|    if (unlikely (data == NULL)) {
  ------------------
  |  |  145|    208|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 208]
  |  |  ------------------
  ------------------
  800|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  801|      0|	goto BAIL;
  802|      0|    }
  803|       |
  804|    208|    row_pointers = _cairo_malloc_ab (png_height, sizeof (char *));
  805|    208|    if (unlikely (row_pointers == NULL)) {
  ------------------
  |  |  145|    208|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 208]
  |  |  ------------------
  ------------------
  806|      0|	surface = _cairo_surface_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
  807|      0|	goto BAIL;
  808|      0|    }
  809|       |
  810|  9.48M|    for (i = 0; i < png_height; i++)
  ------------------
  |  Branch (810:17): [True: 9.48M, False: 208]
  ------------------
  811|  9.48M|        row_pointers[i] = &data[i * (ptrdiff_t)stride];
  812|       |
  813|    208|    png_read_image (png, row_pointers);
  814|    208|    png_read_end (png, info);
  815|       |
  816|    208|    if (unlikely (status)) { /* catch any late warnings - probably hit an error already */
  ------------------
  |  |  145|    208|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 208]
  |  |  ------------------
  ------------------
  817|      0|	surface = _cairo_surface_create_in_error (status);
  818|      0|	goto BAIL;
  819|      0|    }
  820|       |
  821|    208|    if (format == CAIRO_FORMAT_RGBA128F) {
  ------------------
  |  Branch (821:9): [True: 12, False: 196]
  ------------------
  822|     12|	i = png_height;
  823|       |
  824|    647|	while (i--) {
  ------------------
  |  Branch (824:9): [True: 635, False: 12]
  ------------------
  825|    635|	    float *float_line = (float *)row_pointers[i];
  826|    635|	    uint16_t *u16_line = (uint16_t *)row_pointers[i];
  827|       |
  828|    635|	    premultiply_float (float_line, u16_line, png_width);
  829|    635|	}
  830|    196|    } else if (format == CAIRO_FORMAT_RGB96F) {
  ------------------
  |  Branch (830:16): [True: 22, False: 174]
  ------------------
  831|     22|	i = png_height;
  832|       |
  833|    471|	while (i--) {
  ------------------
  |  Branch (833:9): [True: 449, False: 22]
  ------------------
  834|    449|	    float *float_line = (float *)row_pointers[i];
  835|    449|	    uint16_t *u16_line = (uint16_t *)row_pointers[i];
  836|       |
  837|    449|	    convert_u16_to_float (float_line, u16_line, png_width);
  838|    449|	}
  839|     22|    }
  840|       |
  841|    208|    surface = cairo_image_surface_create_for_data (data, format,
  842|    208|						   png_width, png_height,
  843|    208|						   stride);
  844|    208|    if (surface->status)
  ------------------
  |  Branch (844:9): [True: 2, False: 206]
  ------------------
  845|      2|	goto BAIL;
  846|       |
  847|    206|    _cairo_image_surface_assume_ownership_of_data ((cairo_image_surface_t*)surface);
  848|    206|    data = NULL;
  849|       |
  850|    206|    _cairo_debug_check_image_surface_is_defined (surface);
  851|       |
  852|    206|    status = _cairo_memory_stream_destroy (png_closure->png_data,
  853|    206|					   &mime_data,
  854|    206|					   &mime_data_length);
  855|    206|    png_closure->png_data = NULL;
  856|    206|    if (unlikely (status)) {
  ------------------
  |  |  145|    206|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 206]
  |  |  ------------------
  ------------------
  857|      0|	cairo_surface_destroy (surface);
  858|      0|	surface = _cairo_surface_create_in_error (status);
  859|      0|	goto BAIL;
  860|      0|    }
  861|       |
  862|    206|    status = cairo_surface_set_mime_data (surface,
  863|    206|					  CAIRO_MIME_TYPE_PNG,
  ------------------
  |  | 2621|    206|#define CAIRO_MIME_TYPE_PNG "image/png"
  ------------------
  864|    206|					  mime_data,
  865|    206|					  mime_data_length,
  866|    206|					  free,
  867|    206|					  mime_data);
  868|    206|    if (unlikely (status)) {
  ------------------
  |  |  145|    206|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 206]
  |  |  ------------------
  ------------------
  869|      0|	free (mime_data);
  870|      0|	cairo_surface_destroy (surface);
  871|      0|	surface = _cairo_surface_create_in_error (status);
  872|      0|	goto BAIL;
  873|      0|    }
  874|       |
  875|    419| BAIL:
  876|    419|    free (row_pointers);
  877|    419|    free (data);
  878|    419|    if (png != NULL)
  ------------------
  |  Branch (878:9): [True: 419, False: 0]
  ------------------
  879|    419|	png_destroy_read_struct (&png, &info, NULL);
  880|    419|    if (png_closure->png_data != NULL) {
  ------------------
  |  Branch (880:9): [True: 335, False: 84]
  ------------------
  881|    335|	cairo_status_t status_ignored;
  882|       |
  883|    335|	status_ignored = _cairo_output_stream_destroy (png_closure->png_data);
  884|    335|    }
  885|       |
  886|    419|    return surface;
  887|    206|}
cairo-png.c:stream_read_func:
  650|  1.91M|{
  651|  1.91M|    cairo_status_t status;
  652|  1.91M|    struct png_read_closure_t *png_closure;
  653|       |
  654|  1.91M|    png_closure = png_get_io_ptr (png);
  655|  1.91M|    status = png_closure->read_func (png_closure->closure, data, size);
  656|  1.91M|    if (unlikely (status)) {
  ------------------
  |  |  145|  1.91M|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 236, False: 1.91M]
  |  |  ------------------
  ------------------
  657|    236|	cairo_status_t *error = png_get_error_ptr (png);
  658|    236|	if (*error == CAIRO_STATUS_SUCCESS)
  ------------------
  |  Branch (658:6): [True: 236, False: 0]
  ------------------
  659|    236|	    *error = status;
  660|    236|	png_error (png, NULL);
  661|    236|    }
  662|       |
  663|  1.91M|    _cairo_output_stream_write (png_closure->png_data, data, size);
  664|  1.91M|}
cairo-png.c:premultiply_data:
  585|  1.25k|{
  586|  1.25k|    unsigned int i;
  587|       |
  588|  5.94M|    for (i = 0; i < row_info->rowbytes; i += 4) {
  ------------------
  |  Branch (588:17): [True: 5.94M, False: 1.25k]
  ------------------
  589|  5.94M|	uint8_t *base  = &data[i];
  590|  5.94M|	uint8_t  alpha = base[3];
  591|  5.94M|	uint32_t p;
  592|       |
  593|  5.94M|	if (alpha == 0) {
  ------------------
  |  Branch (593:6): [True: 4.08M, False: 1.86M]
  ------------------
  594|  4.08M|	    p = 0;
  595|  4.08M|	} else {
  596|  1.86M|	    uint8_t  red   = base[0];
  597|  1.86M|	    uint8_t  green = base[1];
  598|  1.86M|	    uint8_t  blue  = base[2];
  599|       |
  600|  1.86M|	    if (alpha != 0xff) {
  ------------------
  |  Branch (600:10): [True: 1.05M, False: 804k]
  ------------------
  601|  1.05M|		red   = multiply_alpha (alpha, red);
  602|  1.05M|		green = multiply_alpha (alpha, green);
  603|  1.05M|		blue  = multiply_alpha (alpha, blue);
  604|  1.05M|	    }
  605|  1.86M|	    p = ((uint32_t)alpha << 24) | (red << 16) | (green << 8) | (blue << 0);
  606|  1.86M|	}
  607|  5.94M|	memcpy (base, &p, sizeof (uint32_t));
  608|  5.94M|    }
  609|  1.25k|}
cairo-png.c:multiply_alpha:
  575|  3.17M|{
  576|  3.17M|    int temp = (alpha * color) + 0x80;
  577|  3.17M|    return ((temp + (temp >> 8)) >> 8);
  578|  3.17M|}
cairo-png.c:convert_bytes_to_data:
  614|  5.90k|{
  615|  5.90k|    unsigned int i;
  616|       |
  617|  6.94M|    for (i = 0; i < row_info->rowbytes; i += 4) {
  ------------------
  |  Branch (617:17): [True: 6.93M, False: 5.90k]
  ------------------
  618|  6.93M|	uint8_t *base  = &data[i];
  619|  6.93M|	uint8_t  red   = base[0];
  620|  6.93M|	uint8_t  green = base[1];
  621|  6.93M|	uint8_t  blue  = base[2];
  622|  6.93M|	uint32_t pixel;
  623|       |
  624|  6.93M|	pixel = (0xffu << 24) | (red << 16) | (green << 8) | (blue << 0);
  625|  6.93M|	memcpy (base, &pixel, sizeof (uint32_t));
  626|  6.93M|    }
  627|  5.90k|}
cairo-png.c:premultiply_float:
  147|    635|{
  148|    635|    unsigned int i = width;
  149|       |
  150|       |    /* Convert d16 in place back to float */
  151|  1.60k|    while (i--) {
  ------------------
  |  Branch (151:12): [True: 974, False: 635]
  ------------------
  152|    974|	float a = d16[i * 4 + 3] / 65535.f;
  153|       |
  154|    974|	f[i * 4 + 3] = a;
  155|    974|	f[i * 4 + 2] = (float)d16[i * 4 + 2] / 65535.f * a;
  156|    974|	f[i * 4 + 1] = (float)d16[i * 4 + 1] / 65535.f * a;
  157|    974|	f[i * 4] = (float)d16[i * 4] / 65535.f * a;
  158|    974|    }
  159|    635|}
cairo-png.c:convert_u16_to_float:
  162|    449|{
  163|       |    /* Convert d16 in place back to float */
  164|    449|    unsigned int i = width;
  165|       |
  166|  5.33k|    while (i--) {
  ------------------
  |  Branch (166:12): [True: 4.88k, False: 449]
  ------------------
  167|  4.88k|	f[i * 3 + 2] = (float)d16[i * 4 + 2] / 65535.f;
  168|  4.88k|	f[i * 3 + 1] = (float)d16[i * 4 + 1] / 65535.f;
  169|  4.88k|	f[i * 3] = (float)d16[i * 4] / 65535.f;
  170|  4.88k|    }
  171|    449|}

cairo_scaled_font_status:
  336|     84|{
  337|     84|    return scaled_font->status;
  338|     84|}
_cairo_scaled_font_init:
  733|      1|{
  734|      1|    cairo_status_t status;
  735|       |
  736|      1|    status = cairo_font_options_status ((cairo_font_options_t *) options);
  737|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  738|      0|	return status;
  739|       |
  740|      1|    scaled_font->status = CAIRO_STATUS_SUCCESS;
  741|      1|    scaled_font->placeholder = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  742|      1|    scaled_font->font_face = font_face;
  743|      1|    scaled_font->original_font_face = font_face;
  744|      1|    scaled_font->font_matrix = *font_matrix;
  745|      1|    scaled_font->ctm = *ctm;
  746|       |    /* ignore translation values in the ctm */
  747|      1|    scaled_font->ctm.x0 = 0.;
  748|      1|    scaled_font->ctm.y0 = 0.;
  749|      1|    _cairo_font_options_init_copy (&scaled_font->options, options);
  750|       |
  751|      1|    cairo_matrix_multiply (&scaled_font->scale,
  752|      1|			   &scaled_font->font_matrix,
  753|      1|			   &scaled_font->ctm);
  754|       |
  755|      1|    scaled_font->max_scale = MAX (fabs (scaled_font->scale.xx) + fabs (scaled_font->scale.xy),
  ------------------
  |  |   93|      1|#define MAX(a, b) ((a) > (b) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (93:20): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  756|      1|				  fabs (scaled_font->scale.yx) + fabs (scaled_font->scale.yy));
  757|      1|    scaled_font->scale_inverse = scaled_font->scale;
  758|      1|    status = cairo_matrix_invert (&scaled_font->scale_inverse);
  759|      1|    if (unlikely (status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  760|       |	/* If the font scale matrix is rank 0, just using an all-zero inverse matrix
  761|       |	 * makes everything work correctly.  This make font size 0 work without
  762|       |	 * producing an error.
  763|       |	 *
  764|       |	 * FIXME:  If the scale is rank 1, we still go into error mode.  But then
  765|       |	 * again, that's what we do everywhere in cairo.
  766|       |	 *
  767|       |	 * Also, the check for == 0. below may be too harsh...
  768|       |	 */
  769|      0|        if (_cairo_matrix_is_scale_0 (&scaled_font->scale)) {
  ------------------
  |  Branch (769:13): [True: 0, False: 0]
  ------------------
  770|      0|	    cairo_matrix_init (&scaled_font->scale_inverse,
  771|      0|			       0, 0, 0, 0,
  772|      0|			       -scaled_font->scale.x0,
  773|      0|			       -scaled_font->scale.y0);
  774|      0|	} else
  775|      0|	    return status;
  776|      0|    }
  777|       |
  778|      1|    scaled_font->glyphs = _cairo_hash_table_create (NULL);
  779|      1|    if (unlikely (scaled_font->glyphs == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  780|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  781|       |
  782|      1|    cairo_list_init (&scaled_font->glyph_pages);
  783|      1|    scaled_font->cache_frozen = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  784|      1|    scaled_font->global_cache_frozen = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  785|      1|    _cairo_array_init (&scaled_font->recording_surfaces_to_free, sizeof (cairo_surface_t *));
  786|       |
  787|      1|    scaled_font->holdover = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  788|      1|    scaled_font->finished = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  789|       |
  790|      1|    CAIRO_REFERENCE_COUNT_INIT (&scaled_font->ref_count, 1);
  ------------------
  |  |   51|      1|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  791|       |
  792|      1|    _cairo_user_data_array_init (&scaled_font->user_data);
  793|       |
  794|      1|    cairo_font_face_reference (font_face);
  795|      1|    scaled_font->original_font_face = NULL;
  796|       |
  797|      1|    CAIRO_RECURSIVE_MUTEX_INIT (scaled_font->mutex);
  ------------------
  |  |  182|      1|#define CAIRO_RECURSIVE_MUTEX_INIT		CAIRO_RECURSIVE_MUTEX_IMPL_INIT
  |  |  ------------------
  |  |  |  |  220|      1|# define CAIRO_RECURSIVE_MUTEX_IMPL_INIT(mutex) do { \
  |  |  |  |  221|      1|    pthread_mutexattr_t attr; \
  |  |  |  |  222|      1|    pthread_mutexattr_init (&attr); \
  |  |  |  |  223|      1|    pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); \
  |  |  |  |  224|      1|    pthread_mutex_init (&(mutex), &attr); \
  |  |  |  |  225|      1|    pthread_mutexattr_destroy (&attr); \
  |  |  |  |  226|      1|} while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (226:10): [Folded, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  798|       |
  799|      1|    cairo_list_init (&scaled_font->dev_privates);
  800|       |
  801|      1|    scaled_font->backend = backend;
  802|      1|    cairo_list_init (&scaled_font->link);
  803|       |
  804|      1|    return CAIRO_STATUS_SUCCESS;
  805|      1|}
_cairo_scaled_font_set_metrics:
  889|      1|{
  890|      1|    cairo_status_t status;
  891|      1|    double  font_scale_x, font_scale_y;
  892|       |
  893|      1|    scaled_font->fs_extents = *fs_metrics;
  894|       |
  895|      1|    status = _cairo_matrix_compute_basis_scale_factors (&scaled_font->font_matrix,
  896|      1|						  &font_scale_x, &font_scale_y,
  897|      1|						  1);
  898|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  899|      0|	return status;
  900|       |
  901|       |    /*
  902|       |     * The font responded in unscaled units, scale by the font
  903|       |     * matrix scale factors to get to user space
  904|       |     */
  905|       |
  906|      1|    scaled_font->extents.ascent = fs_metrics->ascent * font_scale_y;
  907|      1|    scaled_font->extents.descent = fs_metrics->descent * font_scale_y;
  908|      1|    scaled_font->extents.height = fs_metrics->height * font_scale_y;
  909|      1|    scaled_font->extents.max_x_advance = fs_metrics->max_x_advance * font_scale_x;
  910|      1|    scaled_font->extents.max_y_advance = fs_metrics->max_y_advance * font_scale_y;
  911|       |
  912|      1|    return CAIRO_STATUS_SUCCESS;
  913|      1|}
cairo_scaled_font_create:
 1048|     84|{
 1049|     84|    cairo_status_t status;
 1050|     84|    cairo_scaled_font_map_t *font_map;
 1051|     84|    cairo_font_face_t *original_font_face = font_face;
 1052|     84|    cairo_scaled_font_t key, *old = NULL, *scaled_font = NULL, *dead = NULL;
 1053|     84|    double det;
 1054|       |
 1055|     84|    status = font_face->status;
 1056|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1057|      0|	return _cairo_scaled_font_create_in_error (status);
 1058|       |
 1059|     84|    det = _cairo_matrix_compute_determinant (font_matrix);
 1060|     84|    if (! ISFINITE (det))
  ------------------
  |  |   96|     84|#define ISFINITE(x) isfinite (x)
  ------------------
  |  Branch (1060:9): [True: 0, False: 84]
  ------------------
 1061|      0|	return _cairo_scaled_font_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_MATRIX));
 1062|       |
 1063|     84|    det = _cairo_matrix_compute_determinant (ctm);
 1064|     84|    if (! ISFINITE (det))
  ------------------
  |  |   96|     84|#define ISFINITE(x) isfinite (x)
  ------------------
  |  Branch (1064:9): [True: 0, False: 84]
  ------------------
 1065|      0|	return _cairo_scaled_font_create_in_error (_cairo_error (CAIRO_STATUS_INVALID_MATRIX));
 1066|       |
 1067|     84|    status = cairo_font_options_status ((cairo_font_options_t *) options);
 1068|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1069|      0|	return _cairo_scaled_font_create_in_error (status);
 1070|       |
 1071|       |    /* Note that degenerate ctm or font_matrix *are* allowed.
 1072|       |     * We want to support a font size of 0. */
 1073|       |
 1074|     84|    font_map = _cairo_scaled_font_map_lock ();
 1075|     84|    if (unlikely (font_map == NULL))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1076|      0|	return _cairo_scaled_font_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
 1077|       |
 1078|     84|    scaled_font = font_map->mru_scaled_font;
 1079|     84|    if (scaled_font != NULL &&
  ------------------
  |  Branch (1079:9): [True: 83, False: 1]
  ------------------
 1080|     83|	_cairo_scaled_font_matches (scaled_font,
  ------------------
  |  Branch (1080:2): [True: 83, False: 0]
  ------------------
 1081|     83|	                            font_face, font_matrix, ctm, options))
 1082|     83|    {
 1083|     83|	assert (scaled_font->hash_entry.hash != ZOMBIE);
  ------------------
  |  Branch (1083:2): [True: 0, False: 83]
  |  Branch (1083:2): [True: 83, False: 0]
  ------------------
 1084|     83|	assert (! scaled_font->placeholder);
  ------------------
  |  Branch (1084:2): [True: 0, False: 83]
  |  Branch (1084:2): [True: 83, False: 0]
  ------------------
 1085|       |
 1086|     83|	if (likely (scaled_font->status == CAIRO_STATUS_SUCCESS)) {
  ------------------
  |  |  144|     83|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 83, False: 0]
  |  |  ------------------
  ------------------
 1087|       |	    /* We increment the reference count manually here, (rather
 1088|       |	     * than calling into cairo_scaled_font_reference), since we
 1089|       |	     * must modify the reference count while our lock is still
 1090|       |	     * held. */
 1091|     83|	    _cairo_reference_count_inc (&scaled_font->ref_count);
  ------------------
  |  |   47|     83|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|     83|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
 1092|     83|	    _cairo_scaled_font_map_unlock ();
 1093|     83|	    return scaled_font;
 1094|     83|	}
 1095|       |
 1096|       |	/* the font has been put into an error status - abandon the cache */
 1097|      0|	_cairo_hash_table_remove (font_map->hash_table,
 1098|      0|				  &scaled_font->hash_entry);
 1099|      0|	scaled_font->hash_entry.hash = ZOMBIE;
  ------------------
  |  |  236|      0|#define ZOMBIE 0
  ------------------
 1100|      0|	dead = scaled_font;
 1101|      0|	font_map->mru_scaled_font = NULL;
 1102|      0|    }
 1103|       |
 1104|      1|    _cairo_scaled_font_init_key (&key, font_face, font_matrix, ctm, options);
 1105|       |
 1106|      1|    while ((scaled_font = _cairo_hash_table_lookup (font_map->hash_table,
  ------------------
  |  Branch (1106:12): [True: 0, False: 1]
  ------------------
 1107|      1|						    &key.hash_entry)))
 1108|      0|    {
 1109|      0|	if (! scaled_font->placeholder)
  ------------------
  |  Branch (1109:6): [True: 0, False: 0]
  ------------------
 1110|      0|	    break;
 1111|       |
 1112|       |	/* If the scaled font is being created (happens for user-font),
 1113|       |	 * just wait until it's done, then retry */
 1114|      0|	_cairo_scaled_font_placeholder_wait_for_creation_to_finish (scaled_font);
 1115|      0|    }
 1116|      1|    _cairo_scaled_font_fini_key (&key);
 1117|       |
 1118|      1|    if (scaled_font != NULL) {
  ------------------
  |  Branch (1118:9): [True: 0, False: 1]
  ------------------
 1119|       |	/* If the original reference count is 0, then this font must have
 1120|       |	 * been found in font_map->holdovers, (which means this caching is
 1121|       |	 * actually working). So now we remove it from the holdovers
 1122|       |	 * array, unless we caught the font in the middle of destruction.
 1123|       |	 */
 1124|      0|	if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count)) {
  ------------------
  |  |   60|      0|#define CAIRO_REFERENCE_COUNT_HAS_REFERENCE(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) > 0)
  |  |  ------------------
  |  |  |  |   53|      0|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  ------------------
  |  Branch (1124:6): [True: 0, False: 0]
  ------------------
 1125|      0|	    if (scaled_font->holdover) {
  ------------------
  |  Branch (1125:10): [True: 0, False: 0]
  ------------------
 1126|      0|		int i;
 1127|       |
 1128|      0|		for (i = 0; i < font_map->num_holdovers; i++) {
  ------------------
  |  Branch (1128:15): [True: 0, False: 0]
  ------------------
 1129|      0|		    if (font_map->holdovers[i] == scaled_font) {
  ------------------
  |  Branch (1129:11): [True: 0, False: 0]
  ------------------
 1130|      0|			font_map->num_holdovers--;
 1131|      0|			memmove (&font_map->holdovers[i],
 1132|      0|				 &font_map->holdovers[i+1],
 1133|      0|				 (font_map->num_holdovers - i) * sizeof (cairo_scaled_font_t*));
 1134|      0|			break;
 1135|      0|		    }
 1136|      0|		}
 1137|       |
 1138|      0|		scaled_font->holdover = FALSE;
  ------------------
  |  |  102|      0|#define FALSE 0
  ------------------
 1139|      0|	    }
 1140|       |
 1141|       |	    /* reset any error status */
 1142|      0|	    scaled_font->status = CAIRO_STATUS_SUCCESS;
 1143|      0|	}
 1144|       |
 1145|      0|	if (likely (scaled_font->status == CAIRO_STATUS_SUCCESS)) {
  ------------------
  |  |  144|      0|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1146|       |	    /* We increment the reference count manually here, (rather
 1147|       |	     * than calling into cairo_scaled_font_reference), since we
 1148|       |	     * must modify the reference count while our lock is still
 1149|       |	     * held. */
 1150|       |
 1151|      0|	    old = font_map->mru_scaled_font;
 1152|      0|	    font_map->mru_scaled_font = scaled_font;
 1153|       |	    /* increment reference count for the mru cache */
 1154|      0|	    _cairo_reference_count_inc (&scaled_font->ref_count);
  ------------------
  |  |   47|      0|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|      0|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
 1155|       |	    /* and increment for the returned reference */
 1156|      0|	    _cairo_reference_count_inc (&scaled_font->ref_count);
  ------------------
  |  |   47|      0|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|      0|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
 1157|      0|	    _cairo_scaled_font_map_unlock ();
 1158|       |
 1159|      0|	    cairo_scaled_font_destroy (old);
 1160|      0|	    if (font_face != original_font_face)
  ------------------
  |  Branch (1160:10): [True: 0, False: 0]
  ------------------
 1161|      0|		cairo_font_face_destroy (font_face);
 1162|       |
 1163|      0|	    return scaled_font;
 1164|      0|	}
 1165|       |
 1166|       |	/* the font has been put into an error status - abandon the cache */
 1167|      0|	_cairo_hash_table_remove (font_map->hash_table,
 1168|      0|				  &scaled_font->hash_entry);
 1169|      0|	scaled_font->hash_entry.hash = ZOMBIE;
  ------------------
  |  |  236|      0|#define ZOMBIE 0
  ------------------
 1170|      0|    }
 1171|       |
 1172|       |
 1173|       |    /* Otherwise create it and insert it into the hash table. */
 1174|      1|    if (font_face->backend->get_implementation != NULL) {
  ------------------
  |  Branch (1174:9): [True: 1, False: 0]
  ------------------
 1175|      1|	font_face = font_face->backend->get_implementation (font_face,
 1176|      1|							    font_matrix,
 1177|      1|							    ctm,
 1178|      1|							    options);
 1179|      1|	if (unlikely (font_face->status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1180|      0|	    _cairo_scaled_font_map_unlock ();
 1181|      0|	    return _cairo_scaled_font_create_in_error (font_face->status);
 1182|      0|	}
 1183|      1|    }
 1184|       |
 1185|      1|    status = font_face->backend->scaled_font_create (font_face, font_matrix,
 1186|      1|						     ctm, options, &scaled_font);
 1187|      1|    if (unlikely (status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1188|      0|	_cairo_scaled_font_map_unlock ();
 1189|      0|	if (font_face != original_font_face)
  ------------------
  |  Branch (1189:6): [True: 0, False: 0]
  ------------------
 1190|      0|	    cairo_font_face_destroy (font_face);
 1191|       |
 1192|      0|	if (dead != NULL)
  ------------------
  |  Branch (1192:6): [True: 0, False: 0]
  ------------------
 1193|      0|	    cairo_scaled_font_destroy (dead);
 1194|       |
 1195|      0|	return _cairo_scaled_font_create_in_error (status);
 1196|      0|    }
 1197|       |    /* Or did we encounter an error whilst constructing the scaled font? */
 1198|      1|    if (unlikely (scaled_font->status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1199|      0|	_cairo_scaled_font_map_unlock ();
 1200|      0|	if (font_face != original_font_face)
  ------------------
  |  Branch (1200:6): [True: 0, False: 0]
  ------------------
 1201|      0|	    cairo_font_face_destroy (font_face);
 1202|       |
 1203|      0|	if (dead != NULL)
  ------------------
  |  Branch (1203:6): [True: 0, False: 0]
  ------------------
 1204|      0|	    cairo_scaled_font_destroy (dead);
 1205|       |
 1206|      0|	return scaled_font;
 1207|      0|    }
 1208|       |
 1209|       |    /* Our caching above is defeated if the backend switches fonts on us -
 1210|       |     * e.g. old incarnations of toy-font-face and lazily resolved
 1211|       |     * ft-font-faces
 1212|       |     */
 1213|      1|    assert (scaled_font->font_face == font_face);
  ------------------
  |  Branch (1213:5): [True: 0, False: 1]
  |  Branch (1213:5): [True: 1, False: 0]
  ------------------
 1214|      1|    assert (! scaled_font->cache_frozen);
  ------------------
  |  Branch (1214:5): [True: 0, False: 1]
  |  Branch (1214:5): [True: 1, False: 0]
  ------------------
 1215|      1|    assert (! scaled_font->global_cache_frozen);
  ------------------
  |  Branch (1215:5): [True: 0, False: 1]
  |  Branch (1215:5): [True: 1, False: 0]
  ------------------
 1216|       |
 1217|      1|    scaled_font->original_font_face =
 1218|      1|	cairo_font_face_reference (original_font_face);
 1219|       |
 1220|      1|    scaled_font->hash_entry.hash = _cairo_scaled_font_compute_hash(scaled_font);
 1221|       |
 1222|      1|    status = _cairo_hash_table_insert (font_map->hash_table,
 1223|      1|				       &scaled_font->hash_entry);
 1224|      1|    if (likely (status == CAIRO_STATUS_SUCCESS)) {
  ------------------
  |  |  144|      1|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 1, False: 0]
  |  |  ------------------
  ------------------
 1225|      1|	old = font_map->mru_scaled_font;
 1226|      1|	font_map->mru_scaled_font = scaled_font;
 1227|      1|	_cairo_reference_count_inc (&scaled_font->ref_count);
  ------------------
  |  |   47|      1|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|      1|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
 1228|      1|    }
 1229|       |
 1230|      1|    _cairo_scaled_font_map_unlock ();
 1231|       |
 1232|      1|    cairo_scaled_font_destroy (old);
 1233|      1|    if (font_face != original_font_face)
  ------------------
  |  Branch (1233:9): [True: 1, False: 0]
  ------------------
 1234|      1|	cairo_font_face_destroy (font_face);
 1235|       |
 1236|      1|    if (dead != NULL)
  ------------------
  |  Branch (1236:9): [True: 0, False: 1]
  ------------------
 1237|      0|	cairo_scaled_font_destroy (dead);
 1238|       |
 1239|      1|    if (unlikely (status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
 1240|       |	/* We can't call _cairo_scaled_font_destroy here since it expects
 1241|       |	 * that the font has already been successfully inserted into the
 1242|       |	 * hash table. */
 1243|      0|	_cairo_scaled_font_fini_internal (scaled_font);
 1244|      0|	free (scaled_font);
 1245|      0|	return _cairo_scaled_font_create_in_error (status);
 1246|      0|    }
 1247|       |
 1248|      1|    return scaled_font;
 1249|      1|}
cairo_scaled_font_destroy:
 1348|    169|{
 1349|    169|    cairo_scaled_font_t *lru = NULL;
 1350|    169|    cairo_scaled_font_map_t *font_map;
 1351|       |
 1352|    169|    assert (CAIRO_MUTEX_IS_UNLOCKED (_cairo_scaled_font_map_mutex));
  ------------------
  |  Branch (1352:5): [True: 0, Folded]
  |  Branch (1352:5): [True: 169, Folded]
  ------------------
 1353|       |
 1354|    169|    if (scaled_font == NULL ||
  ------------------
  |  Branch (1354:9): [True: 85, False: 84]
  ------------------
 1355|     84|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&scaled_font->ref_count))
  ------------------
  |  |   58|     84|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     84|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     84|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1356|     85|	return;
 1357|       |
 1358|    169|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count));
  ------------------
  |  Branch (1358:5): [True: 0, False: 84]
  |  Branch (1358:5): [True: 84, False: 0]
  ------------------
 1359|       |
 1360|     84|    font_map = _cairo_scaled_font_map_lock ();
 1361|     84|    assert (font_map != NULL);
  ------------------
  |  Branch (1361:5): [True: 0, False: 84]
  |  Branch (1361:5): [True: 84, False: 0]
  ------------------
 1362|       |
 1363|     84|    if (! _cairo_reference_count_dec_and_test (&scaled_font->ref_count))
  ------------------
  |  |   49|     84|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|     84|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (1363:9): [True: 84, False: 0]
  ------------------
 1364|     84|	goto unlock;
 1365|       |
 1366|     84|    assert (! scaled_font->cache_frozen);
  ------------------
  |  Branch (1366:5): [True: 0, False: 0]
  |  Branch (1366:5): [True: 0, False: 0]
  ------------------
 1367|      0|    assert (! scaled_font->global_cache_frozen);
  ------------------
  |  Branch (1367:5): [True: 0, False: 0]
  |  Branch (1367:5): [True: 0, False: 0]
  ------------------
 1368|       |
 1369|       |    /* Another thread may have resurrected the font whilst we waited */
 1370|      0|    if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&scaled_font->ref_count)) {
  ------------------
  |  |   60|      0|#define CAIRO_REFERENCE_COUNT_HAS_REFERENCE(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) > 0)
  |  |  ------------------
  |  |  |  |   53|      0|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  ------------------
  |  Branch (1370:9): [True: 0, False: 0]
  ------------------
 1371|      0|	if (! scaled_font->placeholder &&
  ------------------
  |  Branch (1371:6): [True: 0, False: 0]
  ------------------
 1372|      0|	    scaled_font->hash_entry.hash != ZOMBIE)
  ------------------
  |  |  236|      0|#define ZOMBIE 0
  ------------------
  |  Branch (1372:6): [True: 0, False: 0]
  ------------------
 1373|      0|	{
 1374|       |	    /* Another thread may have already inserted us into the holdovers */
 1375|      0|	    if (scaled_font->holdover)
  ------------------
  |  Branch (1375:10): [True: 0, False: 0]
  ------------------
 1376|      0|		goto unlock;
 1377|       |
 1378|       |	    /* Rather than immediately destroying this object, we put it into
 1379|       |	     * the font_map->holdovers array in case it will get used again
 1380|       |	     * soon (and is why we must hold the lock over the atomic op on
 1381|       |	     * the reference count). To make room for it, we do actually
 1382|       |	     * destroy the least-recently-used holdover.
 1383|       |	     */
 1384|       |
 1385|      0|	    if (font_map->num_holdovers == CAIRO_SCALED_FONT_MAX_HOLDOVERS) {
  ------------------
  |  |  361|      0|#define CAIRO_SCALED_FONT_MAX_HOLDOVERS 256
  ------------------
  |  Branch (1385:10): [True: 0, False: 0]
  ------------------
 1386|      0|		lru = font_map->holdovers[0];
 1387|      0|		assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&lru->ref_count));
  ------------------
  |  Branch (1387:3): [True: 0, False: 0]
  |  Branch (1387:3): [True: 0, False: 0]
  ------------------
 1388|       |
 1389|      0|		_cairo_hash_table_remove (font_map->hash_table,
 1390|      0|					  &lru->hash_entry);
 1391|       |
 1392|      0|		font_map->num_holdovers--;
 1393|      0|		memmove (&font_map->holdovers[0],
 1394|      0|			 &font_map->holdovers[1],
 1395|      0|			 font_map->num_holdovers * sizeof (cairo_scaled_font_t*));
 1396|      0|	    }
 1397|       |
 1398|      0|	    font_map->holdovers[font_map->num_holdovers++] = scaled_font;
 1399|      0|	    scaled_font->holdover = TRUE;
  ------------------
  |  |  106|      0|#define TRUE 1
  ------------------
 1400|      0|	} else
 1401|      0|	    lru = scaled_font;
 1402|      0|    }
 1403|       |
 1404|     84|  unlock:
 1405|     84|    _cairo_scaled_font_map_unlock ();
 1406|       |
 1407|       |    /* If we pulled an item from the holdovers array, (while the font
 1408|       |     * map lock was held, of course), then there is no way that anyone
 1409|       |     * else could have acquired a reference to it. So we can now
 1410|       |     * safely call fini on it without any lock held. This is desirable
 1411|       |     * as we never want to call into any backend function with a lock
 1412|       |     * held. */
 1413|     84|    if (lru != NULL) {
  ------------------
  |  Branch (1413:9): [True: 0, False: 84]
  ------------------
 1414|      0|	_cairo_scaled_font_fini_internal (lru);
 1415|      0|	free (lru);
 1416|      0|    }
 1417|     84|}
cairo_scaled_font_text_to_glyphs:
 1996|     84|{
 1997|     84|    int num_chars = 0;
 1998|     84|    cairo_int_status_t status;
 1999|     84|    cairo_glyph_t *orig_glyphs;
 2000|     84|    cairo_text_cluster_t *orig_clusters;
 2001|       |
 2002|     84|    status = scaled_font->status;
 2003|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 2004|      0|	return status;
 2005|       |
 2006|       |    /* A slew of sanity checks */
 2007|       |
 2008|       |    /* glyphs and num_glyphs can't be NULL */
 2009|     84|    if (glyphs     == NULL ||
  ------------------
  |  Branch (2009:9): [True: 0, False: 84]
  ------------------
 2010|     84|	num_glyphs == NULL) {
  ------------------
  |  Branch (2010:2): [True: 0, False: 84]
  ------------------
 2011|      0|	status = _cairo_error (CAIRO_STATUS_NULL_POINTER);
 2012|      0|	goto BAIL;
 2013|      0|    }
 2014|       |
 2015|       |    /* Special case for NULL and -1 */
 2016|     84|    if (utf8 == NULL && utf8_len == -1)
  ------------------
  |  Branch (2016:9): [True: 0, False: 84]
  |  Branch (2016:25): [True: 0, False: 0]
  ------------------
 2017|      0|	utf8_len = 0;
 2018|       |
 2019|       |    /* No NULLs for non-NULLs! */
 2020|     84|    if ((utf8_len && utf8          == NULL) ||
  ------------------
  |  Branch (2020:10): [True: 84, False: 0]
  |  Branch (2020:22): [True: 0, False: 84]
  ------------------
 2021|     84|	(clusters && num_clusters  == NULL) ||
  ------------------
  |  Branch (2021:3): [True: 0, False: 84]
  |  Branch (2021:15): [True: 0, False: 0]
  ------------------
 2022|     84|	(clusters && cluster_flags == NULL)) {
  ------------------
  |  Branch (2022:3): [True: 0, False: 84]
  |  Branch (2022:15): [True: 0, False: 0]
  ------------------
 2023|      0|	status = _cairo_error (CAIRO_STATUS_NULL_POINTER);
 2024|      0|	goto BAIL;
 2025|      0|    }
 2026|       |
 2027|       |    /* A -1 for utf8_len means NUL-terminated */
 2028|     84|    if (utf8_len == -1)
  ------------------
  |  Branch (2028:9): [True: 84, False: 0]
  ------------------
 2029|     84|	utf8_len = strlen (utf8);
 2030|       |
 2031|       |    /* A NULL *glyphs means no prealloced glyphs array */
 2032|     84|    if (glyphs && *glyphs == NULL)
  ------------------
  |  Branch (2032:9): [True: 84, False: 0]
  |  Branch (2032:19): [True: 84, False: 0]
  ------------------
 2033|     84|	*num_glyphs = 0;
 2034|       |
 2035|       |    /* A NULL *clusters means no prealloced clusters array */
 2036|     84|    if (clusters && *clusters == NULL)
  ------------------
  |  Branch (2036:9): [True: 0, False: 84]
  |  Branch (2036:21): [True: 0, False: 0]
  ------------------
 2037|      0|	*num_clusters = 0;
 2038|       |
 2039|     84|    if (!clusters && num_clusters) {
  ------------------
  |  Branch (2039:9): [True: 84, False: 0]
  |  Branch (2039:22): [True: 0, False: 84]
  ------------------
 2040|      0|	num_clusters = NULL;
 2041|      0|    }
 2042|       |
 2043|     84|    if (cluster_flags) {
  ------------------
  |  Branch (2043:9): [True: 0, False: 84]
  ------------------
 2044|      0|	*cluster_flags = FALSE;
  ------------------
  |  |  102|      0|#define FALSE 0
  ------------------
 2045|      0|    }
 2046|       |
 2047|     84|    if (!clusters && cluster_flags) {
  ------------------
  |  Branch (2047:9): [True: 84, False: 0]
  |  Branch (2047:22): [True: 0, False: 84]
  ------------------
 2048|      0|	cluster_flags = NULL;
 2049|      0|    }
 2050|       |
 2051|       |    /* Apart from that, no negatives */
 2052|     84|    if (utf8_len < 0 ||
  ------------------
  |  Branch (2052:9): [True: 0, False: 84]
  ------------------
 2053|     84|	*num_glyphs < 0 ||
  ------------------
  |  Branch (2053:2): [True: 0, False: 84]
  ------------------
 2054|     84|	(num_clusters && *num_clusters < 0)) {
  ------------------
  |  Branch (2054:3): [True: 0, False: 84]
  |  Branch (2054:19): [True: 0, False: 0]
  ------------------
 2055|      0|	status = _cairo_error (CAIRO_STATUS_NEGATIVE_COUNT);
 2056|      0|	goto BAIL;
 2057|      0|    }
 2058|       |
 2059|     84|    if (utf8_len == 0) {
  ------------------
  |  Branch (2059:9): [True: 0, False: 84]
  ------------------
 2060|      0|	status = CAIRO_STATUS_SUCCESS;
 2061|      0|	goto BAIL;
 2062|      0|    }
 2063|       |
 2064|       |    /* validate input so backend does not have to */
 2065|     84|    status = _cairo_utf8_to_ucs4 (utf8, utf8_len, NULL, &num_chars);
 2066|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 84, False: 0]
  |  |  ------------------
  ------------------
 2067|     84|	goto BAIL;
 2068|       |
 2069|      0|    _cairo_scaled_font_freeze_cache (scaled_font);
 2070|       |
 2071|      0|    orig_glyphs = *glyphs;
 2072|      0|    orig_clusters = clusters ? *clusters : NULL;
  ------------------
  |  Branch (2072:21): [True: 0, False: 0]
  ------------------
 2073|       |
 2074|      0|    if (scaled_font->backend->text_to_glyphs) {
  ------------------
  |  Branch (2074:9): [True: 0, False: 0]
  ------------------
 2075|      0|	status = scaled_font->backend->text_to_glyphs (scaled_font, x, y,
 2076|      0|						       utf8, utf8_len,
 2077|      0|						       glyphs, num_glyphs,
 2078|      0|						       clusters, num_clusters,
 2079|      0|						       cluster_flags);
 2080|      0|        if (status != CAIRO_INT_STATUS_UNSUPPORTED) {
  ------------------
  |  Branch (2080:13): [True: 0, False: 0]
  ------------------
 2081|      0|	    if (status == CAIRO_INT_STATUS_SUCCESS) {
  ------------------
  |  Branch (2081:10): [True: 0, False: 0]
  ------------------
 2082|       |	        /* The checks here are crude; we only should do them in
 2083|       |		 * user-font backend, but they don't hurt here.  This stuff
 2084|       |		 * can be hard to get right. */
 2085|       |
 2086|      0|	        if (*num_glyphs < 0) {
  ------------------
  |  Branch (2086:14): [True: 0, False: 0]
  ------------------
 2087|      0|		    status = _cairo_error (CAIRO_STATUS_NEGATIVE_COUNT);
 2088|      0|		    goto DONE;
 2089|      0|		}
 2090|      0|		if (*num_glyphs != 0 && *glyphs == NULL) {
  ------------------
  |  Branch (2090:7): [True: 0, False: 0]
  |  Branch (2090:27): [True: 0, False: 0]
  ------------------
 2091|      0|		    status = _cairo_error (CAIRO_STATUS_NULL_POINTER);
 2092|      0|		    goto DONE;
 2093|      0|		}
 2094|       |
 2095|      0|		if (clusters) {
  ------------------
  |  Branch (2095:7): [True: 0, False: 0]
  ------------------
 2096|      0|		    if (*num_clusters < 0) {
  ------------------
  |  Branch (2096:11): [True: 0, False: 0]
  ------------------
 2097|      0|			status = _cairo_error (CAIRO_STATUS_NEGATIVE_COUNT);
 2098|      0|			goto DONE;
 2099|      0|		    }
 2100|      0|		    if (*num_clusters != 0 && *clusters == NULL) {
  ------------------
  |  Branch (2100:11): [True: 0, False: 0]
  |  Branch (2100:33): [True: 0, False: 0]
  ------------------
 2101|      0|			status = _cairo_error (CAIRO_STATUS_NULL_POINTER);
 2102|      0|			goto DONE;
 2103|      0|		    }
 2104|       |
 2105|       |		    /* Don't trust the backend, validate clusters! */
 2106|      0|		    status =
 2107|      0|			_cairo_validate_text_clusters (utf8, utf8_len,
 2108|      0|						       *glyphs, *num_glyphs,
 2109|      0|						       *clusters, *num_clusters,
 2110|      0|						       *cluster_flags);
 2111|      0|		}
 2112|      0|	    }
 2113|       |
 2114|      0|            goto DONE;
 2115|      0|	}
 2116|      0|    }
 2117|       |
 2118|      0|    if (*num_glyphs < num_chars) {
  ------------------
  |  Branch (2118:9): [True: 0, False: 0]
  ------------------
 2119|      0|	*glyphs = cairo_glyph_allocate (num_chars);
 2120|      0|	if (unlikely (*glyphs == NULL)) {
  ------------------
  |  |  145|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2121|      0|	    status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 2122|      0|	    goto DONE;
 2123|      0|	}
 2124|      0|    }
 2125|      0|    *num_glyphs = num_chars;
 2126|       |
 2127|      0|    if (clusters) {
  ------------------
  |  Branch (2127:9): [True: 0, False: 0]
  ------------------
 2128|      0|	if (*num_clusters < num_chars) {
  ------------------
  |  Branch (2128:6): [True: 0, False: 0]
  ------------------
 2129|      0|	    *clusters = cairo_text_cluster_allocate (num_chars);
 2130|      0|	    if (unlikely (*clusters == NULL)) {
  ------------------
  |  |  145|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2131|      0|		status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
 2132|      0|		goto DONE;
 2133|      0|	    }
 2134|      0|	}
 2135|      0|	*num_clusters = num_chars;
 2136|      0|    }
 2137|       |
 2138|      0|    if (num_chars > CACHING_THRESHOLD)
  ------------------
  |  | 1984|      0|#define CACHING_THRESHOLD 16
  ------------------
  |  Branch (2138:9): [True: 0, False: 0]
  ------------------
 2139|      0|	status = cairo_scaled_font_text_to_glyphs_internal_cached (scaled_font,
 2140|      0|								     x, y,
 2141|      0|								     utf8,
 2142|      0|								     *glyphs,
 2143|      0|								     clusters,
 2144|      0|								     num_chars);
 2145|      0|    else
 2146|      0|	status = cairo_scaled_font_text_to_glyphs_internal_uncached (scaled_font,
 2147|      0|								   x, y,
 2148|      0|								   utf8,
 2149|      0|								   *glyphs,
 2150|      0|								   clusters,
 2151|      0|								   num_chars);
 2152|       |
 2153|      0| DONE: /* error that should be logged on scaled_font happened */
 2154|      0|    _cairo_scaled_font_thaw_cache (scaled_font);
 2155|       |
 2156|      0|    if (unlikely (status)) {
  ------------------
  |  |  145|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 2157|      0|	*num_glyphs = 0;
 2158|      0|	if (*glyphs != orig_glyphs) {
  ------------------
  |  Branch (2158:6): [True: 0, False: 0]
  ------------------
 2159|      0|	    cairo_glyph_free (*glyphs);
 2160|      0|	    *glyphs = orig_glyphs;
 2161|      0|	}
 2162|       |
 2163|      0|	if (clusters) {
  ------------------
  |  Branch (2163:6): [True: 0, False: 0]
  ------------------
 2164|      0|	    *num_clusters = 0;
 2165|      0|	    if (*clusters != orig_clusters) {
  ------------------
  |  Branch (2165:10): [True: 0, False: 0]
  ------------------
 2166|      0|		cairo_text_cluster_free (*clusters);
 2167|      0|		*clusters = orig_clusters;
 2168|      0|	    }
 2169|      0|	}
 2170|      0|    }
 2171|       |
 2172|      0|    return _cairo_scaled_font_set_error (scaled_font, status);
 2173|       |
 2174|     84| BAIL: /* error with input arguments */
 2175|       |
 2176|     84|    if (num_glyphs)
  ------------------
  |  Branch (2176:9): [True: 84, False: 0]
  ------------------
 2177|     84|	*num_glyphs = 0;
 2178|       |
 2179|     84|    if (num_clusters)
  ------------------
  |  Branch (2179:9): [True: 0, False: 84]
  ------------------
 2180|      0|	*num_clusters = 0;
 2181|       |
 2182|     84|    return status;
 2183|      0|}
cairo-scaled-font.c:_cairo_scaled_font_compute_hash:
  641|      2|{
  642|      2|    uint64_t hash = FNV1_64_INIT;
  ------------------
  |  |  612|      2|#define FNV1_64_INIT ((uint64_t)0xcbf29ce484222325)
  ------------------
  643|       |
  644|       |    /* We do a bytewise hash on the font matrices */
  645|      2|    hash = _hash_matrix_fnv (&scaled_font->font_matrix, hash);
  646|      2|    hash = _hash_matrix_fnv (&scaled_font->ctm, hash);
  647|      2|    hash = _hash_mix_bits (hash);
  648|       |
  649|      2|    hash ^= (uintptr_t) scaled_font->original_font_face;
  650|      2|    hash ^= cairo_font_options_hash (&scaled_font->options);
  651|       |
  652|       |    /* final mixing of bits */
  653|      2|    hash = _hash_mix_bits (hash);
  654|      2|    assert (hash != ZOMBIE);
  ------------------
  |  Branch (654:5): [True: 0, False: 2]
  |  Branch (654:5): [True: 2, False: 0]
  ------------------
  655|       |
  656|      2|    return hash;
  657|      2|}
cairo-scaled-font.c:_hash_matrix_fnv:
  617|      4|{
  618|      4|    const uint8_t *buffer = (const uint8_t *) matrix;
  619|      4|    int len = sizeof (cairo_matrix_t);
  620|    192|    do {
  621|    192|	hval *= FNV_64_PRIME;
  ------------------
  |  |  611|    192|#define FNV_64_PRIME ((uint64_t)0x00000100000001B3)
  ------------------
  622|    192|	hval ^= *buffer++;
  623|    192|    } while (--len);
  ------------------
  |  Branch (623:14): [True: 188, False: 4]
  ------------------
  624|       |
  625|      4|    return hval;
  626|      4|}
cairo-scaled-font.c:_hash_mix_bits:
  630|      4|{
  631|      4|    hash += hash << 12;
  632|      4|    hash ^= hash >> 7;
  633|      4|    hash += hash << 3;
  634|      4|    hash ^= hash >> 17;
  635|      4|    hash += hash << 5;
  636|      4|    return hash;
  637|      4|}
cairo-scaled-font.c:_cairo_scaled_font_map_lock:
  377|    168|{
  378|    168|    CAIRO_MUTEX_LOCK (_cairo_scaled_font_map_mutex);
  ------------------
  |  |  175|    168|#define CAIRO_MUTEX_LOCK		CAIRO_MUTEX_IMPL_LOCK
  |  |  ------------------
  |  |  |  |  206|    168|# define CAIRO_MUTEX_IMPL_LOCK(mutex) pthread_mutex_lock (&(mutex))
  |  |  ------------------
  ------------------
  379|       |
  380|    168|    if (cairo_scaled_font_map == NULL) {
  ------------------
  |  Branch (380:9): [True: 1, False: 167]
  ------------------
  381|      1|	cairo_scaled_font_map = _cairo_calloc (sizeof (cairo_scaled_font_map_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
  382|      1|	if (unlikely (cairo_scaled_font_map == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  383|      0|	    goto CLEANUP_MUTEX_LOCK;
  384|       |
  385|      1|	cairo_scaled_font_map->mru_scaled_font = NULL;
  386|      1|	cairo_scaled_font_map->hash_table =
  387|      1|	    _cairo_hash_table_create (_cairo_scaled_font_keys_equal);
  388|       |
  389|      1|	if (unlikely (cairo_scaled_font_map->hash_table == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  390|      0|	    goto CLEANUP_SCALED_FONT_MAP;
  391|       |
  392|      1|	cairo_scaled_font_map->num_holdovers = 0;
  393|      1|    }
  394|       |
  395|    168|    return cairo_scaled_font_map;
  396|       |
  397|      0| CLEANUP_SCALED_FONT_MAP:
  398|      0|    free (cairo_scaled_font_map);
  399|      0|    cairo_scaled_font_map = NULL;
  400|      0| CLEANUP_MUTEX_LOCK:
  401|      0|    CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
  ------------------
  |  |  177|      0|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|      0|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  402|      0|    _cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  403|       |    return NULL;
  404|      0|}
cairo-scaled-font.c:_cairo_scaled_font_matches:
  711|     83|{
  712|     83|    return scaled_font->original_font_face == font_face &&
  ------------------
  |  Branch (712:12): [True: 83, False: 0]
  ------------------
  713|     83|	    memcmp ((unsigned char *)(&scaled_font->font_matrix.xx),
  ------------------
  |  Branch (713:6): [True: 83, False: 0]
  ------------------
  714|     83|		    (unsigned char *)(&font_matrix->xx),
  715|     83|		    sizeof(cairo_matrix_t)) == 0 &&
  716|     83|	    memcmp ((unsigned char *)(&scaled_font->ctm.xx),
  ------------------
  |  Branch (716:6): [True: 83, False: 0]
  ------------------
  717|     83|		    (unsigned char *)(&ctm->xx),
  718|     83|		    sizeof(cairo_matrix_t)) == 0 &&
  719|     83|	    cairo_font_options_equal (&scaled_font->options, options);
  ------------------
  |  Branch (719:6): [True: 83, False: 0]
  ------------------
  720|     83|}
cairo-scaled-font.c:_cairo_scaled_font_map_unlock:
  408|    168|{
  409|    168|   CAIRO_MUTEX_UNLOCK (_cairo_scaled_font_map_mutex);
  ------------------
  |  |  177|    168|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|    168|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  410|    168|}
cairo-scaled-font.c:_cairo_scaled_font_init_key:
  665|      1|{
  666|      1|    scaled_font->status = CAIRO_STATUS_SUCCESS;
  667|      1|    scaled_font->placeholder = FALSE;
  ------------------
  |  |  102|      1|#define FALSE 0
  ------------------
  668|      1|    scaled_font->font_face = font_face;
  669|      1|    scaled_font->original_font_face = font_face;
  670|      1|    scaled_font->font_matrix = *font_matrix;
  671|      1|    scaled_font->ctm = *ctm;
  672|       |    /* ignore translation values in the ctm */
  673|      1|    scaled_font->ctm.x0 = 0.;
  674|      1|    scaled_font->ctm.y0 = 0.;
  675|      1|    _cairo_font_options_init_copy (&scaled_font->options, options);
  676|       |
  677|      1|    scaled_font->hash_entry.hash =
  678|      1|	_cairo_scaled_font_compute_hash (scaled_font);
  679|      1|}
cairo-scaled-font.c:_cairo_scaled_font_fini_key:
  683|      1|{
  684|      1|    _cairo_font_options_fini (&scaled_font->options);
  685|      1|}

_cairo_shape_mask_compositor_init:
  332|      1|{
  333|      1|    compositor->delegate = delegate;
  334|       |
  335|      1|    compositor->paint  = NULL;
  336|       |    compositor->mask   = NULL;
  337|      1|    compositor->fill   = _cairo_shape_mask_compositor_fill;
  338|      1|    compositor->stroke = _cairo_shape_mask_compositor_stroke;
  339|      1|    compositor->glyphs = _cairo_shape_mask_compositor_glyphs;
  340|      1|}

_cairo_spans_compositor_init:
 1193|      1|{
 1194|      1|    compositor->base.delegate = delegate;
 1195|       |
 1196|      1|    compositor->base.paint  = _cairo_spans_compositor_paint;
 1197|      1|    compositor->base.mask   = _cairo_spans_compositor_mask;
 1198|      1|    compositor->base.fill   = _cairo_spans_compositor_fill;
 1199|      1|    compositor->base.stroke = _cairo_spans_compositor_stroke;
 1200|       |    compositor->base.glyphs = NULL;
 1201|      1|}

_cairo_stroke_style_init:
   41|     84|{
   42|     84|    VG (VALGRIND_MAKE_MEM_UNDEFINED (style, sizeof (cairo_stroke_style_t)));
   43|       |
   44|     84|    style->line_width = CAIRO_GSTATE_LINE_WIDTH_DEFAULT;
  ------------------
  |  |  725|     84|#define CAIRO_GSTATE_LINE_WIDTH_DEFAULT	2.0
  ------------------
   45|     84|    style->line_cap = CAIRO_GSTATE_LINE_CAP_DEFAULT;
  ------------------
  |  |  726|     84|#define CAIRO_GSTATE_LINE_CAP_DEFAULT	CAIRO_LINE_CAP_BUTT
  ------------------
   46|     84|    style->line_join = CAIRO_GSTATE_LINE_JOIN_DEFAULT;
  ------------------
  |  |  727|     84|#define CAIRO_GSTATE_LINE_JOIN_DEFAULT	CAIRO_LINE_JOIN_MITER
  ------------------
   47|     84|    style->miter_limit = CAIRO_GSTATE_MITER_LIMIT_DEFAULT;
  ------------------
  |  |  728|     84|#define CAIRO_GSTATE_MITER_LIMIT_DEFAULT	10.0
  ------------------
   48|       |
   49|     84|    style->dash = NULL;
   50|     84|    style->num_dashes = 0;
   51|     84|    style->dash_offset = 0.0;
   52|       |
   53|     84|    style->is_hairline = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
   54|     84|}
_cairo_stroke_style_fini:
   92|     84|{
   93|     84|    free (style->dash);
   94|     84|    style->dash = NULL;
   95|       |
   96|     84|    style->num_dashes = 0;
   97|       |
   98|     84|    VG (VALGRIND_MAKE_MEM_UNDEFINED (style, sizeof (cairo_stroke_style_t)));
   99|     84|}

cairo-surface.c:__cairo_surface_flush:
   45|     84|{
   46|     84|    cairo_status_t status = CAIRO_STATUS_SUCCESS;
   47|     84|    if (surface->backend->flush)
  ------------------
  |  Branch (47:9): [True: 0, False: 84]
  ------------------
   48|      0|	status = surface->backend->flush (surface, flags);
   49|     84|    return status;
   50|     84|}

cairo_surface_status:
  266|    419|{
  267|    419|    return surface->status;
  268|    419|}
_cairo_surface_init:
  412|     84|{
  413|     84|    CAIRO_MUTEX_INITIALIZE ();
  ------------------
  |  |  173|     84|#define CAIRO_MUTEX_INITIALIZE		CAIRO_MUTEX_IMPL_INITIALIZE
  |  |  ------------------
  |  |  |  |   88|     84|#  define CAIRO_MUTEX_IMPL_INITIALIZE() CAIRO_MUTEX_IMPL_NOOP
  |  |  |  |  ------------------
  |  |  |  |  |  |   53|     84|#define CAIRO_MUTEX_IMPL_NOOP	do {/*no-op*/} while (0)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  Branch (53:53): [Folded, False: 84]
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  414|       |
  415|     84|    surface->backend = backend;
  416|     84|    surface->device = cairo_device_reference (device);
  417|     84|    surface->content = content;
  418|     84|    surface->type = backend->type;
  419|     84|    surface->is_vector = is_vector;
  420|       |
  421|     84|    CAIRO_REFERENCE_COUNT_INIT (&surface->ref_count, 1);
  ------------------
  |  |   51|     84|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  422|     84|    surface->status = CAIRO_STATUS_SUCCESS;
  423|     84|    surface->unique_id = _cairo_surface_allocate_unique_id ();
  424|     84|    surface->finished = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
  425|     84|    surface->_finishing = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
  426|     84|    surface->is_clear = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
  427|     84|    surface->serial = 0;
  428|     84|    surface->damage = NULL;
  429|     84|    surface->owns_device = (device != NULL);
  430|       |
  431|     84|    _cairo_user_data_array_init (&surface->user_data);
  432|     84|    _cairo_user_data_array_init (&surface->mime_data);
  433|       |
  434|     84|    cairo_matrix_init_identity (&surface->device_transform);
  435|     84|    cairo_matrix_init_identity (&surface->device_transform_inverse);
  436|     84|    cairo_list_init (&surface->device_transform_observers);
  437|       |
  438|     84|    surface->x_resolution = CAIRO_SURFACE_RESOLUTION_DEFAULT;
  ------------------
  |  |  731|     84|#define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0
  ------------------
  439|     84|    surface->y_resolution = CAIRO_SURFACE_RESOLUTION_DEFAULT;
  ------------------
  |  |  731|     84|#define CAIRO_SURFACE_RESOLUTION_DEFAULT 72.0
  ------------------
  440|       |
  441|     84|    surface->x_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT;
  ------------------
  |  |  732|     84|#define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0
  ------------------
  442|     84|    surface->y_fallback_resolution = CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT;
  ------------------
  |  |  732|     84|#define CAIRO_SURFACE_FALLBACK_RESOLUTION_DEFAULT 300.0
  ------------------
  443|       |
  444|     84|    cairo_list_init (&surface->snapshots);
  445|     84|    surface->snapshot_of = NULL;
  446|       |
  447|     84|    surface->has_font_options = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
  448|       |
  449|     84|    surface->foreground_source = NULL;
  450|     84|    surface->foreground_used = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
  451|     84|}
cairo_surface_reference:
  934|    168|{
  935|    168|    if (surface == NULL ||
  ------------------
  |  Branch (935:9): [True: 0, False: 168]
  ------------------
  936|    168|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
  ------------------
  |  |   58|    168|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|    168|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|    168|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 168]
  |  |  ------------------
  ------------------
  937|      0|	return surface;
  938|       |
  939|    168|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
  ------------------
  |  Branch (939:5): [True: 0, False: 168]
  |  Branch (939:5): [True: 168, False: 0]
  ------------------
  940|       |
  941|    168|    _cairo_reference_count_inc (&surface->ref_count);
  ------------------
  |  |   47|    168|#define _cairo_reference_count_inc(RC) _cairo_atomic_int_inc (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   83|    168|# define _cairo_atomic_int_inc(x) ((void) atomic_fetch_add_explicit(x, 1, memory_order_seq_cst))
  |  |  ------------------
  ------------------
  942|       |
  943|    168|    return surface;
  944|    168|}
cairo_surface_destroy:
  958|    336|{
  959|    336|    if (surface == NULL ||
  ------------------
  |  Branch (959:9): [True: 84, False: 252]
  ------------------
  960|    252|	    CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
  ------------------
  |  |   58|    252|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|    252|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|    252|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 252]
  |  |  ------------------
  ------------------
  961|     84|	return;
  962|       |
  963|    336|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
  ------------------
  |  Branch (963:5): [True: 0, False: 252]
  |  Branch (963:5): [True: 252, False: 0]
  ------------------
  964|       |
  965|    252|    if (! _cairo_reference_count_dec_and_test (&surface->ref_count))
  ------------------
  |  |   49|    252|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|    252|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (965:9): [True: 168, False: 84]
  ------------------
  966|    168|	return;
  967|       |
  968|    252|    assert (surface->snapshot_of == NULL);
  ------------------
  |  Branch (968:5): [True: 0, False: 84]
  |  Branch (968:5): [True: 84, False: 0]
  ------------------
  969|       |
  970|     84|    if (! surface->finished) {
  ------------------
  |  Branch (970:9): [True: 84, False: 0]
  ------------------
  971|     84|	_cairo_surface_finish_snapshots (surface);
  972|       |	/* We may have been referenced by a snapshot prior to have
  973|       |	 * detaching it with the copy-on-write.
  974|       |	 */
  975|     84|	if (CAIRO_REFERENCE_COUNT_GET_VALUE (&surface->ref_count))
  ------------------
  |  |   53|     84|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  Branch (53:45): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  976|      0|	    return;
  977|       |
  978|     84|	_cairo_surface_finish (surface);
  979|     84|    }
  980|       |
  981|     84|    if (surface->damage)
  ------------------
  |  Branch (981:9): [True: 0, False: 84]
  ------------------
  982|      0|	_cairo_damage_destroy (surface->damage);
  983|       |
  984|     84|    _cairo_user_data_array_fini (&surface->user_data);
  985|     84|    _cairo_user_data_array_fini (&surface->mime_data);
  986|       |
  987|     84|    if (surface->foreground_source)
  ------------------
  |  Branch (987:9): [True: 0, False: 84]
  ------------------
  988|      0|	cairo_pattern_destroy (surface->foreground_source);
  989|       |
  990|     84|    if (surface->owns_device)
  ------------------
  |  Branch (990:9): [True: 0, False: 84]
  ------------------
  991|      0|        cairo_device_destroy (surface->device);
  992|       |
  993|     84|    if (surface->has_font_options)
  ------------------
  |  Branch (993:9): [True: 84, False: 0]
  ------------------
  994|     84|	_cairo_font_options_fini (&surface->font_options);
  995|       |
  996|     84|    assert (surface->snapshot_of == NULL);
  ------------------
  |  Branch (996:5): [True: 0, False: 84]
  |  Branch (996:5): [True: 84, False: 0]
  ------------------
  997|     84|    assert (! _cairo_surface_has_snapshots (surface));
  ------------------
  |  Branch (997:5): [True: 0, False: 84]
  |  Branch (997:5): [True: 84, False: 0]
  ------------------
  998|       |    /* paranoid check that nobody took a reference whilst finishing */
  999|     84|    assert (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count));
  ------------------
  |  Branch (999:5): [True: 0, False: 84]
  |  Branch (999:5): [True: 84, False: 0]
  ------------------
 1000|       |
 1001|     84|    free (surface);
 1002|     84|}
cairo_surface_set_mime_data:
 1432|     84|{
 1433|     84|    cairo_status_t status;
 1434|     84|    cairo_mime_data_t *mime_data;
 1435|       |
 1436|     84|    if (CAIRO_REFERENCE_COUNT_IS_INVALID (&surface->ref_count))
  ------------------
  |  |   58|     84|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     84|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     84|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1437|      0|	return surface->status;
 1438|       |
 1439|     84|    if (! CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&surface->ref_count))
  ------------------
  |  |   60|     84|#define CAIRO_REFERENCE_COUNT_HAS_REFERENCE(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) > 0)
  |  |  ------------------
  |  |  |  |   53|     84|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  ------------------
  |  Branch (1439:9): [True: 0, False: 84]
  ------------------
 1440|      0|	return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
 1441|       |
 1442|     84|    if (unlikely (surface->status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1443|      0|	return surface->status;
 1444|     84|    if (unlikely (surface->finished))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1445|      0|	return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
 1446|       |
 1447|     84|    status = _cairo_intern_string (&mime_type, -1);
 1448|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1449|      0|	return _cairo_surface_set_error (surface, status);
 1450|       |
 1451|     84|    if (data != NULL) {
  ------------------
  |  Branch (1451:9): [True: 84, False: 0]
  ------------------
 1452|     84|	mime_data = _cairo_calloc (sizeof (cairo_mime_data_t));
  ------------------
  |  |   79|     84|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 84, Folded]
  |  |  ------------------
  ------------------
 1453|     84|	if (unlikely (mime_data == NULL))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1454|      0|	    return _cairo_surface_set_error (surface, _cairo_error (CAIRO_STATUS_NO_MEMORY));
 1455|       |
 1456|     84|	CAIRO_REFERENCE_COUNT_INIT (&mime_data->ref_count, 1);
  ------------------
  |  |   51|     84|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
 1457|       |
 1458|     84|	mime_data->data = (unsigned char *) data;
 1459|     84|	mime_data->length = length;
 1460|     84|	mime_data->destroy = destroy;
 1461|     84|	mime_data->closure = closure;
 1462|     84|    } else
 1463|      0|	mime_data = NULL;
 1464|       |
 1465|     84|    status = _cairo_user_data_array_set_data (&surface->mime_data,
 1466|     84|					      (cairo_user_data_key_t *) mime_type,
 1467|     84|					      mime_data,
 1468|     84|					      _cairo_mime_data_destroy);
 1469|     84|    if (unlikely (status)) {
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1470|      0|	free (mime_data);
 1471|       |
 1472|      0|	return _cairo_surface_set_error (surface, status);
 1473|      0|    }
 1474|       |
 1475|     84|    surface->is_clear = FALSE;
  ------------------
  |  |  102|     84|#define FALSE 0
  ------------------
 1476|       |
 1477|     84|    return CAIRO_STATUS_SUCCESS;
 1478|     84|}
cairo_surface_get_font_options:
 1608|     84|{
 1609|     84|    if (cairo_font_options_status (options))
  ------------------
  |  Branch (1609:9): [True: 0, False: 84]
  ------------------
 1610|      0|	return;
 1611|       |
 1612|     84|    if (surface->status) {
  ------------------
  |  Branch (1612:9): [True: 0, False: 84]
  ------------------
 1613|      0|	_cairo_font_options_init_default (options);
 1614|      0|	return;
 1615|      0|    }
 1616|       |
 1617|     84|    if (! surface->has_font_options) {
  ------------------
  |  Branch (1617:9): [True: 84, False: 0]
  ------------------
 1618|     84|	surface->has_font_options = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
 1619|       |
 1620|     84|	_cairo_font_options_init_default (&surface->font_options);
 1621|       |
 1622|     84|	if (!surface->finished && surface->backend->get_font_options) {
  ------------------
  |  Branch (1622:6): [True: 84, False: 0]
  |  Branch (1622:28): [True: 84, False: 0]
  ------------------
 1623|     84|	    surface->backend->get_font_options (surface, &surface->font_options);
 1624|     84|	}
 1625|     84|    }
 1626|       |
 1627|     84|    _cairo_font_options_init_copy (options, &surface->font_options);
 1628|     84|}
_cairo_surface_flush:
 1632|     84|{
 1633|       |    /* update the current snapshots *before* the user updates the surface */
 1634|     84|    _cairo_surface_detach_snapshots (surface);
 1635|     84|    if (surface->snapshot_of != NULL)
  ------------------
  |  Branch (1635:9): [True: 0, False: 84]
  ------------------
 1636|      0|	_cairo_surface_detach_snapshot (surface);
 1637|     84|    _cairo_surface_detach_mime_data (surface);
 1638|       |
 1639|     84|    return __cairo_surface_flush (surface, flags);
 1640|     84|}
_cairo_surface_create_in_error:
 3106|    335|{
 3107|    335|    assert (status < CAIRO_STATUS_LAST_STATUS);
  ------------------
  |  Branch (3107:5): [True: 0, False: 335]
  |  Branch (3107:5): [True: 335, False: 0]
  ------------------
 3108|    335|    switch (status) {
 3109|      0|    case CAIRO_STATUS_NO_MEMORY:
  ------------------
  |  Branch (3109:5): [True: 0, False: 335]
  ------------------
 3110|      0|	return (cairo_surface_t *) &_cairo_surface_nil;
 3111|      0|    case CAIRO_STATUS_SURFACE_TYPE_MISMATCH:
  ------------------
  |  Branch (3111:5): [True: 0, False: 335]
  ------------------
 3112|      0|	return (cairo_surface_t *) &_cairo_surface_nil_surface_type_mismatch;
 3113|      0|    case CAIRO_STATUS_INVALID_STATUS:
  ------------------
  |  Branch (3113:5): [True: 0, False: 335]
  ------------------
 3114|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_status;
 3115|      0|    case CAIRO_STATUS_INVALID_CONTENT:
  ------------------
  |  Branch (3115:5): [True: 0, False: 335]
  ------------------
 3116|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_content;
 3117|      0|    case CAIRO_STATUS_INVALID_FORMAT:
  ------------------
  |  Branch (3117:5): [True: 0, False: 335]
  ------------------
 3118|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_format;
 3119|      0|    case CAIRO_STATUS_INVALID_VISUAL:
  ------------------
  |  Branch (3119:5): [True: 0, False: 335]
  ------------------
 3120|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_visual;
 3121|    236|    case CAIRO_STATUS_READ_ERROR:
  ------------------
  |  Branch (3121:5): [True: 236, False: 99]
  ------------------
 3122|    236|	return (cairo_surface_t *) &_cairo_surface_nil_read_error;
 3123|      0|    case CAIRO_STATUS_WRITE_ERROR:
  ------------------
  |  Branch (3123:5): [True: 0, False: 335]
  ------------------
 3124|      0|	return (cairo_surface_t *) &_cairo_surface_nil_write_error;
 3125|      0|    case CAIRO_STATUS_FILE_NOT_FOUND:
  ------------------
  |  Branch (3125:5): [True: 0, False: 335]
  ------------------
 3126|      0|	return (cairo_surface_t *) &_cairo_surface_nil_file_not_found;
 3127|      0|    case CAIRO_STATUS_TEMP_FILE_ERROR:
  ------------------
  |  Branch (3127:5): [True: 0, False: 335]
  ------------------
 3128|      0|	return (cairo_surface_t *) &_cairo_surface_nil_temp_file_error;
 3129|      0|    case CAIRO_STATUS_INVALID_STRIDE:
  ------------------
  |  Branch (3129:5): [True: 0, False: 335]
  ------------------
 3130|      0|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_stride;
 3131|      2|    case CAIRO_STATUS_INVALID_SIZE:
  ------------------
  |  Branch (3131:5): [True: 2, False: 333]
  ------------------
 3132|      2|	return (cairo_surface_t *) &_cairo_surface_nil_invalid_size;
 3133|      0|    case CAIRO_STATUS_DEVICE_TYPE_MISMATCH:
  ------------------
  |  Branch (3133:5): [True: 0, False: 335]
  ------------------
 3134|      0|	return (cairo_surface_t *) &_cairo_surface_nil_device_type_mismatch;
 3135|      0|    case CAIRO_STATUS_DEVICE_ERROR:
  ------------------
  |  Branch (3135:5): [True: 0, False: 335]
  ------------------
 3136|      0|	return (cairo_surface_t *) &_cairo_surface_nil_device_error;
 3137|     97|    case CAIRO_STATUS_PNG_ERROR:
  ------------------
  |  Branch (3137:5): [True: 97, False: 238]
  ------------------
 3138|     97|	return (cairo_surface_t *) &_cairo_surface_nil_png_error;
 3139|      0|    case CAIRO_STATUS_SUCCESS:
  ------------------
  |  Branch (3139:5): [True: 0, False: 335]
  ------------------
 3140|      0|    case CAIRO_STATUS_LAST_STATUS:
  ------------------
  |  Branch (3140:5): [True: 0, False: 335]
  ------------------
 3141|      0|	ASSERT_NOT_REACHED;
  ------------------
  |  |  140|      0|#define ASSERT_NOT_REACHED		\
  |  |  141|      0|do {					\
  |  |  142|      0|    assert (!"reached");		\
  |  |  143|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (143:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (3141:2): [Folded, False: 0]
  |  Branch (3141:2): [Folded, False: 0]
  ------------------
 3142|       |	/* fall-through */
 3143|      0|    case CAIRO_STATUS_INVALID_RESTORE:
  ------------------
  |  Branch (3143:5): [True: 0, False: 335]
  ------------------
 3144|      0|    case CAIRO_STATUS_INVALID_POP_GROUP:
  ------------------
  |  Branch (3144:5): [True: 0, False: 335]
  ------------------
 3145|      0|    case CAIRO_STATUS_NO_CURRENT_POINT:
  ------------------
  |  Branch (3145:5): [True: 0, False: 335]
  ------------------
 3146|      0|    case CAIRO_STATUS_INVALID_MATRIX:
  ------------------
  |  Branch (3146:5): [True: 0, False: 335]
  ------------------
 3147|      0|    case CAIRO_STATUS_NULL_POINTER:
  ------------------
  |  Branch (3147:5): [True: 0, False: 335]
  ------------------
 3148|      0|    case CAIRO_STATUS_INVALID_STRING:
  ------------------
  |  Branch (3148:5): [True: 0, False: 335]
  ------------------
 3149|      0|    case CAIRO_STATUS_INVALID_PATH_DATA:
  ------------------
  |  Branch (3149:5): [True: 0, False: 335]
  ------------------
 3150|      0|    case CAIRO_STATUS_SURFACE_FINISHED:
  ------------------
  |  Branch (3150:5): [True: 0, False: 335]
  ------------------
 3151|      0|    case CAIRO_STATUS_PATTERN_TYPE_MISMATCH:
  ------------------
  |  Branch (3151:5): [True: 0, False: 335]
  ------------------
 3152|      0|    case CAIRO_STATUS_INVALID_DASH:
  ------------------
  |  Branch (3152:5): [True: 0, False: 335]
  ------------------
 3153|      0|    case CAIRO_STATUS_INVALID_DSC_COMMENT:
  ------------------
  |  Branch (3153:5): [True: 0, False: 335]
  ------------------
 3154|      0|    case CAIRO_STATUS_INVALID_INDEX:
  ------------------
  |  Branch (3154:5): [True: 0, False: 335]
  ------------------
 3155|      0|    case CAIRO_STATUS_CLIP_NOT_REPRESENTABLE:
  ------------------
  |  Branch (3155:5): [True: 0, False: 335]
  ------------------
 3156|      0|    case CAIRO_STATUS_FONT_TYPE_MISMATCH:
  ------------------
  |  Branch (3156:5): [True: 0, False: 335]
  ------------------
 3157|      0|    case CAIRO_STATUS_USER_FONT_IMMUTABLE:
  ------------------
  |  Branch (3157:5): [True: 0, False: 335]
  ------------------
 3158|      0|    case CAIRO_STATUS_USER_FONT_ERROR:
  ------------------
  |  Branch (3158:5): [True: 0, False: 335]
  ------------------
 3159|      0|    case CAIRO_STATUS_NEGATIVE_COUNT:
  ------------------
  |  Branch (3159:5): [True: 0, False: 335]
  ------------------
 3160|      0|    case CAIRO_STATUS_INVALID_CLUSTERS:
  ------------------
  |  Branch (3160:5): [True: 0, False: 335]
  ------------------
 3161|      0|    case CAIRO_STATUS_INVALID_SLANT:
  ------------------
  |  Branch (3161:5): [True: 0, False: 335]
  ------------------
 3162|      0|    case CAIRO_STATUS_INVALID_WEIGHT:
  ------------------
  |  Branch (3162:5): [True: 0, False: 335]
  ------------------
 3163|      0|    case CAIRO_STATUS_USER_FONT_NOT_IMPLEMENTED:
  ------------------
  |  Branch (3163:5): [True: 0, False: 335]
  ------------------
 3164|      0|    case CAIRO_STATUS_INVALID_MESH_CONSTRUCTION:
  ------------------
  |  Branch (3164:5): [True: 0, False: 335]
  ------------------
 3165|      0|    case CAIRO_STATUS_DEVICE_FINISHED:
  ------------------
  |  Branch (3165:5): [True: 0, False: 335]
  ------------------
 3166|      0|    case CAIRO_STATUS_JBIG2_GLOBAL_MISSING:
  ------------------
  |  Branch (3166:5): [True: 0, False: 335]
  ------------------
 3167|      0|    case CAIRO_STATUS_FREETYPE_ERROR:
  ------------------
  |  Branch (3167:5): [True: 0, False: 335]
  ------------------
 3168|      0|    case CAIRO_STATUS_WIN32_GDI_ERROR:
  ------------------
  |  Branch (3168:5): [True: 0, False: 335]
  ------------------
 3169|      0|    case CAIRO_INT_STATUS_DWRITE_ERROR:
  ------------------
  |  Branch (3169:5): [True: 0, False: 335]
  ------------------
 3170|      0|    case CAIRO_STATUS_TAG_ERROR:
  ------------------
  |  Branch (3170:5): [True: 0, False: 335]
  ------------------
 3171|      0|    case CAIRO_STATUS_SVG_FONT_ERROR:
  ------------------
  |  Branch (3171:5): [True: 0, False: 335]
  ------------------
 3172|      0|    default:
  ------------------
  |  Branch (3172:5): [True: 0, False: 335]
  ------------------
 3173|      0|	_cairo_error_throw (CAIRO_STATUS_NO_MEMORY);
  ------------------
  |  |  126|      0|#define _cairo_error_throw(status) do { \
  |  |  127|      0|    cairo_status_t status__ = _cairo_error (status); \
  |  |  128|      0|    (void) status__; \
  |  |  129|      0|} while (0)
  |  |  ------------------
  |  |  |  Branch (129:10): [Folded, False: 0]
  |  |  ------------------
  ------------------
 3174|      0|	return (cairo_surface_t *) &_cairo_surface_nil;
 3175|    335|    }
 3176|    335|}
cairo-surface.c:_cairo_surface_allocate_unique_id:
  272|     84|{
  273|     84|    static cairo_atomic_int_t unique_id;
  274|       |
  275|       |#if CAIRO_NO_MUTEX
  276|       |    if (++unique_id == 0)
  277|       |	unique_id = 1;
  278|       |    return unique_id;
  279|       |#else
  280|     84|    int old, id;
  281|       |
  282|     84|    do {
  283|     84|	old = _cairo_atomic_uint_get (&unique_id);
  ------------------
  |  |  473|     84|#define _cairo_atomic_uint_get(x) _cairo_atomic_int_get(x)
  ------------------
  284|     84|	id = old + 1;
  285|     84|	if (id == 0)
  ------------------
  |  Branch (285:6): [True: 0, False: 84]
  ------------------
  286|      0|	    id = 1;
  287|     84|    } while (! _cairo_atomic_uint_cmpxchg (&unique_id, old, id));
  ------------------
  |  |  475|     84|    _cairo_atomic_int_cmpxchg((cairo_atomic_int_t *)x, oldv, newv)
  |  |  ------------------
  |  |  |  |   98|     84|  _cairo_atomic_int_cmpxchg_impl(x, oldv, newv)
  |  |  ------------------
  ------------------
  |  Branch (287:14): [True: 0, False: 84]
  ------------------
  288|       |
  289|     84|    return id;
  290|     84|#endif
  291|     84|}
cairo-surface.c:_cairo_surface_has_snapshots:
  316|    252|{
  317|    252|    return ! cairo_list_is_empty (&surface->snapshots);
  318|    252|}
cairo-surface.c:_cairo_surface_finish_snapshots:
 1027|     84|{
 1028|     84|    cairo_status_t status;
 1029|       |
 1030|       |    /* update the snapshots *before* we declare the surface as finished */
 1031|     84|    surface->_finishing = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
 1032|     84|    status = _cairo_surface_flush (surface, 0);
 1033|     84|    (void) status;
 1034|     84|}
cairo-surface.c:_cairo_surface_finish:
 1038|     84|{
 1039|     84|    cairo_status_t status;
 1040|       |
 1041|       |    /* call finish even if in error mode */
 1042|     84|    if (surface->backend->finish) {
  ------------------
  |  Branch (1042:9): [True: 84, False: 0]
  ------------------
 1043|     84|	status = surface->backend->finish (surface);
 1044|     84|	if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 1045|      0|	    _cairo_surface_set_error (surface, status);
 1046|     84|    }
 1047|       |
 1048|     84|    surface->finished = TRUE;
  ------------------
  |  |  106|     84|#define TRUE 1
  ------------------
 1049|       |
 1050|     84|    assert (surface->snapshot_of == NULL);
  ------------------
  |  Branch (1050:5): [True: 0, False: 84]
  |  Branch (1050:5): [True: 84, False: 0]
  ------------------
 1051|     84|    assert (!_cairo_surface_has_snapshots (surface));
  ------------------
  |  Branch (1051:5): [True: 0, False: 84]
  |  Branch (1051:5): [True: 84, False: 0]
  ------------------
 1052|     84|}
cairo-surface.c:_cairo_mime_data_destroy:
 1226|     84|{
 1227|     84|    cairo_mime_data_t *mime_data = ptr;
 1228|       |
 1229|     84|    if (! _cairo_reference_count_dec_and_test (&mime_data->ref_count))
  ------------------
  |  |   49|     84|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|     84|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (1229:9): [True: 0, False: 84]
  ------------------
 1230|      0|	return;
 1231|       |
 1232|     84|    if (mime_data->destroy && mime_data->closure)
  ------------------
  |  Branch (1232:9): [True: 84, False: 0]
  |  Branch (1232:31): [True: 84, False: 0]
  ------------------
 1233|     84|	mime_data->destroy (mime_data->closure);
 1234|       |
 1235|     84|    free (mime_data);
 1236|     84|}
cairo-surface.c:_cairo_surface_detach_snapshots:
  338|     84|{
  339|     84|    while (_cairo_surface_has_snapshots (surface)) {
  ------------------
  |  Branch (339:12): [True: 0, False: 84]
  ------------------
  340|       |	_cairo_surface_detach_snapshot (cairo_list_first_entry (&surface->snapshots,
  ------------------
  |  |   54|      0|	cairo_list_entry((ptr)->next, type, member)
  |  |  ------------------
  |  |  |  |   51|      0|	cairo_container_of(ptr, type, member)
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|      0|#define cairo_container_of(ptr, type, member) ({ \
  |  |  |  |  |  |  131|      0|    const __typeof__ (((type *) 0)->member) *mptr__ = (ptr); \
  |  |  |  |  |  |  132|      0|    (type *) ((char *) mptr__ - offsetof (type, member)); \
  |  |  |  |  |  |  133|      0|})
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  341|      0|								cairo_surface_t,
  342|      0|								snapshot));
  343|      0|    }
  344|     84|}
cairo-surface.c:_cairo_surface_detach_mime_data:
  328|     84|{
  329|     84|    if (! _cairo_surface_has_mime_data (surface))
  ------------------
  |  Branch (329:9): [True: 0, False: 84]
  ------------------
  330|      0|	return;
  331|       |
  332|     84|    _cairo_user_data_array_fini (&surface->mime_data);
  333|     84|    _cairo_user_data_array_init (&surface->mime_data);
  334|     84|}
cairo-surface.c:_cairo_surface_has_mime_data:
  322|     84|{
  323|     84|    return surface->mime_data.num_elements != 0;
  324|     84|}

cairo_toy_font_face_create:
  257|     84|{
  258|     84|    cairo_status_t status;
  259|     84|    cairo_toy_font_face_t key, *font_face;
  260|     84|    cairo_hash_table_t *hash_table;
  261|       |
  262|     84|    if (family == NULL)
  ------------------
  |  Branch (262:9): [True: 0, False: 84]
  ------------------
  263|      0|	return (cairo_font_face_t*) &_cairo_font_face_null_pointer;
  264|       |
  265|       |    /* Make sure we've got valid UTF-8 for the family */
  266|     84|    status = _cairo_utf8_to_ucs4 (family, -1, NULL, NULL);
  267|     84|    if (unlikely (status)) {
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  268|      0|	if (status == CAIRO_STATUS_INVALID_STRING)
  ------------------
  |  Branch (268:6): [True: 0, False: 0]
  ------------------
  269|      0|	    return (cairo_font_face_t*) &_cairo_font_face_invalid_string;
  270|       |
  271|      0|	return (cairo_font_face_t*) &_cairo_font_face_nil;
  272|      0|    }
  273|       |
  274|     84|    switch (slant) {
  275|     84|	case CAIRO_FONT_SLANT_NORMAL:
  ------------------
  |  Branch (275:2): [True: 84, False: 0]
  ------------------
  276|     84|	case CAIRO_FONT_SLANT_ITALIC:
  ------------------
  |  Branch (276:2): [True: 0, False: 84]
  ------------------
  277|     84|	case CAIRO_FONT_SLANT_OBLIQUE:
  ------------------
  |  Branch (277:2): [True: 0, False: 84]
  ------------------
  278|     84|	    break;
  279|      0|	default:
  ------------------
  |  Branch (279:2): [True: 0, False: 84]
  ------------------
  280|      0|	    return (cairo_font_face_t*) &_cairo_font_face_invalid_slant;
  281|     84|    }
  282|       |
  283|     84|    switch (weight) {
  284|     84|	case CAIRO_FONT_WEIGHT_NORMAL:
  ------------------
  |  Branch (284:2): [True: 84, False: 0]
  ------------------
  285|     84|	case CAIRO_FONT_WEIGHT_BOLD:
  ------------------
  |  Branch (285:2): [True: 0, False: 84]
  ------------------
  286|     84|	    break;
  287|      0|	default:
  ------------------
  |  Branch (287:2): [True: 0, False: 84]
  ------------------
  288|      0|	    return (cairo_font_face_t*) &_cairo_font_face_invalid_weight;
  289|     84|    }
  290|       |
  291|     84|    if (*family == '\0')
  ------------------
  |  Branch (291:9): [True: 84, False: 0]
  ------------------
  292|     84|	family = CAIRO_FONT_FAMILY_DEFAULT;
  ------------------
  |  |  712|     84|#define CAIRO_FONT_FAMILY_DEFAULT CAIRO_FT_FONT_FAMILY_DEFAULT
  |  |  ------------------
  |  |  |  |  692|     84|#define CAIRO_FT_FONT_FAMILY_DEFAULT     ""
  |  |  ------------------
  ------------------
  293|       |
  294|     84|    hash_table = _cairo_toy_font_face_hash_table_lock ();
  295|     84|    if (unlikely (hash_table == NULL))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  296|      0|	goto UNWIND;
  297|       |
  298|     84|    _cairo_toy_font_face_init_key (&key, family, slant, weight);
  299|       |
  300|       |    /* Return existing font_face if it exists in the hash table. */
  301|     84|    font_face = _cairo_hash_table_lookup (hash_table,
  302|     84|					  &key.base.hash_entry);
  303|     84|    if (font_face != NULL) {
  ------------------
  |  Branch (303:9): [True: 83, False: 1]
  ------------------
  304|     83|	if (font_face->base.status == CAIRO_STATUS_SUCCESS) {
  ------------------
  |  Branch (304:6): [True: 83, False: 0]
  ------------------
  305|     83|	    cairo_font_face_reference (&font_face->base);
  306|     83|	    _cairo_toy_font_face_hash_table_unlock ();
  307|     83|	    return &font_face->base;
  308|     83|	}
  309|       |
  310|       |	/* remove the bad font from the hash table */
  311|      0|	_cairo_hash_table_remove (hash_table, &font_face->base.hash_entry);
  312|      0|    }
  313|       |
  314|       |    /* Otherwise create it and insert into hash table. */
  315|      1|    font_face = _cairo_calloc (sizeof (cairo_toy_font_face_t));
  ------------------
  |  |   79|      1|    ((size) != 0 ? calloc(1,size) : NULL)
  |  |  ------------------
  |  |  |  Branch (79:6): [True: 1, Folded]
  |  |  ------------------
  ------------------
  316|      1|    if (unlikely (font_face == NULL)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  317|      0|	status = _cairo_error (CAIRO_STATUS_NO_MEMORY);
  318|      0|	goto UNWIND_HASH_TABLE_LOCK;
  319|      0|    }
  320|       |
  321|      1|    status = _cairo_toy_font_face_init (font_face, family, slant, weight);
  322|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  323|      0|	goto UNWIND_FONT_FACE_MALLOC;
  324|       |
  325|      1|    assert (font_face->base.hash_entry.hash == key.base.hash_entry.hash);
  ------------------
  |  Branch (325:5): [True: 0, False: 1]
  |  Branch (325:5): [True: 1, False: 0]
  ------------------
  326|      1|    status = _cairo_hash_table_insert (hash_table, &font_face->base.hash_entry);
  327|      1|    if (unlikely (status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  328|      0|	goto UNWIND_FONT_FACE_INIT;
  329|       |
  330|      1|    _cairo_toy_font_face_hash_table_unlock ();
  331|       |
  332|      1|    return &font_face->base;
  333|       |
  334|      0| UNWIND_FONT_FACE_INIT:
  335|      0|    _cairo_toy_font_face_fini (font_face);
  336|      0| UNWIND_FONT_FACE_MALLOC:
  337|      0|    free (font_face);
  338|      0| UNWIND_HASH_TABLE_LOCK:
  339|      0|    _cairo_toy_font_face_hash_table_unlock ();
  340|      0| UNWIND:
  341|      0|    return (cairo_font_face_t*) &_cairo_font_face_nil;
  342|      0|}
cairo-toy-font-face.c:_cairo_toy_font_face_hash_table_lock:
  100|     84|{
  101|     84|    CAIRO_MUTEX_LOCK (_cairo_toy_font_face_mutex);
  ------------------
  |  |  175|     84|#define CAIRO_MUTEX_LOCK		CAIRO_MUTEX_IMPL_LOCK
  |  |  ------------------
  |  |  |  |  206|     84|# define CAIRO_MUTEX_IMPL_LOCK(mutex) pthread_mutex_lock (&(mutex))
  |  |  ------------------
  ------------------
  102|       |
  103|     84|    if (cairo_toy_font_face_hash_table == NULL)
  ------------------
  |  Branch (103:9): [True: 1, False: 83]
  ------------------
  104|      1|    {
  105|      1|	cairo_toy_font_face_hash_table =
  106|      1|	    _cairo_hash_table_create (_cairo_toy_font_face_keys_equal);
  107|       |
  108|      1|	if (cairo_toy_font_face_hash_table == NULL) {
  ------------------
  |  Branch (108:6): [True: 0, False: 1]
  ------------------
  109|      0|	    CAIRO_MUTEX_UNLOCK (_cairo_toy_font_face_mutex);
  ------------------
  |  |  177|      0|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|      0|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  110|      0|	    return NULL;
  111|      0|	}
  112|      1|    }
  113|       |
  114|     84|    return cairo_toy_font_face_hash_table;
  115|     84|}
cairo-toy-font-face.c:_cairo_toy_font_face_keys_equal:
  222|     83|{
  223|     83|    const cairo_toy_font_face_t *face_a = key_a;
  224|     83|    const cairo_toy_font_face_t *face_b = key_b;
  225|       |
  226|     83|    return (strcmp (face_a->family, face_b->family) == 0 &&
  ------------------
  |  Branch (226:13): [True: 83, False: 0]
  ------------------
  227|     83|	    face_a->slant == face_b->slant &&
  ------------------
  |  Branch (227:6): [True: 83, False: 0]
  ------------------
  228|     83|	    face_a->weight == face_b->weight);
  ------------------
  |  Branch (228:6): [True: 83, False: 0]
  ------------------
  229|     83|}
cairo-toy-font-face.c:_cairo_toy_font_face_init_key:
  137|     85|{
  138|     85|    uintptr_t hash;
  139|       |
  140|     85|    key->family = family;
  141|     85|    key->owns_family = FALSE;
  ------------------
  |  |  102|     85|#define FALSE 0
  ------------------
  142|       |
  143|     85|    key->slant = slant;
  144|     85|    key->weight = weight;
  145|       |
  146|       |    /* 1607 and 1451 are just a couple of arbitrary primes. */
  147|     85|    hash = _cairo_hash_string (family);
  148|     85|    hash += ((uintptr_t) slant) * 1607;
  149|     85|    hash += ((uintptr_t) weight) * 1451;
  150|       |
  151|     85|    key->base.hash_entry.hash = hash;
  152|     85|}
cairo-toy-font-face.c:_cairo_toy_font_face_hash_table_unlock:
  119|     84|{
  120|     84|    CAIRO_MUTEX_UNLOCK (_cairo_toy_font_face_mutex);
  ------------------
  |  |  177|     84|#define CAIRO_MUTEX_UNLOCK		CAIRO_MUTEX_IMPL_UNLOCK
  |  |  ------------------
  |  |  |  |  208|     84|# define CAIRO_MUTEX_IMPL_UNLOCK(mutex) pthread_mutex_unlock (&(mutex))
  |  |  ------------------
  ------------------
  121|     84|}
cairo-toy-font-face.c:_cairo_toy_font_face_init:
  184|      1|{
  185|      1|    char *family_copy;
  186|      1|    cairo_status_t status;
  187|       |
  188|      1|    family_copy = strdup (family);
  189|      1|    if (unlikely (family_copy == NULL))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  190|      0|	return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  191|       |
  192|      1|    _cairo_toy_font_face_init_key (font_face, family_copy, slant, weight);
  193|      1|    font_face->owns_family = TRUE;
  ------------------
  |  |  106|      1|#define TRUE 1
  ------------------
  194|       |
  195|      1|    _cairo_font_face_init (&font_face->base, &_cairo_toy_font_face_backend);
  196|       |
  197|      1|    status = _cairo_toy_font_face_create_impl_face (font_face,
  198|      1|						    &font_face->impl_face);
  199|      1|    if (unlikely (status)) {
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  200|      0|	free (family_copy);
  201|      0|	return status;
  202|      0|    }
  203|       |
  204|      1|    return CAIRO_STATUS_SUCCESS;
  205|      1|}
cairo-toy-font-face.c:_cairo_toy_font_face_get_implementation:
  393|      1|{
  394|      1|    cairo_toy_font_face_t *font_face = abstract_font_face;
  395|       |
  396|      1|    if (font_face->impl_face) {
  ------------------
  |  Branch (396:9): [True: 1, False: 0]
  ------------------
  397|      1|	cairo_font_face_t *impl = font_face->impl_face;
  398|       |
  399|      1|	if (impl->backend->get_implementation != NULL) {
  ------------------
  |  Branch (399:6): [True: 1, False: 0]
  ------------------
  400|      1|	    return impl->backend->get_implementation (impl,
  401|      1|						      font_matrix,
  402|      1|						      ctm,
  403|      1|						      options);
  404|      1|	}
  405|       |
  406|      0|	return cairo_font_face_reference (impl);
  407|      1|    }
  408|       |
  409|      0|    return abstract_font_face;
  410|      1|}
cairo-toy-font-face.c:_cairo_toy_font_face_create_impl_face:
  157|      1|{
  158|      1|    const cairo_font_face_backend_t * backend = CAIRO_FONT_FACE_BACKEND_DEFAULT;
  ------------------
  |  |  713|      1|#define CAIRO_FONT_FACE_BACKEND_DEFAULT &_cairo_ft_font_face_backend
  ------------------
  159|      1|    cairo_int_status_t status = CAIRO_INT_STATUS_UNSUPPORTED;
  160|       |
  161|      1|    if (unlikely (font_face->base.status))
  ------------------
  |  |  145|      1|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  162|      0|	return font_face->base.status;
  163|       |
  164|      1|    if (backend->create_for_toy != NULL &&
  ------------------
  |  Branch (164:9): [True: 1, False: 0]
  ------------------
  165|      1|	0 != strncmp (font_face->family, CAIRO_USER_FONT_FAMILY_DEFAULT,
  ------------------
  |  |  693|      1|#define CAIRO_USER_FONT_FAMILY_DEFAULT     "@cairo:"
  ------------------
  |  Branch (165:2): [True: 1, False: 0]
  ------------------
  166|      1|		      strlen (CAIRO_USER_FONT_FAMILY_DEFAULT)))
  ------------------
  |  |  693|      1|#define CAIRO_USER_FONT_FAMILY_DEFAULT     "@cairo:"
  ------------------
  167|      1|    {
  168|      1|	status = backend->create_for_toy (font_face, impl_font_face);
  169|      1|    }
  170|       |
  171|      1|    if (status == CAIRO_INT_STATUS_UNSUPPORTED) {
  ------------------
  |  Branch (171:9): [True: 0, False: 1]
  ------------------
  172|      0|	backend = &_cairo_user_font_face_backend;
  173|      0|	status = backend->create_for_toy (font_face, impl_font_face);
  174|      0|    }
  175|       |
  176|      1|    return status;
  177|      1|}

_cairo_traps_compositor_init:
 2343|      1|{
 2344|      1|    compositor->base.delegate = delegate;
 2345|       |
 2346|      1|    compositor->base.paint = _cairo_traps_compositor_paint;
 2347|      1|    compositor->base.mask = _cairo_traps_compositor_mask;
 2348|      1|    compositor->base.fill = _cairo_traps_compositor_fill;
 2349|      1|    compositor->base.stroke = _cairo_traps_compositor_stroke;
 2350|      1|    compositor->base.glyphs = _cairo_traps_compositor_glyphs;
 2351|      1|}

_cairo_utf8_to_ucs4:
  256|    168|{
  257|    168|    uint32_t *str32 = NULL;
  258|    168|    int n_chars, i;
  259|    168|    const unsigned char *in;
  260|    168|    const unsigned char * const ustr = (const unsigned char *) str;
  261|       |
  262|    168|    in = ustr;
  263|    168|    n_chars = 0;
  264|    168|    while ((len < 0 || ustr + len - in > 0) && *in)
  ------------------
  |  Branch (264:13): [True: 84, False: 84]
  |  Branch (264:24): [True: 84, False: 0]
  |  Branch (264:48): [True: 84, False: 84]
  ------------------
  265|     84|    {
  266|     84|	uint32_t wc = _utf8_get_char_extended (in, ustr + len - in);
  267|     84|	if (wc & 0x80000000 || !UNICODE_VALID (wc))
  ------------------
  |  |  101|      0|    ((Char) < 0x110000 &&                     \
  |  |  ------------------
  |  |  |  Branch (101:6): [True: 0, False: 0]
  |  |  ------------------
  |  |  102|      0|     (((Char) & 0xFFFFF800) != 0xD800))
  |  |  ------------------
  |  |  |  Branch (102:6): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (267:6): [True: 84, False: 0]
  ------------------
  268|     84|	    return _cairo_error (CAIRO_STATUS_INVALID_STRING);
  269|       |
  270|      0|	n_chars++;
  271|      0|	if (n_chars == INT_MAX)
  ------------------
  |  Branch (271:6): [True: 0, False: 0]
  ------------------
  272|      0|	    return _cairo_error (CAIRO_STATUS_INVALID_STRING);
  273|       |
  274|      0|	in = UTF8_NEXT_CHAR (in);
  ------------------
  |  |  115|      0|#define UTF8_NEXT_CHAR(p) ((p) + utf8_skip_data[*(unsigned char *)(p)])
  ------------------
  275|      0|    }
  276|       |
  277|     84|    if (result) {
  ------------------
  |  Branch (277:9): [True: 0, False: 84]
  ------------------
  278|      0|	str32 = _cairo_malloc_ab (n_chars + 1, sizeof (uint32_t));
  279|      0|	if (!str32)
  ------------------
  |  Branch (279:6): [True: 0, False: 0]
  ------------------
  280|      0|	    return _cairo_error (CAIRO_STATUS_NO_MEMORY);
  281|       |
  282|      0|	in = ustr;
  283|      0|	for (i=0; i < n_chars; i++) {
  ------------------
  |  Branch (283:12): [True: 0, False: 0]
  ------------------
  284|      0|	    str32[i] = _utf8_get_char (in);
  285|      0|	    in = UTF8_NEXT_CHAR (in);
  ------------------
  |  |  115|      0|#define UTF8_NEXT_CHAR(p) ((p) + utf8_skip_data[*(unsigned char *)(p)])
  ------------------
  286|      0|	}
  287|      0|	str32[i] = 0;
  288|       |
  289|      0|	*result = str32;
  290|      0|    }
  291|       |
  292|     84|    if (items_written)
  ------------------
  |  Branch (292:9): [True: 0, False: 84]
  ------------------
  293|      0|	*items_written = n_chars;
  294|       |
  295|     84|    return CAIRO_STATUS_SUCCESS;
  296|     84|}
cairo-unicode.c:_utf8_get_char_extended:
  142|     84|{
  143|     84|    int i, len;
  144|     84|    uint32_t wc = (unsigned char) *p;
  145|       |
  146|     84|    if (wc < 0x80) {
  ------------------
  |  Branch (146:9): [True: 0, False: 84]
  ------------------
  147|      0|	return wc;
  148|     84|    } else if (wc < 0xc0) {
  ------------------
  |  Branch (148:16): [True: 84, False: 0]
  ------------------
  149|     84|	return (uint32_t)-1;
  150|     84|    } else if (wc < 0xe0) {
  ------------------
  |  Branch (150:16): [True: 0, False: 0]
  ------------------
  151|      0|	len = 2;
  152|      0|	wc &= 0x1f;
  153|      0|    } else if (wc < 0xf0) {
  ------------------
  |  Branch (153:16): [True: 0, False: 0]
  ------------------
  154|      0|	len = 3;
  155|      0|	wc &= 0x0f;
  156|      0|    } else if (wc < 0xf8) {
  ------------------
  |  Branch (156:16): [True: 0, False: 0]
  ------------------
  157|      0|	len = 4;
  158|      0|	wc &= 0x07;
  159|      0|    } else if (wc < 0xfc) {
  ------------------
  |  Branch (159:16): [True: 0, False: 0]
  ------------------
  160|      0|	len = 5;
  161|      0|	wc &= 0x03;
  162|      0|    } else if (wc < 0xfe) {
  ------------------
  |  Branch (162:16): [True: 0, False: 0]
  ------------------
  163|      0|	len = 6;
  164|      0|	wc &= 0x01;
  165|      0|    } else {
  166|      0|	return (uint32_t)-1;
  167|      0|    }
  168|       |
  169|      0|    if (max_len >= 0 && len > max_len) {
  ------------------
  |  Branch (169:9): [True: 0, False: 0]
  |  Branch (169:25): [True: 0, False: 0]
  ------------------
  170|      0|	for (i = 1; i < max_len; i++) {
  ------------------
  |  Branch (170:14): [True: 0, False: 0]
  ------------------
  171|      0|	    if ((((unsigned char *)p)[i] & 0xc0) != 0x80)
  ------------------
  |  Branch (171:10): [True: 0, False: 0]
  ------------------
  172|      0|		return (uint32_t)-1;
  173|      0|	}
  174|      0|	return (uint32_t)-2;
  175|      0|    }
  176|       |
  177|      0|    for (i = 1; i < len; ++i) {
  ------------------
  |  Branch (177:17): [True: 0, False: 0]
  ------------------
  178|      0|	uint32_t ch = ((unsigned char *)p)[i];
  179|       |
  180|      0|	if ((ch & 0xc0) != 0x80) {
  ------------------
  |  Branch (180:6): [True: 0, False: 0]
  ------------------
  181|      0|	    if (ch)
  ------------------
  |  Branch (181:10): [True: 0, False: 0]
  ------------------
  182|      0|		return (uint32_t)-1;
  183|      0|	    else
  184|      0|		return (uint32_t)-2;
  185|      0|	}
  186|       |
  187|      0|	wc <<= 6;
  188|      0|	wc |= (ch & 0x3f);
  189|      0|    }
  190|       |
  191|      0|    if (UTF8_LENGTH(wc) != len)
  ------------------
  |  |   81|      0|  ((Char) < 0x80 ? 1 :                 \
  |  |  ------------------
  |  |  |  Branch (81:4): [True: 0, False: 0]
  |  |  ------------------
  |  |   82|      0|   ((Char) < 0x800 ? 2 :               \
  |  |  ------------------
  |  |  |  Branch (82:5): [True: 0, False: 0]
  |  |  ------------------
  |  |   83|      0|    ((Char) < 0x10000 ? 3 :            \
  |  |  ------------------
  |  |  |  Branch (83:6): [True: 0, False: 0]
  |  |  ------------------
  |  |   84|      0|     ((Char) < 0x200000 ? 4 :          \
  |  |  ------------------
  |  |  |  Branch (84:7): [True: 0, False: 0]
  |  |  ------------------
  |  |   85|      0|      ((Char) < 0x4000000 ? 5 : 6)))))
  |  |  ------------------
  |  |  |  Branch (85:8): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (191:9): [True: 0, False: 0]
  ------------------
  192|      0|	return (uint32_t)-1;
  193|       |
  194|      0|    return wc;
  195|      0|}

cairo_create:
  447|     84|{
  448|     84|    if (unlikely (target == NULL))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  449|      0|	return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NULL_POINTER));
  450|     84|    if (unlikely (target->status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  451|      0|	return _cairo_create_in_error (target->status);
  452|     84|    if (unlikely (target->finished))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  453|      0|	return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_SURFACE_FINISHED));
  454|       |
  455|     84|    if (target->backend->create_context == NULL)
  ------------------
  |  Branch (455:9): [True: 0, False: 84]
  ------------------
  456|      0|	return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_WRITE_ERROR));
  457|       |
  458|     84|    return target->backend->create_context (target);
  459|       |
  460|     84|}
_cairo_init:
  465|     84|{
  466|     84|    CAIRO_REFERENCE_COUNT_INIT (&cr->ref_count, 1);
  ------------------
  |  |   51|     84|#define CAIRO_REFERENCE_COUNT_INIT(RC, VALUE) ((RC)->ref_count = (VALUE))
  ------------------
  467|     84|    cr->status = CAIRO_STATUS_SUCCESS;
  468|     84|    _cairo_user_data_array_init (&cr->user_data);
  469|       |
  470|     84|    cr->backend = backend;
  471|     84|}
_cairo_fini:
  503|     84|{
  504|     84|    _cairo_user_data_array_fini (&cr->user_data);
  505|     84|}
cairo_destroy:
  519|     84|{
  520|     84|    if (cr == NULL || CAIRO_REFERENCE_COUNT_IS_INVALID (&cr->ref_count))
  ------------------
  |  |   58|     84|#define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   53|     84|#define CAIRO_REFERENCE_COUNT_GET_VALUE(RC) _cairo_atomic_int_get (&(RC)->ref_count)
  |  |  ------------------
  |  |               #define CAIRO_REFERENCE_COUNT_IS_INVALID(RC) (CAIRO_REFERENCE_COUNT_GET_VALUE (RC) == CAIRO_REFERENCE_COUNT_INVALID_VALUE)
  |  |  ------------------
  |  |  |  |   55|     84|#define CAIRO_REFERENCE_COUNT_INVALID_VALUE ((int) -1)
  |  |  ------------------
  |  |  |  Branch (58:46): [True: 0, False: 84]
  |  |  ------------------
  ------------------
  |  Branch (520:9): [True: 0, False: 84]
  ------------------
  521|      0|	return;
  522|       |
  523|     84|    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&cr->ref_count));
  ------------------
  |  Branch (523:5): [True: 0, False: 84]
  |  Branch (523:5): [True: 84, False: 0]
  ------------------
  524|       |
  525|     84|    if (! _cairo_reference_count_dec_and_test (&cr->ref_count))
  ------------------
  |  |   49|     84|#define _cairo_reference_count_dec_and_test(RC) _cairo_atomic_int_dec_and_test (&(RC)->ref_count)
  |  |  ------------------
  |  |  |  |   85|     84|# define _cairo_atomic_int_dec_and_test(x) (atomic_fetch_sub_explicit(x, 1, memory_order_seq_cst) == 1)
  |  |  ------------------
  ------------------
  |  Branch (525:9): [True: 0, False: 84]
  ------------------
  526|      0|	return;
  527|       |
  528|     84|    cr->backend->destroy (cr);
  529|     84|}
cairo_get_scaled_font:
 3361|     84|{
 3362|     84|    if (unlikely (cr->status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 3363|      0|	return _cairo_scaled_font_create_in_error (cr->status);
 3364|       |
 3365|     84|    return cr->backend->get_scaled_font (cr);
 3366|     84|}
cairo_text_extents:
 3394|     84|{
 3395|     84|    cairo_status_t status;
 3396|     84|    cairo_scaled_font_t *scaled_font;
 3397|     84|    cairo_glyph_t *glyphs = NULL;
 3398|     84|    int num_glyphs = 0;
 3399|     84|    double x, y;
 3400|       |
 3401|     84|    extents->x_bearing = 0.0;
 3402|     84|    extents->y_bearing = 0.0;
 3403|     84|    extents->width  = 0.0;
 3404|     84|    extents->height = 0.0;
 3405|     84|    extents->x_advance = 0.0;
 3406|     84|    extents->y_advance = 0.0;
 3407|       |
 3408|     84|    if (unlikely (cr->status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 3409|      0|	return;
 3410|       |
 3411|     84|    if (utf8 == NULL)
  ------------------
  |  Branch (3411:9): [True: 0, False: 84]
  ------------------
 3412|      0|	return;
 3413|       |
 3414|     84|    scaled_font = cairo_get_scaled_font (cr);
 3415|     84|    if (unlikely (scaled_font->status)) {
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 3416|      0|	_cairo_set_error (cr, scaled_font->status);
 3417|      0|	return;
 3418|      0|    }
 3419|       |
 3420|     84|    cairo_get_current_point (cr, &x, &y);
 3421|     84|    status = cairo_scaled_font_text_to_glyphs (scaled_font,
 3422|     84|					       x, y,
 3423|     84|					       utf8, -1,
 3424|     84|					       &glyphs, &num_glyphs,
 3425|     84|					       NULL, NULL, NULL);
 3426|       |
 3427|     84|    if (likely (status == CAIRO_STATUS_SUCCESS)) {
  ------------------
  |  |  144|     84|#define likely(expr) (__builtin_expect (!!(expr), 1))
  |  |  ------------------
  |  |  |  Branch (144:22): [True: 0, False: 84]
  |  |  ------------------
  ------------------
 3428|      0|	status = cr->backend->glyph_extents (cr,
 3429|      0|					     glyphs, num_glyphs,
 3430|      0|					     extents);
 3431|      0|    }
 3432|     84|    cairo_glyph_free (glyphs);
 3433|       |
 3434|     84|    if (unlikely (status))
  ------------------
  |  |  145|     84|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 84, False: 0]
  |  |  ------------------
  ------------------
 3435|     84|	_cairo_set_error (cr, status);
 3436|     84|}
cairo_show_text_glyphs:
 3694|    756|{
 3695|    756|    cairo_status_t status;
 3696|       |
 3697|    756|    if (unlikely (cr->status))
  ------------------
  |  |  145|    756|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 756, False: 0]
  |  |  ------------------
  ------------------
 3698|    756|	return;
 3699|       |
 3700|       |    /* A slew of sanity checks */
 3701|       |
 3702|       |    /* Special case for NULL and -1 */
 3703|      0|    if (utf8 == NULL && utf8_len == -1)
  ------------------
  |  Branch (3703:9): [True: 0, False: 0]
  |  Branch (3703:25): [True: 0, False: 0]
  ------------------
 3704|      0|	utf8_len = 0;
 3705|       |
 3706|       |    /* No NULLs for non-zeros */
 3707|      0|    if ((num_glyphs   && glyphs   == NULL) ||
  ------------------
  |  Branch (3707:10): [True: 0, False: 0]
  |  Branch (3707:26): [True: 0, False: 0]
  ------------------
 3708|      0|	(utf8_len     && utf8     == NULL) ||
  ------------------
  |  Branch (3708:3): [True: 0, False: 0]
  |  Branch (3708:19): [True: 0, False: 0]
  ------------------
 3709|      0|	(num_clusters && clusters == NULL)) {
  ------------------
  |  Branch (3709:3): [True: 0, False: 0]
  |  Branch (3709:19): [True: 0, False: 0]
  ------------------
 3710|      0|	_cairo_set_error (cr, CAIRO_STATUS_NULL_POINTER);
 3711|      0|	return;
 3712|      0|    }
 3713|       |
 3714|       |    /* A -1 for utf8_len means NUL-terminated */
 3715|      0|    if (utf8_len == -1)
  ------------------
  |  Branch (3715:9): [True: 0, False: 0]
  ------------------
 3716|      0|	utf8_len = strlen (utf8);
 3717|       |
 3718|       |    /* Apart from that, no negatives */
 3719|      0|    if (num_glyphs < 0 || utf8_len < 0 || num_clusters < 0) {
  ------------------
  |  Branch (3719:9): [True: 0, False: 0]
  |  Branch (3719:27): [True: 0, False: 0]
  |  Branch (3719:43): [True: 0, False: 0]
  ------------------
 3720|      0|	_cairo_set_error (cr, CAIRO_STATUS_NEGATIVE_COUNT);
 3721|      0|	return;
 3722|      0|    }
 3723|       |
 3724|      0|    if (num_glyphs == 0 && utf8_len == 0)
  ------------------
  |  Branch (3724:9): [True: 0, False: 0]
  |  Branch (3724:28): [True: 0, False: 0]
  ------------------
 3725|      0|	return;
 3726|       |
 3727|      0|    if (utf8) {
  ------------------
  |  Branch (3727:9): [True: 0, False: 0]
  ------------------
 3728|       |	/* Make sure clusters cover the entire glyphs and utf8 arrays,
 3729|       |	 * and that cluster boundaries are UTF-8 boundaries. */
 3730|      0|	status = _cairo_validate_text_clusters (utf8, utf8_len,
 3731|      0|						glyphs, num_glyphs,
 3732|      0|						clusters, num_clusters, cluster_flags);
 3733|      0|	if (status == CAIRO_STATUS_INVALID_CLUSTERS) {
  ------------------
  |  Branch (3733:6): [True: 0, False: 0]
  ------------------
 3734|       |	    /* Either got invalid UTF-8 text, or cluster mapping is bad.
 3735|       |	     * Differentiate those. */
 3736|       |
 3737|      0|	    cairo_status_t status2;
 3738|       |
 3739|      0|	    status2 = _cairo_utf8_to_ucs4 (utf8, utf8_len, NULL, NULL);
 3740|      0|	    if (status2)
  ------------------
  |  Branch (3740:10): [True: 0, False: 0]
  ------------------
 3741|      0|		status = status2;
 3742|      0|	} else {
 3743|      0|	    cairo_glyph_text_info_t info;
 3744|       |
 3745|      0|	    info.utf8 = utf8;
 3746|      0|	    info.utf8_len = utf8_len;
 3747|      0|	    info.clusters = clusters;
 3748|      0|	    info.num_clusters = num_clusters;
 3749|      0|	    info.cluster_flags = cluster_flags;
 3750|       |
 3751|      0|	    status = cr->backend->glyphs (cr, glyphs, num_glyphs, &info);
 3752|      0|	}
 3753|      0|    } else {
 3754|      0|	status = cr->backend->glyphs (cr, glyphs, num_glyphs, NULL);
 3755|      0|    }
 3756|      0|    if (unlikely (status))
  ------------------
  |  |  145|      0|#define unlikely(expr) (__builtin_expect (!!(expr), 0))
  |  |  ------------------
  |  |  |  Branch (145:24): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 3757|      0|	_cairo_set_error (cr, status);
 3758|      0|}
cairo_get_current_point:
 4017|     84|{
 4018|     84|    double x, y;
 4019|       |
 4020|     84|    x = y = 0;
 4021|     84|    if (cr->status == CAIRO_STATUS_SUCCESS &&
  ------------------
  |  Branch (4021:9): [True: 84, False: 0]
  ------------------
 4022|     84|	cr->backend->has_current_point (cr))
  ------------------
  |  Branch (4022:2): [True: 0, False: 84]
  ------------------
 4023|      0|    {
 4024|      0|	cr->backend->get_current_point (cr, &x, &y);
 4025|      0|    }
 4026|       |
 4027|     84|    if (x_ret)
  ------------------
  |  Branch (4027:9): [True: 84, False: 0]
  ------------------
 4028|     84|	*x_ret = x;
 4029|     84|    if (y_ret)
  ------------------
  |  Branch (4029:9): [True: 84, False: 0]
  ------------------
 4030|     84|	*y_ret = y;
 4031|     84|}
cairo.c:_cairo_set_error:
  398|     84|{
  399|       |    /* Don't overwrite an existing error. This preserves the first
  400|       |     * error, which is the most significant. */
  401|       |    _cairo_status_set_error (&cr->status, _cairo_error (status));
  ------------------
  |  |  477|     84|#define _cairo_status_set_error(status, err) do { \
  |  |  478|     84|    int ret__; \
  |  |  479|     84|    assert (err < CAIRO_STATUS_LAST_STATUS); \
  |  |  480|     84|    assert (sizeof(*status) == sizeof(cairo_atomic_int_t)); \
  |  |  481|     84|    /* hide compiler warnings about cairo_status_t != int (gcc treats its as \
  |  |  482|     84|     * an unsigned integer instead, and about ignoring the return value. */  \
  |  |  483|     84|    ret__ = _cairo_atomic_int_cmpxchg ((cairo_atomic_int_t *) status, CAIRO_STATUS_SUCCESS, err); \
  |  |  ------------------
  |  |  |  |   98|     84|  _cairo_atomic_int_cmpxchg_impl(x, oldv, newv)
  |  |  ------------------
  |  |  484|     84|    (void) ret__; \
  |  |  485|     84|} while (0)
  |  |  ------------------
  |  |  |  Branch (485:10): [Folded, False: 84]
  |  |  ------------------
  ------------------
  |  Branch (401:5): [True: 0, False: 84]
  |  Branch (401:5): [True: 84, False: 0]
  |  Branch (401:5): [True: 0, Folded]
  |  Branch (401:5): [True: 84, Folded]
  ------------------
  402|     84|}

cairo-gstate.c:_cairo_matrix_is_identity:
 1806|     84|{
 1807|     84|    return (matrix->xx == 1.0 && matrix->yx == 0.0 &&
  ------------------
  |  Branch (1807:13): [True: 84, False: 0]
  |  Branch (1807:34): [True: 84, False: 0]
  ------------------
 1808|     84|	    matrix->xy == 0.0 && matrix->yy == 1.0 &&
  ------------------
  |  Branch (1808:6): [True: 84, False: 0]
  |  Branch (1808:27): [True: 84, False: 0]
  ------------------
 1809|     84|	    matrix->x0 == 0.0 && matrix->y0 == 0.0);
  ------------------
  |  Branch (1809:6): [True: 84, False: 0]
  |  Branch (1809:27): [True: 84, False: 0]
  ------------------
 1810|     84|}

text_glyphs_fuzzer.c:fuzzer_get_tmpfile:
   29|    419|static char* fuzzer_get_tmpfile(const uint8_t* data, size_t size) {
   30|    419|    char* filename_buffer = strdup("/tmp/generate_temporary_file.XXXXXX");
   31|    419|    if (!filename_buffer) {
  ------------------
  |  Branch (31:9): [True: 0, False: 419]
  ------------------
   32|      0|        perror("Failed to allocate file name buffer.");
   33|      0|        abort();
   34|      0|    }
   35|    419|    const int file_descriptor = mkstemp(filename_buffer);
   36|    419|    if (file_descriptor < 0) {
  ------------------
  |  Branch (36:9): [True: 0, False: 419]
  ------------------
   37|      0|        perror("Failed to make temporary file.");
   38|      0|        abort();
   39|      0|    }
   40|    419|    FILE* file = fdopen(file_descriptor, "wb");
   41|    419|    if (!file) {
  ------------------
  |  Branch (41:9): [True: 0, False: 419]
  ------------------
   42|      0|        perror("Failed to open file descriptor.");
   43|      0|        close(file_descriptor);
   44|      0|        abort();
   45|      0|    }
   46|    419|    const size_t bytes_written = fwrite(data, sizeof(uint8_t), size, file);
   47|    419|    if (bytes_written < size) {
  ------------------
  |  Branch (47:9): [True: 0, False: 419]
  ------------------
   48|      0|        close(file_descriptor);
   49|      0|        fprintf(stderr, "Failed to write all bytes to file (%zu out of %zu)",
   50|      0|                bytes_written, size);
   51|      0|        abort();
   52|      0|    }
   53|    419|    fclose(file);
   54|    419|    return filename_buffer;
   55|    419|}
text_glyphs_fuzzer.c:fuzzer_release_tmpfile:
   57|    419|static void fuzzer_release_tmpfile(char* filename) {
   58|    419|    if (unlink(filename) != 0) {
  ------------------
  |  Branch (58:9): [True: 0, False: 419]
  ------------------
   59|      0|        perror("WARNING: Failed to delete temporary file.");
   60|      0|    }
   61|    419|    free(filename);
   62|    419|}

LLVMFuzzerTestOneInput:
   20|    424|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   21|    424|    if (size < glyph_range) {
  ------------------
  |  Branch (21:9): [True: 5, False: 419]
  ------------------
   22|      5|        return 0;
   23|      5|    }
   24|    419|    cairo_t *cr;
   25|    419|    cairo_surface_t *surface;
   26|    419|    cairo_status_t status;
   27|    419|    cairo_text_extents_t extents;
   28|    419|    cairo_text_cluster_t cluster;
   29|       |
   30|    419|    char *tmpfile = fuzzer_get_tmpfile(data, size);
   31|    419|    surface = cairo_image_surface_create_from_png(tmpfile);
   32|    419|    status = cairo_surface_status(surface);
   33|    419|    if (status != CAIRO_STATUS_SUCCESS) {
  ------------------
  |  Branch (33:9): [True: 335, False: 84]
  ------------------
   34|    335|        fuzzer_release_tmpfile(tmpfile);
   35|    335|        return 0;
   36|    335|    }
   37|       |
   38|     84|    char *buf = (char *) calloc(size + 1, sizeof(char));
   39|     84|    memcpy(buf, data, size);
   40|     84|    buf[size] = '\0';
   41|       |
   42|     84|    cr = cairo_create(surface);
   43|     84|    cairo_text_extents(cr, buf, &extents);
   44|     84|    cluster.num_bytes = size;
   45|     84|    cluster.num_glyphs = 1;
   46|    840|    for (int i = 0; i < glyph_range; i++) {
  ------------------
  |  Branch (46:21): [True: 756, False: 84]
  ------------------
   47|       |        // Taken from test/text-glyph-range.c
   48|    756|        cairo_glyph_t glyph = {
   49|    756|            (long int)data[i], 10 * i, 25
   50|    756|        };
   51|    756|        cairo_show_text_glyphs(cr, buf, size, &glyph, 1, &cluster, 1, 0);
   52|    756|    }
   53|       |
   54|     84|    cairo_destroy(cr);
   55|     84|    cairo_surface_destroy(surface);
   56|     84|    free(buf);
   57|     84|    fuzzer_release_tmpfile(tmpfile);
   58|     84|    return 0;
   59|    419|}

