Exemplo n.º 1
0
fz_context *
fz_clone_context_internal(fz_context *ctx)
{
	fz_context *new_ctx;

	if (ctx == NULL || ctx->alloc == NULL)
		return NULL;

	new_ctx = new_context_phase1(ctx->alloc, ctx->locks);
	if (!new_ctx)
		return NULL;

	/* Inherit AA defaults from old context. */
	fz_copy_aa_context(new_ctx, ctx);

	/* Keep thread lock checking happy by copying pointers first and locking under new context */
	new_ctx->store = ctx->store;
	new_ctx->store = fz_keep_store_context(new_ctx);
	new_ctx->glyph_cache = ctx->glyph_cache;
	new_ctx->glyph_cache = fz_keep_glyph_cache(new_ctx);
	new_ctx->colorspace = ctx->colorspace;
	new_ctx->colorspace = fz_keep_colorspace_context(new_ctx);
	new_ctx->font = ctx->font;
	new_ctx->font = fz_keep_font_context(new_ctx);
	new_ctx->id = ctx->id;
	new_ctx->id = fz_keep_id_context(new_ctx);
	new_ctx->handler = ctx->handler;
	new_ctx->handler = fz_keep_document_handler_context(new_ctx);

	return new_ctx;
}
Exemplo n.º 2
0
fz_context *
fz_clone_context_internal(fz_context *ctx)
{
	fz_context *new_ctx;

	if (ctx == NULL || ctx->alloc == NULL)
		return NULL;
	new_ctx = new_context_phase1(ctx->alloc, ctx->locks);
	new_ctx->store = fz_store_keep(ctx);
	new_ctx->glyph_cache = fz_keep_glyph_cache(ctx);
	new_ctx->font = fz_keep_font_context(ctx);
	return new_ctx;
}