diff options
author | Michael Vrhel <michael.vrhel@artifex.com> | 2012-01-23 09:59:35 -0800 |
---|---|---|
committer | Michael Vrhel <michael.vrhel@artifex.com> | 2012-01-23 09:59:35 -0800 |
commit | 89546758c858d53c105dfc73fc4d108171b8437d (patch) | |
tree | 54591e159d4923f2890bf23d1dec13aa889fac0c | |
parent | 315a899b2f9bd8be2f247550a05d807a8c698f07 (diff) |
Addition of objects to support the output intent.
This doesn't do anything yet. There will be another commit for the
PDF interpreter to make use of these objects.
-rw-r--r-- | gs/base/gdevp14.c | 1 | ||||
-rw-r--r-- | gs/base/gscms.h | 2 | ||||
-rw-r--r-- | gs/base/gsdparam.c | 37 | ||||
-rw-r--r-- | gs/base/gsequivc.c | 2 | ||||
-rw-r--r-- | gs/base/gsicc_manage.c | 6 |
5 files changed, 47 insertions, 1 deletions
diff --git a/gs/base/gdevp14.c b/gs/base/gdevp14.c index 20185424f..9ea6cdcaa 100644 --- a/gs/base/gdevp14.c +++ b/gs/base/gdevp14.c @@ -1797,6 +1797,7 @@ gs_pdf14_device_copy_params(gx_device *dev, const gx_device *target) &(profile_targ)); profile_dev14->device_profile[0] = profile_targ->device_profile[0]; dev->icc_struct->devicegraytok = profile_targ->devicegraytok; + dev->icc_struct->pdfx3 = profile_targ->pdfx3; gx_monitor_enter(profile_dev14->device_profile[0]->lock); rc_increment(profile_dev14->device_profile[0]); gx_monitor_leave(profile_dev14->device_profile[0]->lock); diff --git a/gs/base/gscms.h b/gs/base/gscms.h index 2caeb35cb..041d3ff83 100644 --- a/gs/base/gscms.h +++ b/gs/base/gscms.h @@ -156,9 +156,11 @@ typedef struct cmm_dev_profile_s { cmm_profile_t *device_profile[NUM_DEVICE_PROFILES]; cmm_profile_t *proof_profile; cmm_profile_t *link_profile; + cmm_profile_t *oi_profile; gsicc_rendering_intents_t intent[NUM_DEVICE_PROFILES]; bool devicegraytok; /* Used for forcing gray to pure black */ bool usefastcolor; /* Used when we want to use no cm */ + bool pdfx3; /* To indicate use of pdfx3 output intent */ gs_memory_t *memory; rc_header rc; } cmm_dev_profile_t; diff --git a/gs/base/gsdparam.c b/gs/base/gsdparam.c index 4c44ef99a..4f51f1ba9 100644 --- a/gs/base/gsdparam.c +++ b/gs/base/gsdparam.c @@ -82,6 +82,7 @@ gx_default_get_params(gx_device * dev, gs_param_list * plist) gsicc_rendering_intents_t profile_intents[NUM_DEVICE_PROFILES]; bool devicegraytok = true; /* Default if device profile stuct not set */ bool usefastcolor = false; /* set for unmanaged color */ + bool pdfx3 = false; int k; gs_param_float_array msa, ibba, hwra, ma; gs_param_string_array scna; @@ -165,6 +166,7 @@ gx_default_get_params(gx_device * dev, gs_param_list * plist) } devicegraytok = dev_profile->devicegraytok; usefastcolor = dev_profile->usefastcolor; + pdfx3 = dev_profile->pdfx3; } else { for (k = 0; k < NUM_DEVICE_PROFILES; k++) { param_string_from_string(profile_array[k], null_str); @@ -200,6 +202,7 @@ gx_default_get_params(gx_device * dev, gs_param_list * plist) /* Note: if change is made in NUM_DEVICE_PROFILES we need to name that profile here for the device parameter on the command line */ (code = param_write_bool(plist, "DeviceGrayToK", &devicegraytok)) < 0 || + (code = param_write_bool(plist, "UsePDFX3OI", &pdfx3)) < 0 || (code = param_write_bool(plist, "UseFastColor", &usefastcolor)) < 0 || (code = param_write_string(plist,"OutputICCProfile", &(profile_array[0]))) < 0 || (code = param_write_string(plist,"GraphicICCProfile", &(profile_array[1]))) < 0 || @@ -479,7 +482,36 @@ gs_putdeviceparams(gx_device * dev, gs_param_list * plist) code = (*dev_proc(dev, put_params)) (dev, plist); return (code < 0 ? code : was_open && !dev->is_open ? 1 : code); } - + +static void +gx_default_put_pdfx3(bool pdfx3, gx_device * dev) +{ + int code; + cmm_dev_profile_t *profile_struct; + + if (dev->procs.get_profile == NULL) { + /* This is an odd case where the device has not yet fully been + set up with its procedures yet. We want to make sure that + we catch this so we assume here that we are dealing with + the target device. For now allocate the profile structure + but do not intialize the profile yet as the color info + may not be fully set up at this time. */ + if (dev->icc_struct == NULL) { + /* Allocate at this time the structure */ + dev->icc_struct = gsicc_new_device_profile_array(dev->memory); + } + dev->icc_struct->pdfx3 = pdfx3; + } else { + code = dev_proc(dev, get_profile)(dev, &profile_struct); + if (profile_struct == NULL) { + /* Create now */ + dev->icc_struct = gsicc_new_device_profile_array(dev->memory); + profile_struct = dev->icc_struct; + } + profile_struct->pdfx3 = pdfx3; + } +} + static void gx_default_put_graytok(bool graytok, gx_device * dev) { @@ -632,6 +664,7 @@ gx_default_put_params(gx_device * dev, gs_param_list * plist) int k; bool devicegraytok = true; bool usefastcolor = false; + bool pdfx3 = false; if (dev->icc_struct != NULL) { for (k = 0; k < NUM_DEVICE_PROFILES; k++) { @@ -639,6 +672,7 @@ gx_default_put_params(gx_device * dev, gs_param_list * plist) } devicegraytok = dev->icc_struct->devicegraytok; usefastcolor = dev->icc_struct->usefastcolor; + pdfx3 = dev->icc_struct->pdfx3; } else { for (k = 0; k < NUM_DEVICE_PROFILES; k++) { rend_intent[k] = gsPERCEPTUAL; @@ -1071,6 +1105,7 @@ nce: } gx_default_put_graytok(devicegraytok, dev); gx_default_put_usefastcolor(usefastcolor, dev); + gx_default_put_pdfx3(pdfx3, dev); return 0; } diff --git a/gs/base/gsequivc.c b/gs/base/gsequivc.c index 8e0d127c8..b5c971c97 100644 --- a/gs/base/gsequivc.c +++ b/gs/base/gsequivc.c @@ -406,6 +406,8 @@ capture_spot_equivalent_cmyk_colors(gx_device * pdev, const gs_state * pgs, temp_profile.device_profile[2] = NULL; temp_profile.link_profile = NULL; temp_profile.proof_profile = NULL; + temp_profile.oi_profile = NULL; + temp_profile.pdfx3 = false; temp_device.icc_struct = &temp_profile; set_dev_proc(&temp_device, get_profile, gx_default_get_profile); diff --git a/gs/base/gsicc_manage.c b/gs/base/gsicc_manage.c index c27fd6096..b475d526e 100644 --- a/gs/base/gsicc_manage.c +++ b/gs/base/gsicc_manage.c @@ -966,6 +966,10 @@ rc_free_profile_array(gs_memory_t * mem, void *ptr_in, client_name_t cname) if_debug0(gs_debug_flag_icc,"[icc] Releasing proof profile\n"); rc_decrement(icc_struct->proof_profile, "rc_free_profile_array"); } + if (icc_struct->oi_profile != NULL) { + if_debug0(gs_debug_flag_icc,"[icc] Releasing output intent profile\n"); + rc_decrement(icc_struct->oi_profile, "rc_free_profile_array"); + } if_debug0(gs_debug_flag_icc,"[icc] Releasing device profile struct\n"); gs_free_object(mem_nongc, icc_struct, "rc_free_profile_array"); } @@ -990,8 +994,10 @@ gsicc_new_device_profile_array(gs_memory_t *memory) } result->proof_profile = NULL; result->link_profile = NULL; + result->oi_profile = NULL; result->devicegraytok = true; /* Default is to map gray to pure K */ result->usefastcolor = false; /* Default is to not use fast color */ + result->pdfx3 = false; rc_init_free(result, memory->non_gc_memory, 1, rc_free_profile_array); return(result); } |