diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2018-07-05 16:38:01 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2018-07-05 16:38:01 +0100 |
commit | 62e67ecc475d3648f32d7d8c4459bbabd740ea2b (patch) | |
tree | e4dd373a5faf43862723d0d5017c7b410b3eac1b /base/gxdevcli.h | |
parent | 2f8082aa9777a7274c463c6375c2f7d01c299251 (diff) | |
download | ghostpdl-62e67ecc475d3648f32d7d8c4459bbabd740ea2b.tar.gz |
Fix a device subclassing problem with colour mapping procedures
Bug #699520 "Seg fault with customer device utilising device subclassing"
When we retrieve colour mapping methods, we need to use the first
subclassing device in the chain which does not have a 'default' for
the colour mapping methods. This is so that the monochrome palette
device in PCL works properly.
In contrast, if none of the subclassing devices overrides the colour
mapping then we want to use the first non-subclassing device's
methods and, importantly, that device as well.
Diffstat (limited to 'base/gxdevcli.h')
-rw-r--r-- | base/gxdevcli.h | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/base/gxdevcli.h b/base/gxdevcli.h index 2f2cbcdbc..757694c4d 100644 --- a/base/gxdevcli.h +++ b/base/gxdevcli.h @@ -1810,11 +1810,25 @@ subclass_parentmost_device(gx_device *dev) return dev; } +extern const gx_cm_color_map_procs *default_subclass_get_color_mapping_procs(const gx_device *dev); + static inline subclass_color_mappings get_color_mapping_procs_subclass(gx_device *dev) { subclass_color_mappings sc; - sc.dev = subclass_parentmost_device(dev); + gx_device *d; + sc.dev = NULL; + + d = subclass_parentmost_device(dev); + while (d->procs.get_color_mapping_procs == default_subclass_get_color_mapping_procs) { + if (d->child) + d = d->child; + else { + break; + } + } + sc.dev = d; + sc.procs = (gx_cm_color_map_procs *)(dev_proc(sc.dev, get_color_mapping_procs) == NULL ? NULL : dev_proc(sc.dev, get_color_mapping_procs)(sc.dev)); return sc; |