diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2017-01-27 12:17:00 -0800 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2017-01-30 09:59:55 -0800 |
commit | 8cde4bc582904132bd8bb78e6c5da5ab2ebdb6ce (patch) | |
tree | f9bae244fe598ebfec216349eaad0d165b36cd46 /xps/xpspage.c | |
parent | 827ab0227853b9ee5491ceb76b178757aa2ab733 (diff) | |
download | ghostpdl-8cde4bc582904132bd8bb78e6c5da5ab2ebdb6ce.tar.gz |
XPS Transparency check
The XPS interpreter code was not setting the device param to
indicate if a page had transparency. As such, the fact that
a page had transparency was not getting used in the decision
to invoke or not invoke the command list.
Diffstat (limited to 'xps/xpspage.c')
-rw-r--r-- | xps/xpspage.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/xps/xpspage.c b/xps/xpspage.c index 0320f609d..1b5613c41 100644 --- a/xps/xpspage.c +++ b/xps/xpspage.c @@ -124,7 +124,7 @@ xps_parse_fixed_page(xps_context_t *ctx, xps_part_t *part) char *height_att; char base_uri[1024]; char *s; - int code; + int code, code1, code2; if_debug1m('|', ctx->memory, "doc: parsing page %s\n", part->name); @@ -188,15 +188,33 @@ xps_parse_fixed_page(xps_context_t *ctx, xps_part_t *part) fa.data = fv; fa.size = 2; - code = param_write_float_array((gs_param_list *)&list, ".MediaSize", &fa); - if ( code >= 0 ) + /* Pre-parse looking for transparency */ + ctx->has_transparency = false; + for (node = xps_down(root); node; node = xps_next(node)) + { + if (!strcmp(xps_tag(node), "FixedPage.Resources") && xps_down(node)) + if (xps_resource_dictionary_has_transparency(ctx, base_uri, xps_down(node))) + { + ctx->has_transparency = true; + break; + } + if (xps_element_has_transparency(ctx, base_uri, node)) + { + ctx->has_transparency = true; + break; + } + } + + code1 = param_write_bool((gs_param_list *)&list, "PageUsesTransparency", &(ctx->has_transparency)); + code2 = param_write_float_array((gs_param_list *)&list, ".MediaSize", &fa); + if ( code1 >= 0 || code2 >= 0) { gs_c_param_list_read(&list); code = gs_putdeviceparams(dev, (gs_param_list *)&list); if (code < 0) { gs_c_param_list_release(&list); xps_free_item(ctx, root); - return gs_rethrow(code, "cannot set media size"); + return gs_rethrow(code, "cannot set device parameters"); } } gs_c_param_list_release(&list); @@ -227,25 +245,6 @@ xps_parse_fixed_page(xps_context_t *ctx, xps_part_t *part) } } - /* Pre-parse looking for transparency */ - - ctx->has_transparency = 0; - - for (node = xps_down(root); node; node = xps_next(node)) - { - if (!strcmp(xps_tag(node), "FixedPage.Resources") && xps_down(node)) - if (xps_resource_dictionary_has_transparency(ctx, base_uri, xps_down(node))) - { - ctx->has_transparency = 1; - break; - } - if (xps_element_has_transparency(ctx, base_uri, node)) - { - ctx->has_transparency = 1; - break; - } - } - /* save the state with the original device before we push */ gs_gsave(ctx->pgs); |