diff options
Diffstat (limited to 'pcl/pccrd.c')
-rw-r--r-- | pcl/pccrd.c | 97 |
1 files changed, 9 insertions, 88 deletions
diff --git a/pcl/pccrd.c b/pcl/pccrd.c index 63cd9453a..91d0d9267 100644 --- a/pcl/pccrd.c +++ b/pcl/pccrd.c @@ -24,19 +24,6 @@ private_st_crd_t(); /* - * Unlike other elements of the PCL "palette", color rendering dictionaries - * are for the most part not a feature that can be controlled from the language. - * Except for the white point, the parameters of a color rendering dictionary - * are determined by the output device rather than the language. - * - * To accommodate this situation, the device-specific or default color - * rendering dictionary is maintained as a global. When used as part of a - * palette, this global should be "copied" using the copy_from macro provided - * below. - */ -pcl_crd_t * pcl_default_crd; - -/* * The default color rendering information. This works for a monitor that * uses linear SMPTE-C phosphors. This is almost certainly not the case for * any actual printing device, but the approximation will do for now. @@ -67,13 +54,6 @@ private const gs_matrix3 dflt_MatrixLMN = { { 3.51, -1.07, 0.06 }, * which accepts the the component index as an operand. Rather than returning * the mapped value, the location pointed to by pnew_val is used to hold the * result and a success (0) or error (< 0) indication is returned. - * - * The final field of the TransformPQR data structure must be writable, so - * that the driver can insert its own name in this location. To support - * environements in which all initialized globals are in ROM, two copies - * of this structure are maintained: a prototype (qualified as const) and - * the actual value. The former is copied into the latter each time a CRD - * using this structure is created. */ private int dflt_TransformPQR_proc( @@ -98,9 +78,6 @@ private const gs_cie_transform_proc3 dflt_TransformPQR_proto = { NULL }; -private gs_cie_transform_proc3 dflt_TransformPQR; - - /* * Free a PCL color rendering dictionary structure. */ @@ -229,7 +206,7 @@ pcl_crd_build_default_crd( pcl_state_t * pcs ) { - pcl_crd_t * pcrd = pcl_default_crd; + pcl_crd_t * pcrd = pcs->pcl_default_crd; int code = 0; /* must not be a current CRD */ @@ -239,19 +216,19 @@ pcl_crd_build_default_crd( /* allocate the CRD structure */ if ((code = alloc_crd(&pcrd, pcs->memory)) < 0) return code; - pcl_default_crd = pcrd; + pcs->pcl_default_crd = pcrd; if (read_device_CRD(pcrd, pcs)) return 0; else { - dflt_TransformPQR = dflt_TransformPQR_proto; + pcs->dflt_TransformPQR = dflt_TransformPQR_proto; return gs_cie_render1_initialize( pcrd->pgscrd, NULL, &dflt_WhitePoint, NULL, NULL, NULL, - &dflt_TransformPQR, + &pcs->dflt_TransformPQR, &dflt_MatrixLMN, NULL, NULL, @@ -264,63 +241,6 @@ pcl_crd_build_default_crd( } /* - * Build a CRD with device-provided parameters, but with the default PCL - * white point. - * - * Note that this is one of the few routines which accepts a memory pointer - * operand but does not have it as the last operand. - * - * Any operands set to NULL will be given their graphic library defaults - * (which may not be the same as their values in the default PCL CRD). - * - * Returns 0 on success, < 0 in the event of an error. - */ - int -pcl_crd_build_dev_crd( - gs_memory_t * pmem, - const gs_vector3 * BlackPoint, - const gs_matrix3 * MatrixPQR, - const gs_range3 * RangePQR, - const gs_cie_transform_proc3 * TransformPQR, - const gs_matrix3 * MatrixLMN, - const gs_cie_render_proc3 * EncodeLMN, - const gs_range3 * RangeLMN, - const gs_matrix3 * MatrixABC, - const gs_cie_render_proc3 * EncodeABC, - const gs_range3 * RangeABC, - const gs_cie_render_table_t * RenderTable -) -{ - pcl_crd_t * pcrd = pcl_default_crd; - int code = 0; - - /* release any existing CRD */ - if (pcrd != 0) - rc_decrement(pcrd, "pcl build device specific CRD"); - - /* allocate the CRD structure */ - if ((code = alloc_crd(&pcrd, pmem)) < 0) - return code; - - pcl_default_crd = pcrd; - return gs_cie_render1_initialize( pcrd->pgscrd, - NULL, /* for now */ - &dflt_WhitePoint, - BlackPoint, - MatrixPQR, - RangePQR, - TransformPQR, - MatrixLMN, - EncodeLMN, - RangeLMN, - MatrixABC, - EncodeABC, - RangeABC, - RenderTable - ); -} - -/* * Set the viewing illuminant. * * Though this code goes through the motions of an "unshare" operation, it @@ -331,6 +251,7 @@ pcl_crd_build_dev_crd( */ int pcl_crd_set_view_illuminant( + pcl_state_t * pcs, pcl_crd_t ** ppcrd, const gs_vector3 * pwht_pt ) @@ -348,14 +269,14 @@ pcl_crd_set_view_illuminant( /* if no previous CRD, use the default settings */ if (pold == 0) { - dflt_TransformPQR = dflt_TransformPQR_proto; + pcs->dflt_TransformPQR = dflt_TransformPQR_proto; return gs_cie_render1_initialize( pcrd->pgscrd, NULL, pwht_pt, NULL, NULL, NULL, - &dflt_TransformPQR, + &pcs->dflt_TransformPQR, &dflt_MatrixLMN, NULL, NULL, @@ -403,10 +324,10 @@ pcl_crd_set_crd( int code = 0; if (pcrd == 0) { - if ( (pcl_default_crd == 0) && + if ( (pcs->pcl_default_crd == 0) && ((code = pcl_crd_build_default_crd(pcs)) < 0) ) return code; - pcrd = pcl_default_crd; + pcrd = pcs->pcl_default_crd; pcl_crd_init_from(*ppcrd, pcrd); } |