diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-02-26 11:15:16 -0800 |
---|---|---|
committer | Robin Watts <robin@ghostscript.com> | 2012-02-26 19:36:30 +0000 |
commit | bbfe635555dce16858403706e2031dd3bfa1a9f1 (patch) | |
tree | 6e414005f04f233a83dbeec5607c0665a6d498bc /pdf/pdf_xobject.c | |
parent | ca578b08dc1243dc6cbb3235272d52d9e2336925 (diff) | |
download | mupdf-bbfe635555dce16858403706e2031dd3bfa1a9f1.tar.xz |
Move fz_obj to be pdf_obj.
Currently, we are in the slightly strange position of having
the PDF specific object types as part of fitz. Here we pull
them out into the pdf layer instead. This has been made possible
by the recent changes to make the store no longer be tied to
having fz_obj's as keys.
Most of this work is a simple huge rename; to help customers who
may have code that use such functions we have provided a sed
script to do the renaming; scripts/rename2.sed.
Various other small tweaks are required; the store used to have
some debugging code that still required knowledge of fz_obj
types - we extract that into a nicer 'type' based function
pointer. Also, the type 3 font handling used to have an fz_obj
pointer for type 3 resources, and therefore needed to know how
to free this; this has become a void * with a function to free
it.
Diffstat (limited to 'pdf/pdf_xobject.c')
-rw-r--r-- | pdf/pdf_xobject.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/pdf/pdf_xobject.c b/pdf/pdf_xobject.c index 9f6d10ce..36c5c483 100644 --- a/pdf/pdf_xobject.c +++ b/pdf/pdf_xobject.c @@ -21,10 +21,10 @@ pdf_free_xobject_imp(fz_context *ctx, fz_storable *xobj_) if (xobj->colorspace) fz_drop_colorspace(ctx, xobj->colorspace); if (xobj->resources) - fz_drop_obj(xobj->resources); + pdf_drop_obj(xobj->resources); if (xobj->contents) fz_drop_buffer(ctx, xobj->contents); - fz_drop_obj(xobj->me); + pdf_drop_obj(xobj->me); fz_free(ctx, xobj); } @@ -37,10 +37,10 @@ pdf_xobject_size(pdf_xobject *xobj) } pdf_xobject * -pdf_load_xobject(pdf_document *xref, fz_obj *dict) +pdf_load_xobject(pdf_document *xref, pdf_obj *dict) { pdf_xobject *form; - fz_obj *obj; + pdf_obj *obj; fz_context *ctx = xref->ctx; if ((form = pdf_find_item(ctx, pdf_free_xobject_imp, dict))) @@ -58,10 +58,10 @@ pdf_load_xobject(pdf_document *xref, fz_obj *dict) /* Store item immediately, to avoid possible recursion if objects refer back to this one */ pdf_store_item(ctx, dict, form, pdf_xobject_size(form)); - obj = fz_dict_gets(dict, "BBox"); + obj = pdf_dict_gets(dict, "BBox"); form->bbox = pdf_to_rect(ctx, obj); - obj = fz_dict_gets(dict, "Matrix"); + obj = pdf_dict_gets(dict, "Matrix"); if (obj) form->matrix = pdf_to_matrix(ctx, obj); else @@ -71,19 +71,19 @@ pdf_load_xobject(pdf_document *xref, fz_obj *dict) form->knockout = 0; form->transparency = 0; - obj = fz_dict_gets(dict, "Group"); + obj = pdf_dict_gets(dict, "Group"); if (obj) { - fz_obj *attrs = obj; + pdf_obj *attrs = obj; - form->isolated = fz_to_bool(fz_dict_gets(attrs, "I")); - form->knockout = fz_to_bool(fz_dict_gets(attrs, "K")); + form->isolated = pdf_to_bool(pdf_dict_gets(attrs, "I")); + form->knockout = pdf_to_bool(pdf_dict_gets(attrs, "K")); - obj = fz_dict_gets(attrs, "S"); - if (fz_is_name(obj) && !strcmp(fz_to_name(obj), "Transparency")) + obj = pdf_dict_gets(attrs, "S"); + if (pdf_is_name(obj) && !strcmp(pdf_to_name(obj), "Transparency")) form->transparency = 1; - obj = fz_dict_gets(attrs, "CS"); + obj = pdf_dict_gets(attrs, "CS"); if (obj) { form->colorspace = pdf_load_colorspace(xref, obj); @@ -92,21 +92,21 @@ pdf_load_xobject(pdf_document *xref, fz_obj *dict) } } - form->resources = fz_dict_gets(dict, "Resources"); + form->resources = pdf_dict_gets(dict, "Resources"); if (form->resources) - fz_keep_obj(form->resources); + pdf_keep_obj(form->resources); fz_try(ctx) { - form->contents = pdf_load_stream(xref, fz_to_num(dict), fz_to_gen(dict)); + form->contents = pdf_load_stream(xref, pdf_to_num(dict), pdf_to_gen(dict)); } fz_catch(ctx) { pdf_remove_item(ctx, pdf_free_xobject_imp, dict); pdf_drop_xobject(ctx, form); - fz_throw(ctx, "cannot load xobject content stream (%d %d R)", fz_to_num(dict), fz_to_gen(dict)); + fz_throw(ctx, "cannot load xobject content stream (%d %d R)", pdf_to_num(dict), pdf_to_gen(dict)); } - form->me = fz_keep_obj(dict); + form->me = pdf_keep_obj(dict); return form; } |