summaryrefslogtreecommitdiff
path: root/base/gdevdgbr.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2017-11-01 12:07:53 +0000
committerRobin Watts <robin.watts@artifex.com>2017-11-01 13:40:13 +0000
commitb3c0fafa490932cc43009c53c7f8a17598fe78d7 (patch)
treec57e9e46e1c673aeb9544374c8035e7a1f5ca8ba /base/gdevdgbr.c
parent961b14dd7e686a1543541070a1ba943590ef2bf9 (diff)
downloadghostpdl-b3c0fafa490932cc43009c53c7f8a17598fe78d7.tar.gz
Tweak map_XXXX_subclass functions.
To cope with subclassed devices, we no longer simply call: pprocs = dev_proc(dev, get_color_mapping_procs); pprocs->map_cmyk(dev, ...) etc. The 'done thing' is to run up the the dev->parent pointers as far as we can, and to get the color mapping procedures from that. These color mapping procedures then need to be called using the dev pointer from which they were fetched. To do this, we provide get_color_mapping_procs_subclass and map_XXX_subclass functions that pickle the dev search. The only downside to this is that we end up doing the search up the tree twice (or more than twice in the case where we make several mapping calls). Here we therefore tweak these functions so that get_color_mapping_procs_subclass returns both the procs AND the dev to use when calling them in a structure, and the map_XXX_subclass functions now take that structure. Broadly, this change shouldn't actually alter any operation, other than being slightly more efficient. There are a few wrinkles: 1) in gsicc_replacecm.c, we were fetching the procs using the dev chasing function, but calling them using the unchased dev value. Fixed here to use the matching dev value in both cases. 2) In a couple of places, we have special handling for forwarding devices. I am not convinced that we handle subclassed forwarding devices correctly (or devices that forward to subclassed devices). I have marked these areas with FIXMEs, but they are no worse now than they were before.
Diffstat (limited to 'base/gdevdgbr.c')
-rw-r--r--base/gdevdgbr.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/base/gdevdgbr.c b/base/gdevdgbr.c
index 79dae2208..2f25b7c04 100644
--- a/base/gdevdgbr.c
+++ b/base/gdevdgbr.c
@@ -440,9 +440,9 @@ gx_get_bits_std_to_native(gx_device * dev, int x, int w, int h,
gx_color_value va = alpha_default;
gx_color_index pixel;
bool do_alpha = false;
- const gx_cm_color_map_procs * map_procs;
+ subclass_color_mappings scm;
- map_procs = get_color_mapping_procs_subclass(dev);
+ scm = get_color_mapping_procs_subclass(dev);
/* Fetch the source data. */
if (stored->options & GB_ALPHA_FIRST) {
@@ -477,13 +477,13 @@ gx_get_bits_std_to_native(gx_device * dev, int x, int w, int h,
switch (ncolors) {
case 1:
- map_gray_subclass(map_procs, dev, sc[0], dc);
+ map_gray_subclass(scm, sc[0], dc);
break;
case 3:
- map_rgb_subclass(map_procs, dev, 0, sc[0], sc[1], sc[2], dc);
+ map_rgb_subclass(scm, 0, sc[0], sc[1], sc[2], dc);
break;
case 4:
- map_cmyk_subclass(map_procs, dev, sc[0], sc[1], sc[2], sc[3], dc);
+ map_cmyk_subclass(scm, sc[0], sc[1], sc[2], sc[3], dc);
break;
default:
return_error(gs_error_rangecheck);