summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--base/gdevp14.c62
1 files changed, 27 insertions, 35 deletions
diff --git a/base/gdevp14.c b/base/gdevp14.c
index 2a955dfec..42c7e9f30 100644
--- a/base/gdevp14.c
+++ b/base/gdevp14.c
@@ -7444,14 +7444,18 @@ map_components_to_colorants(const frac * pcc,
7444 7444
7445/* See Section 7.6.4 of PDF 1.7 spec */ 7445/* See Section 7.6.4 of PDF 1.7 spec */
7446static inline bool 7446static inline bool
7447pdf14_state_opaque(pdf14_device *pdev, const gs_gstate *pgs) 7447pdf14_state_opaque(gx_device *pdev, const gs_gstate *pgs)
7448{ 7448{
7449 return !(pdev->in_smask_construction || 7449 if (pgs->fillconstantalpha != 1.0 ||
7450 pdev->smask_constructed ||
7451 pgs->fillconstantalpha != 1.0 ||
7452 pgs->strokeconstantalpha != 1.0 || 7450 pgs->strokeconstantalpha != 1.0 ||
7453 !(pgs->blend_mode == BLEND_MODE_Normal || 7451 !(pgs->blend_mode == BLEND_MODE_Normal ||
7454 pgs->blend_mode == BLEND_MODE_CompatibleOverprint)); 7452 pgs->blend_mode == BLEND_MODE_CompatibleOverprint))
7453 return 0;
7454
7455 /* We can only be opaque if we're not in an SMask. */
7456 return dev_proc(pdev, dev_spec_op)(pdev,
7457 gxdso_in_smask,
7458 NULL, 0) != 1;
7455} 7459}
7456 7460
7457static void 7461static void
@@ -7475,16 +7479,12 @@ pdf14_cmap_gray_direct(frac gray, gx_device_color * pdc, const gs_gstate * pgs,
7475 /* map to the color model */ 7479 /* map to the color model */
7476 dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_gray(trans_device, gray, cm_comps); 7480 dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_gray(trans_device, gray, cm_comps);
7477 7481
7478 { 7482 if (pdf14_state_opaque(trans_device, pgs)) {
7479 pdf14_device *pdev = (pdf14_device *)trans_device; 7483 for (i = 0; i < ncomps; i++)
7480 7484 cv[i] = frac2cv(gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i]));
7481 if (pdf14_state_opaque(pdev, pgs)) { 7485 } else {
7482 for (i = 0; i < ncomps; i++) 7486 for (i = 0; i < ncomps; i++)
7483 cv[i] = frac2cv(gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i])); 7487 cv[i] = frac2cv(cm_comps[i]);
7484 } else {
7485 for (i = 0; i < ncomps; i++)
7486 cv[i] = frac2cv(cm_comps[i]);
7487 }
7488 } 7488 }
7489 7489
7490 /* If output device supports devn, we need to make sure we send it the 7490 /* If output device supports devn, we need to make sure we send it the
@@ -7522,16 +7522,12 @@ pdf14_cmap_rgb_direct(frac r, frac g, frac b, gx_device_color * pdc,
7522 /* map to the color model */ 7522 /* map to the color model */
7523 dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_rgb(trans_device, pgs, r, g, b, cm_comps); 7523 dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_rgb(trans_device, pgs, r, g, b, cm_comps);
7524 7524
7525 { 7525 if (pdf14_state_opaque(trans_device, pgs)) {
7526 pdf14_device *pdev = (pdf14_device *)trans_device; 7526 for (i = 0; i < ncomps; i++)
7527 7527 cv[i] = frac2cv(gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i]));
7528 if (pdf14_state_opaque(pdev, pgs)) { 7528 } else {
7529 for (i = 0; i < ncomps; i++) 7529 for (i = 0; i < ncomps; i++)
7530 cv[i] = frac2cv(gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i])); 7530 cv[i] = frac2cv(cm_comps[i]);
7531 } else {
7532 for (i = 0; i < ncomps; i++)
7533 cv[i] = frac2cv(cm_comps[i]);
7534 }
7535 } 7531 }
7536 7532
7537 /* If output device supports devn, we need to make sure we send it the 7533 /* If output device supports devn, we need to make sure we send it the
@@ -7572,16 +7568,12 @@ pdf14_cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc,
7572 if we are drawing with an opaque color. */ 7568 if we are drawing with an opaque color. */
7573 dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_cmyk(trans_device, c, m, y, k, cm_comps); 7569 dev_proc(trans_device, get_color_mapping_procs)(trans_device)->map_cmyk(trans_device, c, m, y, k, cm_comps);
7574 7570
7575 { 7571 if (pdf14_state_opaque(trans_device, pgs)) {
7576 pdf14_device *pdev = (pdf14_device *)trans_device; 7572 for (i = 0; i < ncomps; i++)
7577 7573 cv[i] = frac2cv(gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i]));
7578 if (pdf14_state_opaque(pdev, pgs)) { 7574 } else {
7579 for (i = 0; i < ncomps; i++) 7575 for (i = 0; i < ncomps; i++)
7580 cv[i] = frac2cv(gx_map_color_frac(pgs, cm_comps[i], effective_transfer[i])); 7576 cv[i] = frac2cv(cm_comps[i]);
7581 } else {
7582 for (i = 0; i < ncomps; i++)
7583 cv[i] = frac2cv(cm_comps[i]);
7584 }
7585 } 7577 }
7586 7578
7587 /* if output device supports devn, we need to make sure we send it the 7579 /* if output device supports devn, we need to make sure we send it the