diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2011-08-13 10:15:17 -0700 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2011-08-14 19:35:40 -0700 |
commit | 3c15d3495e4e47a41938710bf2657d0c674f1e55 (patch) | |
tree | e899de98e2544df380a8af0d546c7ccc279a7d66 | |
parent | 97aef7a14df2e7e552592cf4a79c28747948d106 (diff) |
Fix for bug 692392. This makes sure that the transfer function is only applied to the K channel when we are mapping gray to CMYK.
Also fix for case in which interpolation of 12bit images does not work when using the ICC rendering operation.
-rw-r--r-- | gs/base/gdevp14.c | 6 | ||||
-rw-r--r-- | gs/base/gdevplnx.c | 5 | ||||
-rw-r--r-- | gs/base/gsciemap.c | 6 | ||||
-rw-r--r-- | gs/base/gsequivc.c | 3 | ||||
-rw-r--r-- | gs/base/gsicc.c | 2 | ||||
-rw-r--r-- | gs/base/gxcmap.c | 41 | ||||
-rw-r--r-- | gs/base/gxcmap.h | 8 | ||||
-rw-r--r-- | gs/base/gxi12bit.c | 2 | ||||
-rw-r--r-- | gs/base/gxiscale.c | 3 | ||||
-rw-r--r-- | gs/base/lib.mak | 3 |
10 files changed, 59 insertions, 20 deletions
diff --git a/gs/base/gdevp14.c b/gs/base/gdevp14.c index 13ca28eb4..3ae3a18e9 100644 --- a/gs/base/gdevp14.c +++ b/gs/base/gdevp14.c | |||
@@ -4402,7 +4402,8 @@ pdf14_cmap_rgb_direct(frac r, frac g, frac b, gx_device_color * pdc, | |||
4402 | 4402 | ||
4403 | static void | 4403 | static void |
4404 | pdf14_cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc, | 4404 | pdf14_cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc, |
4405 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select) | 4405 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select, |
4406 | const gs_color_space *pcs) | ||
4406 | { | 4407 | { |
4407 | int i,ncomps; | 4408 | int i,ncomps; |
4408 | frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 4409 | frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; |
@@ -4528,7 +4529,8 @@ pdf14_cmap_rgb_direct_group(frac r, frac g, frac b, gx_device_color * pdc, | |||
4528 | /* color mapping for when we have an smask or a isolated transparency group with another color space */ | 4529 | /* color mapping for when we have an smask or a isolated transparency group with another color space */ |
4529 | static void | 4530 | static void |
4530 | pdf14_cmap_cmyk_direct_group(frac c, frac m, frac y, frac k, gx_device_color * pdc, | 4531 | pdf14_cmap_cmyk_direct_group(frac c, frac m, frac y, frac k, gx_device_color * pdc, |
4531 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select) | 4532 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select, |
4533 | const gs_color_space *pcs) | ||
4532 | { | 4534 | { |
4533 | int i, ncomps = dev->color_info.num_components; | 4535 | int i, ncomps = dev->color_info.num_components; |
4534 | frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 4536 | frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; |
diff --git a/gs/base/gdevplnx.c b/gs/base/gdevplnx.c index 655ba0219..ff03cc342 100644 --- a/gs/base/gdevplnx.c +++ b/gs/base/gdevplnx.c | |||
@@ -860,7 +860,8 @@ plane_cmap_rgb(frac r, frac g, frac b, gx_device_color * pdc, | |||
860 | } | 860 | } |
861 | static void | 861 | static void |
862 | plane_cmap_cmyk(frac c, frac m, frac y, frac k, gx_device_color * pdc, | 862 | plane_cmap_cmyk(frac c, frac m, frac y, frac k, gx_device_color * pdc, |
863 | const gs_imager_state *pis_image, gx_device *dev, gs_color_select_t select) | 863 | const gs_imager_state *pis_image, gx_device *dev, gs_color_select_t select, |
864 | const gs_color_space *source_pcs) | ||
864 | { | 865 | { |
865 | const plane_image_enum_t *ppie = | 866 | const plane_image_enum_t *ppie = |
866 | (const plane_image_enum_t *)pis_image->client_data; | 867 | (const plane_image_enum_t *)pis_image->client_data; |
@@ -870,7 +871,7 @@ plane_cmap_cmyk(frac c, frac m, frac y, frac k, gx_device_color * pdc, | |||
870 | gx_device_color dcolor; | 871 | gx_device_color dcolor; |
871 | 872 | ||
872 | gx_remap_concrete_cmyk(c, m, y, k, &dcolor, ppie->pis, | 873 | gx_remap_concrete_cmyk(c, m, y, k, &dcolor, ppie->pis, |
873 | (gx_device *)edev, select); | 874 | (gx_device *)edev, select, NULL); |
874 | reduce_drawing_color(pdc, edev, &dcolor, &lop); | 875 | reduce_drawing_color(pdc, edev, &dcolor, &lop); |
875 | } | 876 | } |
876 | static void | 877 | static void |
diff --git a/gs/base/gsciemap.c b/gs/base/gsciemap.c index dced18d82..0e1e98ebe 100644 --- a/gs/base/gsciemap.c +++ b/gs/base/gsciemap.c | |||
@@ -211,6 +211,7 @@ gx_ciedefg_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *m | |||
211 | gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data); | 211 | gsicc_init_profile_info((*ppcs_icc)->cmm_icc_profile_data); |
212 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_DEFG; | 212 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_DEFG; |
213 | pcs->icc_equivalent = *ppcs_icc; | 213 | pcs->icc_equivalent = *ppcs_icc; |
214 | pcs->icc_equivalent->cmm_icc_profile_data->data_cs = gsCMYK; | ||
214 | return(0); | 215 | return(0); |
215 | } | 216 | } |
216 | 217 | ||
@@ -481,6 +482,7 @@ gx_ciedef_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *me | |||
481 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_DEF; | 482 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_DEF; |
482 | /* Assign to the icc_equivalent member variable */ | 483 | /* Assign to the icc_equivalent member variable */ |
483 | pcs->icc_equivalent = *ppcs_icc; | 484 | pcs->icc_equivalent = *ppcs_icc; |
485 | pcs->icc_equivalent->cmm_icc_profile_data->data_cs = gsUNDEFINED; | ||
484 | return(0); | 486 | return(0); |
485 | } | 487 | } |
486 | 488 | ||
@@ -577,7 +579,8 @@ gx_cieabc_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, bool *islab, | |||
577 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_ABC; | 579 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_ABC; |
578 | /* Assign to the icc_equivalent member variable */ | 580 | /* Assign to the icc_equivalent member variable */ |
579 | pcs->icc_equivalent = *ppcs_icc; | 581 | pcs->icc_equivalent = *ppcs_icc; |
580 | return(0); | 582 | pcs->icc_equivalent->cmm_icc_profile_data->data_cs = gsRGB; |
583 | return(0); | ||
581 | } | 584 | } |
582 | 585 | ||
583 | /* Render a CIEBasedABC color. */ | 586 | /* Render a CIEBasedABC color. */ |
@@ -676,6 +679,7 @@ gx_ciea_to_icc(gs_color_space **ppcs_icc, gs_color_space *pcs, gs_memory_t *memo | |||
676 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_A; | 679 | (*ppcs_icc)->cmm_icc_profile_data->default_match = CIE_A; |
677 | /* Assign to the icc_equivalent member variable */ | 680 | /* Assign to the icc_equivalent member variable */ |
678 | pcs->icc_equivalent = *ppcs_icc; | 681 | pcs->icc_equivalent = *ppcs_icc; |
682 | pcs->icc_equivalent->cmm_icc_profile_data->data_cs = gsGRAY; | ||
679 | return(code); | 683 | return(code); |
680 | } | 684 | } |
681 | 685 | ||
diff --git a/gs/base/gsequivc.c b/gs/base/gsequivc.c index 005661edc..70061a2f3 100644 --- a/gs/base/gsequivc.c +++ b/gs/base/gsequivc.c | |||
@@ -329,7 +329,8 @@ cmap_rgb_capture_cmyk_color(frac r, frac g, frac b, gx_device_color * pdc, | |||
329 | 329 | ||
330 | static void | 330 | static void |
331 | cmap_cmyk_capture_cmyk_color(frac c, frac m, frac y, frac k, gx_device_color * pdc, | 331 | cmap_cmyk_capture_cmyk_color(frac c, frac m, frac y, frac k, gx_device_color * pdc, |
332 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select) | 332 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select, |
333 | const gs_color_space *pcs) | ||
333 | { | 334 | { |
334 | equivalent_cmyk_color_params * pparams = | 335 | equivalent_cmyk_color_params * pparams = |
335 | ((color_capture_device *)dev)->pequiv_cmyk_colors; | 336 | ((color_capture_device *)dev)->pequiv_cmyk_colors; |
diff --git a/gs/base/gsicc.c b/gs/base/gsicc.c index ed66d0444..6fe4c4224 100644 --- a/gs/base/gsicc.c +++ b/gs/base/gsicc.c | |||
@@ -290,7 +290,7 @@ gx_remap_concrete_ICC(const frac * pconc, const gs_color_space * pcs, | |||
290 | code = -1; | 290 | code = -1; |
291 | break; | 291 | break; |
292 | } | 292 | } |
293 | return(code); | 293 | return code; |
294 | } | 294 | } |
295 | 295 | ||
296 | /* | 296 | /* |
diff --git a/gs/base/gxcmap.c b/gs/base/gxcmap.c index 2b50b475e..b7c9143f0 100644 --- a/gs/base/gxcmap.c +++ b/gs/base/gxcmap.c | |||
@@ -736,7 +736,7 @@ gx_remap_concrete_DCMYK(const frac * pconc, const gs_color_space * pcs, | |||
736 | { | 736 | { |
737 | /****** IGNORE alpha ******/ | 737 | /****** IGNORE alpha ******/ |
738 | gx_remap_concrete_cmyk(pconc[0], pconc[1], pconc[2], pconc[3], pdc, | 738 | gx_remap_concrete_cmyk(pconc[0], pconc[1], pconc[2], pconc[3], pdc, |
739 | pis, dev, select); | 739 | pis, dev, select, pcs); |
740 | return 0; | 740 | return 0; |
741 | } | 741 | } |
742 | int | 742 | int |
@@ -755,7 +755,7 @@ gx_remap_DeviceCMYK(const gs_client_color * pc, const gs_color_space * pcs, | |||
755 | gx_unit_frac(pc->paint.values[1]), | 755 | gx_unit_frac(pc->paint.values[1]), |
756 | gx_unit_frac(pc->paint.values[2]), | 756 | gx_unit_frac(pc->paint.values[2]), |
757 | gx_unit_frac(pc->paint.values[3]), | 757 | gx_unit_frac(pc->paint.values[3]), |
758 | pdc, pis, dev, select); | 758 | pdc, pis, dev, select, pcs); |
759 | return 0; | 759 | return 0; |
760 | } | 760 | } |
761 | 761 | ||
@@ -917,12 +917,18 @@ cmap_rgb_direct(frac r, frac g, frac b, gx_device_color * pdc, | |||
917 | 917 | ||
918 | static void | 918 | static void |
919 | cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc, | 919 | cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc, |
920 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select) | 920 | const gs_imager_state * pis, gx_device * dev, gs_color_select_t select, |
921 | const gs_color_space *source_pcs) | ||
921 | { | 922 | { |
922 | int i, ncomps = dev->color_info.num_components; | 923 | int i, ncomps = dev->color_info.num_components; |
923 | frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 924 | frac cm_comps[GX_DEVICE_COLOR_MAX_COMPONENTS]; |
924 | gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 925 | gx_color_value cv[GX_DEVICE_COLOR_MAX_COMPONENTS]; |
925 | gx_color_index color; | 926 | gx_color_index color; |
927 | int black_index; | ||
928 | cmm_dev_profile_t *dev_profile; | ||
929 | gsicc_colorbuffer_t src_space = gsUNDEFINED; | ||
930 | int code; | ||
931 | bool gray_to_k; | ||
926 | 932 | ||
927 | /* map to the color model */ | 933 | /* map to the color model */ |
928 | for (i=0; i < ncomps; i++) | 934 | for (i=0; i < ncomps; i++) |
@@ -934,11 +940,30 @@ cmap_cmyk_direct(frac c, frac m, frac y, frac k, gx_device_color * pdc, | |||
934 | for (i = 0; i < ncomps; i++) | 940 | for (i = 0; i < ncomps; i++) |
935 | cm_comps[i] = gx_map_color_frac(pis, | 941 | cm_comps[i] = gx_map_color_frac(pis, |
936 | cm_comps[i], effective_transfer[i]); | 942 | cm_comps[i], effective_transfer[i]); |
937 | else | 943 | else { |
938 | for (i = 0; i < ncomps; i++) | 944 | /* Check if source space is gray. In this case we are to use only the |
939 | cm_comps[i] = frac_1 - gx_map_color_frac(pis, | 945 | transfer function on the K channel. Do this only if gray to K is |
940 | (frac)(frac_1 - cm_comps[i]), effective_transfer[i]); | 946 | also set */ |
941 | 947 | code = dev_proc(dev, get_profile)(dev, &dev_profile); | |
948 | gray_to_k = dev_profile->devicegraytok; | ||
949 | if (source_pcs != NULL && source_pcs->cmm_icc_profile_data != NULL) { | ||
950 | src_space = source_pcs->cmm_icc_profile_data->data_cs; | ||
951 | } else if (source_pcs != NULL && source_pcs->icc_equivalent != NULL) { | ||
952 | src_space = source_pcs->icc_equivalent->cmm_icc_profile_data->data_cs; | ||
953 | } | ||
954 | if (src_space == gsGRAY && gray_to_k) { | ||
955 | /* Find the black channel location */ | ||
956 | black_index = dev_proc(dev, get_color_comp_index)(dev, "Black", | ||
957 | strlen("Black"), SEPARATION_NAME); | ||
958 | cm_comps[black_index] = frac_1 - gx_map_color_frac(pis, | ||
959 | (frac)(frac_1 - cm_comps[black_index]), | ||
960 | effective_transfer[black_index]); | ||
961 | } else { | ||
962 | for (i = 0; i < ncomps; i++) | ||
963 | cm_comps[i] = frac_1 - gx_map_color_frac(pis, | ||
964 | (frac)(frac_1 - cm_comps[i]), effective_transfer[i]); | ||
965 | } | ||
966 | } | ||
942 | /* We make a test for direct vs. halftoned, rather than */ | 967 | /* We make a test for direct vs. halftoned, rather than */ |
943 | /* duplicating most of the code of this procedure. */ | 968 | /* duplicating most of the code of this procedure. */ |
944 | if (gx_device_must_halftone(dev)) { | 969 | if (gx_device_must_halftone(dev)) { |
diff --git a/gs/base/gxcmap.h b/gs/base/gxcmap.h index bc5fa8790..0b5cb99cd 100644 --- a/gs/base/gxcmap.h +++ b/gs/base/gxcmap.h | |||
@@ -20,6 +20,7 @@ | |||
20 | 20 | ||
21 | #include "gscsel.h" | 21 | #include "gscsel.h" |
22 | #include "gxfmap.h" | 22 | #include "gxfmap.h" |
23 | #include "gscspace.h" | ||
23 | 24 | ||
24 | #ifndef gx_device_DEFINED | 25 | #ifndef gx_device_DEFINED |
25 | # define gx_device_DEFINED | 26 | # define gx_device_DEFINED |
@@ -40,7 +41,8 @@ typedef struct gx_device_color_s gx_device_color; | |||
40 | gx_device *, gs_color_select_t) | 41 | gx_device *, gs_color_select_t) |
41 | #define cmap_proc_cmyk(proc)\ | 42 | #define cmap_proc_cmyk(proc)\ |
42 | void proc(frac, frac, frac, frac, gx_device_color *,\ | 43 | void proc(frac, frac, frac, frac, gx_device_color *,\ |
43 | const gs_imager_state *, gx_device *, gs_color_select_t) | 44 | const gs_imager_state *, gx_device *, gs_color_select_t,\ |
45 | const gs_color_space *) | ||
44 | #define cmap_proc_rgb_alpha(proc)\ | 46 | #define cmap_proc_rgb_alpha(proc)\ |
45 | void proc(frac, frac, frac, frac, gx_device_color *,\ | 47 | void proc(frac, frac, frac, frac, gx_device_color *,\ |
46 | const gs_imager_state *, gx_device *, gs_color_select_t) | 48 | const gs_imager_state *, gx_device *, gs_color_select_t) |
@@ -143,8 +145,8 @@ void gx_set_cmap_procs(gs_imager_state *, const gx_device *); | |||
143 | ((pis)->cmap_procs->map_gray)(cgray, pdc, pis, dev, select) | 145 | ((pis)->cmap_procs->map_gray)(cgray, pdc, pis, dev, select) |
144 | #define gx_remap_concrete_rgb(cr, cg, cb, pdc, pis, dev, select)\ | 146 | #define gx_remap_concrete_rgb(cr, cg, cb, pdc, pis, dev, select)\ |
145 | ((pis)->cmap_procs->map_rgb)(cr, cg, cb, pdc, pis, dev, select) | 147 | ((pis)->cmap_procs->map_rgb)(cr, cg, cb, pdc, pis, dev, select) |
146 | #define gx_remap_concrete_cmyk(cc, cm, cy, ck, pdc, pis, dev, select)\ | 148 | #define gx_remap_concrete_cmyk(cc, cm, cy, ck, pdc, pis, dev, select, pcs)\ |
147 | ((pis)->cmap_procs->map_cmyk)(cc, cm, cy, ck, pdc, pis, dev, select) | 149 | ((pis)->cmap_procs->map_cmyk)(cc, cm, cy, ck, pdc, pis, dev, select, pcs) |
148 | #define gx_remap_concrete_rgb_alpha(cr, cg, cb, ca, pdc, pis, dev, select)\ | 150 | #define gx_remap_concrete_rgb_alpha(cr, cg, cb, ca, pdc, pis, dev, select)\ |
149 | ((pis)->cmap_procs->map_rgb_alpha)(cr, cg, cb, ca, pdc, pis, dev, select) | 151 | ((pis)->cmap_procs->map_rgb_alpha)(cr, cg, cb, ca, pdc, pis, dev, select) |
150 | #define gx_remap_concrete_separation(pcc, pdc, pis, dev, select)\ | 152 | #define gx_remap_concrete_separation(pcc, pdc, pis, dev, select)\ |
diff --git a/gs/base/gxi12bit.c b/gs/base/gxi12bit.c index d2c496bcc..55e5367bc 100644 --- a/gs/base/gxi12bit.c +++ b/gs/base/gxi12bit.c | |||
@@ -291,7 +291,7 @@ image_render_frac(gx_image_enum * penum, const byte * buffer, int data_x, | |||
291 | (*map_cmyk) (next.v[0], next.v[1], | 291 | (*map_cmyk) (next.v[0], next.v[1], |
292 | next.v[2], next.v[3], | 292 | next.v[2], next.v[3], |
293 | pdevc_next, pis, dev, | 293 | pdevc_next, pis, dev, |
294 | gs_color_select_source); | 294 | gs_color_select_source, NULL); |
295 | goto f; | 295 | goto f; |
296 | } | 296 | } |
297 | decode_frac(next.v[0], cc, 0); | 297 | decode_frac(next.v[0], cc, 0); |
diff --git a/gs/base/gxiscale.c b/gs/base/gxiscale.c index 2b1fdd92b..02bd4a62f 100644 --- a/gs/base/gxiscale.c +++ b/gs/base/gxiscale.c | |||
@@ -96,6 +96,9 @@ gs_image_class_0_interpolate(gx_image_enum * penum) | |||
96 | use_icc = true; | 96 | use_icc = true; |
97 | } | 97 | } |
98 | } | 98 | } |
99 | if (!(penum->bps <= 8 || penum->bps == 16)) { | ||
100 | use_icc = false; | ||
101 | } | ||
99 | /* Do not allow mismatch in devices component output with the | 102 | /* Do not allow mismatch in devices component output with the |
100 | profile output size. For example sep device with CMYK profile should | 103 | profile output size. For example sep device with CMYK profile should |
101 | not go through the fast method */ | 104 | not go through the fast method */ |
diff --git a/gs/base/lib.mak b/gs/base/lib.mak index 6d2ff9743..2b0619e32 100644 --- a/gs/base/lib.mak +++ b/gs/base/lib.mak | |||
@@ -492,7 +492,8 @@ gscolor2_h=$(GLSRC)gscolor2.h $(gscindex_h) $(gsptype1_h) | |||
492 | gscsepr_h=$(GLSRC)gscsepr.h $(gscspace_h) | 492 | gscsepr_h=$(GLSRC)gscsepr.h $(gscspace_h) |
493 | gxdcconv_h=$(GLSRC)gxdcconv.h $(gxfrac_h) | 493 | gxdcconv_h=$(GLSRC)gxdcconv.h $(gxfrac_h) |
494 | gxfmap_h=$(GLSRC)gxfmap.h $(gsrefct_h) $(gsstype_h) $(gxfrac_h) $(gxtmap_h) | 494 | gxfmap_h=$(GLSRC)gxfmap.h $(gsrefct_h) $(gsstype_h) $(gxfrac_h) $(gxtmap_h) |
495 | gxcmap_h=$(GLSRC)gxcmap.h $(gscsel_h) $(gxcindex_h) $(gxcvalue_h) $(gxfmap_h) | 495 | gxcmap_h=$(GLSRC)gxcmap.h $(gscsel_h) $(gxcindex_h) $(gxcvalue_h) $(gxfmap_h)\ |
496 | $(gscspace_h) | ||
496 | gxistate_h=$(GLSRC)gxistate.h\ | 497 | gxistate_h=$(GLSRC)gxistate.h\ |
497 | $(gscsel_h) $(gsrefct_h) $(gsropt_h) $(gstparam_h) $(gxcvalue_h) $(gxcmap_h)\ | 498 | $(gscsel_h) $(gsrefct_h) $(gsropt_h) $(gstparam_h) $(gxcvalue_h) $(gxcmap_h)\ |
498 | $(gxfixed_h) $(gxline_h) $(gxmatrix_h) $(gxtmap_h) $(gscspace_h) $(gstrans_h)\ | 499 | $(gxfixed_h) $(gxline_h) $(gxmatrix_h) $(gxtmap_h) $(gscspace_h) $(gstrans_h)\ |