diff options
Diffstat (limited to 'source/xps/xps-tile.c')
-rw-r--r-- | source/xps/xps-tile.c | 57 |
1 files changed, 33 insertions, 24 deletions
diff --git a/source/xps/xps-tile.c b/source/xps/xps-tile.c index e5b3bed7..f0e196a0 100644 --- a/source/xps/xps-tile.c +++ b/source/xps/xps-tile.c @@ -299,28 +299,33 @@ xps_parse_canvas(fz_context *ctx, xps_document *doc, const fz_matrix *ctm, const opacity_mask_tag = fz_xml_down(node); } - opacity_mask_uri = base_uri; - xps_resolve_resource_reference(ctx, doc, dict, &transform_att, &transform_tag, NULL); - xps_resolve_resource_reference(ctx, doc, dict, &clip_att, &clip_tag, NULL); - xps_resolve_resource_reference(ctx, doc, dict, &opacity_mask_att, &opacity_mask_tag, &opacity_mask_uri); - - xps_parse_transform(ctx, doc, transform_att, transform_tag, &local_ctm, ctm); + fz_try(ctx) + { + opacity_mask_uri = base_uri; + xps_resolve_resource_reference(ctx, doc, dict, &transform_att, &transform_tag, NULL); + xps_resolve_resource_reference(ctx, doc, dict, &clip_att, &clip_tag, NULL); + xps_resolve_resource_reference(ctx, doc, dict, &opacity_mask_att, &opacity_mask_tag, &opacity_mask_uri); - if (clip_att || clip_tag) - xps_clip(ctx, doc, &local_ctm, dict, clip_att, clip_tag); + xps_parse_transform(ctx, doc, transform_att, transform_tag, &local_ctm, ctm); - xps_begin_opacity(ctx, doc, &local_ctm, area, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); + if (clip_att || clip_tag) + xps_clip(ctx, doc, &local_ctm, dict, clip_att, clip_tag); - for (node = fz_xml_down(root); node; node = fz_xml_next(node)) - xps_parse_element(ctx, doc, &local_ctm, area, base_uri, dict, node); + xps_begin_opacity(ctx, doc, &local_ctm, area, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); - xps_end_opacity(ctx, doc, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); + for (node = fz_xml_down(root); node; node = fz_xml_next(node)) + xps_parse_element(ctx, doc, &local_ctm, area, base_uri, dict, node); - if (clip_att || clip_tag) - fz_pop_clip(ctx, dev); + xps_end_opacity(ctx, doc, opacity_mask_uri, dict, opacity_att, opacity_mask_tag); - if (new_dict) + if (clip_att || clip_tag) + fz_pop_clip(ctx, dev); + } + fz_always(ctx) xps_drop_resource_dictionary(ctx, doc, new_dict); + fz_catch(ctx) + fz_rethrow(ctx); + } void @@ -349,20 +354,24 @@ xps_parse_fixed_page(fz_context *ctx, xps_document *doc, const fz_matrix *ctm, x area = fz_unit_rect; fz_transform_rect(&area, fz_scale(&scm, page->fix->width, page->fix->height)); - for (node = fz_xml_down(page->root); node; node = fz_xml_next(node)) + fz_try(ctx) { - if (fz_xml_is_tag(node, "FixedPage.Resources") && fz_xml_down(node)) + for (node = fz_xml_down(page->root); node; node = fz_xml_next(node)) { - if (dict) - fz_warn(ctx, "ignoring follow-up resource dictionaries"); - else - dict = xps_parse_resource_dictionary(ctx, doc, base_uri, fz_xml_down(node)); + if (fz_xml_is_tag(node, "FixedPage.Resources") && fz_xml_down(node)) + { + if (dict) + fz_warn(ctx, "ignoring follow-up resource dictionaries"); + else + dict = xps_parse_resource_dictionary(ctx, doc, base_uri, fz_xml_down(node)); + } + xps_parse_element(ctx, doc, ctm, &area, base_uri, dict, node); } - xps_parse_element(ctx, doc, ctm, &area, base_uri, dict, node); } - - if (dict) + fz_always(ctx) xps_drop_resource_dictionary(ctx, doc, dict); + fz_catch(ctx) + fz_rethrow(ctx); } void |