diff options
-rw-r--r-- | base/gxblend1.c | 79 |
1 files changed, 73 insertions, 6 deletions
diff --git a/base/gxblend1.c b/base/gxblend1.c index 441490644..3482eb18d 100644 --- a/base/gxblend1.c +++ b/base/gxblend1.c | |||
@@ -307,8 +307,17 @@ pdf14_preserve_backdrop(pdf14_buf *buf, pdf14_buf *tos, bool knockout_buff) | |||
307 | #endif | 307 | #endif |
308 | } | 308 | } |
309 | 309 | ||
310 | static void | 310 | typedef void (*compose_group_fn)(byte *tos_ptr, bool tos_isolated, int tos_planestride, int tos_rowstride, byte alpha, byte shape, gs_blend_mode_t blend_mode, bool tos_has_shape, |
311 | compose_group(byte *tos_ptr, bool tos_isolated, int tos_planestride, int tos_rowstride, byte alpha, byte shape, gs_blend_mode_t blend_mode, bool tos_has_shape, | 311 | int tos_shape_offset, int tos_alpha_g_offset, int tos_tag_offset, bool tos_has_tag, |
312 | byte *nos_ptr, bool nos_isolated, int nos_planestride, int nos_rowstride, byte *nos_alpha_g_ptr, bool nos_knockout, | ||
313 | int nos_shape_offset, int nos_tag_offset, | ||
314 | byte *mask_row_ptr, int has_mask, pdf14_buf *maskbuf, byte mask_bg_alpha, byte *mask_tr_fn, | ||
315 | byte *backdrop_ptr, | ||
316 | bool has_matte, int n_chan, bool additive, int num_spots, bool overprint, gx_color_index drawn_comps, int x0, int y0, int x1, int y1, | ||
317 | const pdf14_nonseparable_blending_procs_t *pblend_procs, pdf14_device *pdev); | ||
318 | |||
319 | static inline void | ||
320 | template_compose_group(byte *tos_ptr, bool tos_isolated, int tos_planestride, int tos_rowstride, byte alpha, byte shape, gs_blend_mode_t blend_mode, bool tos_has_shape, | ||
312 | int tos_shape_offset, int tos_alpha_g_offset, int tos_tag_offset, bool tos_has_tag, | 321 | int tos_shape_offset, int tos_alpha_g_offset, int tos_tag_offset, bool tos_has_tag, |
313 | byte *nos_ptr, bool nos_isolated, int nos_planestride, int nos_rowstride, byte *nos_alpha_g_ptr, bool nos_knockout, | 322 | byte *nos_ptr, bool nos_isolated, int nos_planestride, int nos_rowstride, byte *nos_alpha_g_ptr, bool nos_knockout, |
314 | int nos_shape_offset, int nos_tag_offset, | 323 | int nos_shape_offset, int nos_tag_offset, |
@@ -541,6 +550,57 @@ compose_group(byte *tos_ptr, bool tos_isolated, int tos_planestride, int tos_row | |||
541 | } | 550 | } |
542 | } | 551 | } |
543 | 552 | ||
553 | static void | ||
554 | compose_group_knockout(byte *tos_ptr, bool tos_isolated, int tos_planestride, int tos_rowstride, byte alpha, byte shape, gs_blend_mode_t blend_mode, bool tos_has_shape, | ||
555 | int tos_shape_offset, int tos_alpha_g_offset, int tos_tag_offset, bool tos_has_tag, | ||
556 | byte *nos_ptr, bool nos_isolated, int nos_planestride, int nos_rowstride, byte *nos_alpha_g_ptr, bool nos_knockout, | ||
557 | int nos_shape_offset, int nos_tag_offset, | ||
558 | byte *mask_row_ptr, int has_mask, pdf14_buf *maskbuf, byte mask_bg_alpha, byte *mask_tr_fn, | ||
559 | byte *backdrop_ptr, | ||
560 | bool has_matte, int n_chan, bool additive, int num_spots, bool overprint, gx_color_index drawn_comps, int x0, int y0, int x1, int y1, | ||
561 | const pdf14_nonseparable_blending_procs_t *pblend_procs, pdf14_device *pdev) | ||
562 | { | ||
563 | template_compose_group(tos_ptr, tos_isolated, tos_planestride, tos_rowstride, alpha, shape, blend_mode, tos_has_shape, | ||
564 | tos_shape_offset, tos_alpha_g_offset, tos_tag_offset, tos_has_tag, | ||
565 | nos_ptr, nos_isolated, nos_planestride, nos_rowstride, nos_alpha_g_ptr, /* nos_knockout = */1, | ||
566 | nos_shape_offset, nos_tag_offset, mask_row_ptr, has_mask, maskbuf, mask_bg_alpha, mask_tr_fn, | ||
567 | backdrop_ptr, has_matte, n_chan, additive, num_spots, overprint, drawn_comps, x0, y0, x1, y1, pblend_procs, pdev); | ||
568 | } | ||
569 | |||
570 | static void | ||
571 | compose_group_isolated_nonknockout(byte *tos_ptr, bool tos_isolated, int tos_planestride, int tos_rowstride, byte alpha, byte shape, gs_blend_mode_t blend_mode, bool tos_has_shape, | ||
572 | int tos_shape_offset, int tos_alpha_g_offset, int tos_tag_offset, bool tos_has_tag, | ||
573 | byte *nos_ptr, bool nos_isolated, int nos_planestride, int nos_rowstride, byte *nos_alpha_g_ptr, bool nos_knockout, | ||
574 | int nos_shape_offset, int nos_tag_offset, | ||
575 | byte *mask_row_ptr, int has_mask, pdf14_buf *maskbuf, byte mask_bg_alpha, byte *mask_tr_fn, | ||
576 | byte *backdrop_ptr, | ||
577 | bool has_matte, int n_chan, bool additive, int num_spots, bool overprint, gx_color_index drawn_comps, int x0, int y0, int x1, int y1, | ||
578 | const pdf14_nonseparable_blending_procs_t *pblend_procs, pdf14_device *pdev) | ||
579 | { | ||
580 | template_compose_group(tos_ptr, /* tos_isolated = */1, tos_planestride, tos_rowstride, alpha, shape, blend_mode, tos_has_shape, | ||
581 | tos_shape_offset, tos_alpha_g_offset, tos_tag_offset, tos_has_tag, | ||
582 | nos_ptr, nos_isolated, nos_planestride, nos_rowstride, nos_alpha_g_ptr, /* nos_knockout = */0, | ||
583 | nos_shape_offset, nos_tag_offset, mask_row_ptr, has_mask, maskbuf, mask_bg_alpha, mask_tr_fn, | ||
584 | backdrop_ptr, has_matte, n_chan, additive, num_spots, overprint, drawn_comps, x0, y0, x1, y1, pblend_procs, pdev); | ||
585 | } | ||
586 | |||
587 | static void | ||
588 | compose_group_nonisolated_nonknockout(byte *tos_ptr, bool tos_isolated, int tos_planestride, int tos_rowstride, byte alpha, byte shape, gs_blend_mode_t blend_mode, bool tos_has_shape, | ||
589 | int tos_shape_offset, int tos_alpha_g_offset, int tos_tag_offset, bool tos_has_tag, | ||
590 | byte *nos_ptr, bool nos_isolated, int nos_planestride, int nos_rowstride, byte *nos_alpha_g_ptr, bool nos_knockout, | ||
591 | int nos_shape_offset, int nos_tag_offset, | ||
592 | byte *mask_row_ptr, int has_mask, pdf14_buf *maskbuf, byte mask_bg_alpha, byte *mask_tr_fn, | ||
593 | byte *backdrop_ptr, | ||
594 | bool has_matte, int n_chan, bool additive, int num_spots, bool overprint, gx_color_index drawn_comps, int x0, int y0, int x1, int y1, | ||
595 | const pdf14_nonseparable_blending_procs_t *pblend_procs, pdf14_device *pdev) | ||
596 | { | ||
597 | template_compose_group(tos_ptr, /* tos_isolated = */0, tos_planestride, tos_rowstride, alpha, shape, blend_mode, tos_has_shape, | ||
598 | tos_shape_offset, tos_alpha_g_offset, tos_tag_offset, tos_has_tag, | ||
599 | nos_ptr, nos_isolated, nos_planestride, nos_rowstride, nos_alpha_g_ptr, /* nos_knockout = */0, | ||
600 | nos_shape_offset, nos_tag_offset, mask_row_ptr, has_mask, maskbuf, mask_bg_alpha, mask_tr_fn, | ||
601 | backdrop_ptr, has_matte, n_chan, additive, num_spots, overprint, drawn_comps, x0, y0, x1, y1, pblend_procs, pdev); | ||
602 | } | ||
603 | |||
544 | void | 604 | void |
545 | pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf, | 605 | pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf, |
546 | int x0, int x1, int y0, int y1, int n_chan, bool additive, | 606 | int x0, int x1, int y0, int y1, int n_chan, bool additive, |
@@ -576,10 +636,10 @@ pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf, | |||
576 | byte *backdrop_ptr = NULL; | 636 | byte *backdrop_ptr = NULL; |
577 | pdf14_device *pdev = (pdf14_device *)dev; | 637 | pdf14_device *pdev = (pdf14_device *)dev; |
578 | bool has_matte = false; | 638 | bool has_matte = false; |
579 | int width = x1 - x0;(void)width; | ||
580 | #if RAW_DUMP | 639 | #if RAW_DUMP |
581 | byte *composed_ptr = NULL; | 640 | byte *composed_ptr = NULL; |
582 | #endif | 641 | #endif |
642 | compose_group_fn fn; | ||
583 | 643 | ||
584 | if ((tos->n_chan == 0) || (nos->n_chan == 0)) | 644 | if ((tos->n_chan == 0) || (nos->n_chan == 0)) |
585 | return; | 645 | return; |
@@ -587,11 +647,11 @@ pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf, | |||
587 | if (nos->has_tags) | 647 | if (nos->has_tags) |
588 | if_debug7m('v', memory, | 648 | if_debug7m('v', memory, |
589 | "pdf14_pop_transparency_group y0 = %d, y1 = %d, w = %d, alpha = %d, shape = %d, tag = %d, bm = %d\n", | 649 | "pdf14_pop_transparency_group y0 = %d, y1 = %d, w = %d, alpha = %d, shape = %d, tag = %d, bm = %d\n", |
590 | y0, y1, width, alpha, shape, dev->graphics_type_tag & ~GS_DEVICE_ENCODES_TAGS, blend_mode); | 650 | y0, y1, x1 - x0, alpha, shape, dev->graphics_type_tag & ~GS_DEVICE_ENCODES_TAGS, blend_mode); |
591 | else | 651 | else |
592 | if_debug6m('v', memory, | 652 | if_debug6m('v', memory, |
593 | "pdf14_pop_transparency_group y0 = %d, y1 = %d, w = %d, alpha = %d, shape = %d, bm = %d\n", | 653 | "pdf14_pop_transparency_group y0 = %d, y1 = %d, w = %d, alpha = %d, shape = %d, bm = %d\n", |
594 | y0, y1, width, alpha, shape, blend_mode); | 654 | y0, y1, x1 - x0, alpha, shape, blend_mode); |
595 | if (!nos->has_shape) | 655 | if (!nos->has_shape) |
596 | nos_shape_offset = 0; | 656 | nos_shape_offset = 0; |
597 | if (!nos->has_tags) | 657 | if (!nos->has_tags) |
@@ -645,7 +705,14 @@ pdf14_compose_group(pdf14_buf *tos, pdf14_buf *nos, pdf14_buf *maskbuf, | |||
645 | } | 705 | } |
646 | #endif | 706 | #endif |
647 | 707 | ||
648 | compose_group(tos_ptr, tos_isolated, tos_planestride, tos->rowstride, alpha, shape, blend_mode, tos->has_shape, | 708 | if (nos_knockout) |
709 | fn = &compose_group_knockout; | ||
710 | else if (tos_isolated) | ||
711 | fn = &compose_group_isolated_nonknockout; | ||
712 | else | ||
713 | fn = &compose_group_nonisolated_nonknockout; | ||
714 | |||
715 | fn(tos_ptr, tos_isolated, tos_planestride, tos->rowstride, alpha, shape, blend_mode, tos->has_shape, | ||
649 | tos_shape_offset, tos_alpha_g_offset, tos_tag_offset, tos_has_tag, | 716 | tos_shape_offset, tos_alpha_g_offset, tos_tag_offset, tos_has_tag, |
650 | nos_ptr, nos_isolated, nos_planestride, nos->rowstride, nos_alpha_g_ptr, nos_knockout, | 717 | nos_ptr, nos_isolated, nos_planestride, nos->rowstride, nos_alpha_g_ptr, nos_knockout, |
651 | nos_shape_offset, nos_tag_offset, | 718 | nos_shape_offset, nos_tag_offset, |