summaryrefslogtreecommitdiff
path: root/base/gxcmap.h
diff options
context:
space:
mode:
authorChris Liddell <chris.liddell@artifex.com>2016-02-24 12:50:47 +0000
committerChris Liddell <chris.liddell@artifex.com>2016-06-06 15:25:53 +0100
commit45dcf097558e880a76f569dd8d6c678f6ed186ce (patch)
treea6053769310375ff63efd5e493e8562d410e0112 /base/gxcmap.h
parent41d8d83a77ee6ea12109dde7b72dedc61cca01a3 (diff)
downloadghostpdl-45dcf097558e880a76f569dd8d6c678f6ed186ce.tar.gz
Make gs_imager_state == gs_state.
Change how gstate initialisation is done: Previously we relied on the imager state being a subset of the gstate (thus assigning an imager state to a graphics state over wrote to the entries common to both, and didn't overwrite any already set graphics state specific entries). Making the imager and graphics states the same means that approach doesn't work, so this changes it to initialise the entries individually. Renames gsistate.c->gsgstate.c and gxistate.h->gxgstate.h Cleanup and fix the gs_state gc stuff. Uses different check for pre/post clist pdf14 device Previously, the code used "is_gstate" in the imager/graphics state object to determine if the code was being called pre or post clist (post clist would only ever have had an imager_state so is_gstate = false). With no imager state any more, that test would no longer work (and I am dubious about whether it was really safe, anyway). Other places check for the presence of a clist reader device in the pdf14 device structure - so use that here too. Adds initial (NULL) value for show_gstate pointer in gs_state. Removes the now pointless macro for the contents of the graphics state Changes function names that had "imager" to use "gstate" Removes the redundant 'is_state' flag Cleans up gs_(g)state_putdeviceparams(): Previously we had to similar routines: one took a graphics state, and used the device from the graphics state, the other took an imager state and the device as an explicit parameter. With the removal of the imager state, "merge" those two functions Replaces gs_state with gs_gstate It makes for less confusion as it really is a g(raphics)state
Diffstat (limited to 'base/gxcmap.h')
-rw-r--r--base/gxcmap.h62
1 files changed, 33 insertions, 29 deletions
diff --git a/base/gxcmap.h b/base/gxcmap.h
index d450172e9..016a53d05 100644
--- a/base/gxcmap.h
+++ b/base/gxcmap.h
@@ -32,30 +32,34 @@ typedef struct gx_device_s gx_device;
# define gx_device_color_DEFINED
typedef struct gx_device_color_s gx_device_color;
#endif
+#ifndef gs_gstate_DEFINED
+# define gs_gstate_DEFINED
+typedef struct gs_gstate_s gs_gstate;
+#endif
/* Procedures for rendering colors specified by fractions. */
#define cmap_proc_gray(proc)\
- void proc(frac, gx_device_color *, const gs_imager_state *,\
+ void proc(frac, gx_device_color *, const gs_gstate *,\
gx_device *, gs_color_select_t)
#define cmap_proc_rgb(proc)\
- void proc(frac, frac, frac, gx_device_color *, const gs_imager_state *,\
+ void proc(frac, frac, frac, gx_device_color *, const gs_gstate *,\
gx_device *, gs_color_select_t)
#define cmap_proc_cmyk(proc)\
void proc(frac, frac, frac, frac, gx_device_color *,\
- const gs_imager_state *, gx_device *, gs_color_select_t,\
+ const gs_gstate *, gx_device *, gs_color_select_t,\
const gs_color_space *)
#define cmap_proc_rgb_alpha(proc)\
void proc(frac, frac, frac, frac, gx_device_color *,\
- const gs_imager_state *, gx_device *, gs_color_select_t)
+ const gs_gstate *, gx_device *, gs_color_select_t)
#define cmap_proc_separation(proc)\
- void proc(frac, gx_device_color *, const gs_imager_state *,\
+ void proc(frac, gx_device_color *, const gs_gstate *,\
gx_device *, gs_color_select_t)
#define cmap_proc_devicen(proc)\
- void proc(const frac *, gx_device_color *, const gs_imager_state *, \
+ void proc(const frac *, gx_device_color *, const gs_gstate *, \
gx_device *, gs_color_select_t)
#define cmap_proc_is_halftoned(proc)\
- bool proc(const gs_imager_state *, gx_device *)
+ bool proc(const gs_gstate *, gx_device *)
/*
* List of mapping functions from the standard color spaces to the
@@ -67,7 +71,7 @@ typedef struct gx_device_color_s gx_device_color;
#define cm_map_proc_rgb(proc) \
void proc (gx_device * dev, \
- const gs_imager_state *pis, \
+ const gs_gstate *pgs, \
frac r, frac g, frac b, \
frac * out)
@@ -107,7 +111,7 @@ cm_map_proc_cmyk(cmyk_cs_to_cmyk_cm);
* applying the current transfer function or halftone.
*
* The routine pointed to by get_cmap_procs (a field in the image
- * state; see gxistate.h) should initialize the cm_color_map_procs
+ * state; see gxgstate.h) should initialize the cm_color_map_procs
* pointer, using the get_color_mapping_procs method of the device.
*
* Because of a bug in the Watcom C compiler, we have to split the
@@ -126,35 +130,35 @@ typedef struct gx_color_map_procs_s gx_color_map_procs;
/*
* Determine the color mapping procedures for a device. Even though this
- * does not currently use information from the imager state, it must be
+ * does not currently use information from the gs_gstate, it must be
* a virtual procedure of the state for internal reasons.
*/
const gx_color_map_procs *
- gx_get_cmap_procs(const gs_imager_state *, const gx_device *);
+ gx_get_cmap_procs(const gs_gstate *, const gx_device *);
const gx_color_map_procs *
- gx_default_get_cmap_procs(const gs_imager_state *, const gx_device *);
+ gx_default_get_cmap_procs(const gs_gstate *, const gx_device *);
/*
* Set the color mapping procedures in the graphics state. This is
* currently only needed when switching devices, but might be used more
* often in the future.
*/
-void gx_set_cmap_procs(gs_imager_state *, const gx_device *);
+void gx_set_cmap_procs(gs_gstate *, const gx_device *);
/* Remap a concrete (frac) gray, RGB or CMYK color. */
/* These cannot fail, and do not return a value. */
-#define gx_remap_concrete_gray(cgray, pdc, pis, dev, select)\
- ((pis)->cmap_procs->map_gray)(cgray, pdc, pis, dev, select)
-#define gx_remap_concrete_rgb(cr, cg, cb, pdc, pis, dev, select)\
- ((pis)->cmap_procs->map_rgb)(cr, cg, cb, pdc, pis, dev, select)
-#define gx_remap_concrete_cmyk(cc, cm, cy, ck, pdc, pis, dev, select, pcs)\
- ((pis)->cmap_procs->map_cmyk)(cc, cm, cy, ck, pdc, pis, dev, select, pcs)
-#define gx_remap_concrete_rgb_alpha(cr, cg, cb, ca, pdc, pis, dev, select)\
- ((pis)->cmap_procs->map_rgb_alpha)(cr, cg, cb, ca, pdc, pis, dev, select)
-#define gx_remap_concrete_separation(pcc, pdc, pis, dev, select)\
- ((pis)->cmap_procs->map_separation)(pcc, pdc, pis, dev, select)
-#define gx_remap_concrete_devicen(pcc, pdc, pis, dev, select)\
- ((pis)->cmap_procs->map_devicen)(pcc, pdc, pis, dev, select)
+#define gx_remap_concrete_gray(cgray, pdc, pgs, dev, select)\
+ ((pgs)->cmap_procs->map_gray)(cgray, pdc, pgs, dev, select)
+#define gx_remap_concrete_rgb(cr, cg, cb, pdc, pgs, dev, select)\
+ ((pgs)->cmap_procs->map_rgb)(cr, cg, cb, pdc, pgs, dev, select)
+#define gx_remap_concrete_cmyk(cc, cm, cy, ck, pdc, pgs, dev, select, pcs)\
+ ((pgs)->cmap_procs->map_cmyk)(cc, cm, cy, ck, pdc, pgs, dev, select, pcs)
+#define gx_remap_concrete_rgb_alpha(cr, cg, cb, ca, pdc, pgs, dev, select)\
+ ((pgs)->cmap_procs->map_rgb_alpha)(cr, cg, cb, ca, pdc, pgs, dev, select)
+#define gx_remap_concrete_separation(pcc, pdc, pgs, dev, select)\
+ ((pgs)->cmap_procs->map_separation)(pcc, pdc, pgs, dev, select)
+#define gx_remap_concrete_devicen(pcc, pdc, pgs, dev, select)\
+ ((pgs)->cmap_procs->map_devicen)(pcc, pdc, pgs, dev, select)
/* Map a color */
#include "gxcindex.h"
@@ -289,14 +293,14 @@ frac gx_unit_frac(float fvalue);
such a case, we can make use of the faster icc color conversions for
images */
bool gx_device_uses_std_cmap_procs(gx_device * dev,
- const gs_imager_state * pis);
+ const gs_gstate * pgs);
bool fwd_uses_fwd_cmap_procs(gx_device * dev);
const gx_cm_color_map_procs* fwd_get_target_cmap_procs(gx_device * dev);
void cmap_transfer_halftone(gx_color_value *pconc, gx_device_color * pdc,
- const gs_imager_state * pis, gx_device * dev, bool has_transfer,
+ const gs_gstate * pgs, gx_device * dev, bool has_transfer,
bool has_halftone, gs_color_select_t select);
-void cmap_transfer(gx_color_value *pconc, const gs_imager_state * pis,
+void cmap_transfer(gx_color_value *pconc, const gs_gstate * pgs,
gx_device * dev);
-void cmap_transfer_plane(gx_color_value *pconc, const gs_imager_state *pis,
+void cmap_transfer_plane(gx_color_value *pconc, const gs_gstate *pgs,
gx_device *dev, int plane);
#endif /* gxcmap_INCLUDED */