static void
_cairo_skia_context_destroy (void *abstract_cr)
{
    cairo_skia_context_t *cr = (cairo_skia_context_t *) abstract_cr;

    cr->path->reset ();
    cr->paint->reset ();

    delete cr->canvas;

    cairo_surface_destroy (&cr->target->image.base);
    cairo_surface_destroy (&cr->original->image.base);

    if (cr->source != NULL) {
	if (cr->source_image != NULL) {
	    _cairo_surface_release_source_image (cr->source, cr->source_image, cr->source_extra);
	    cr->source_image = NULL;
	}
	cairo_surface_destroy (cr->source);
	cr->source = NULL;
    }

    _cairo_fini (&cr->base);

    _freed_pool_put (&context_pool, cr);
}
Exemplo n.º 2
0
static void
_cairo_default_context_destroy (void *abstract_cr)
{
    cairo_default_context_t *cr = abstract_cr;

    _cairo_default_context_fini (cr);

    /* mark the context as invalid to protect against misuse */
    cr->base.status = CAIRO_STATUS_NULL_POINTER;
    _freed_pool_put (&context_pool, cr);
}
Exemplo n.º 3
0
static void
_cairo_clip_path_destroy (cairo_clip_path_t *clip_path)
{
    assert (CAIRO_REFERENCE_COUNT_HAS_REFERENCE (&clip_path->ref_count));

    if (! _cairo_reference_count_dec_and_test (&clip_path->ref_count))
	return;

    _cairo_path_fixed_fini (&clip_path->path);
    if (clip_path->region != NULL)
	cairo_region_destroy (clip_path->region);
    if (clip_path->surface != NULL)
	cairo_surface_destroy (clip_path->surface);

    if (clip_path->prev != NULL)
	_cairo_clip_path_destroy (clip_path->prev);

    _freed_pool_put (&clip_path_pool, clip_path);
}
Exemplo n.º 4
0
cairo_t *
_cairo_default_context_create (void *target)
{
    cairo_default_context_t *cr;
    cairo_status_t status;

    cr = _freed_pool_get (&context_pool);
    if (unlikely (cr == NULL)) {
        cr = malloc (sizeof (cairo_default_context_t));
        if (unlikely (cr == NULL))
            return _cairo_create_in_error (_cairo_error (CAIRO_STATUS_NO_MEMORY));
    }

    status = _cairo_default_context_init (cr, target);
    if (unlikely (status)) {
        _freed_pool_put (&context_pool, cr);
        return _cairo_create_in_error (status);
    }

    return &cr->base;
}