summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Deutschmann <whissi@gentoo.org>2021-03-30 10:59:39 +0200
committerThomas Deutschmann <whissi@gentoo.org>2021-04-01 00:04:14 +0200
commit5ff1d6955496b3cf9a35042c9ac35db43bc336b1 (patch)
tree6d470f7eb448f59f53e8df1010aec9dad8ce1f72 /base/gdevkrnlsclass.c
parentImport Ghostscript 9.53.1 (diff)
downloadghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.tar.gz
ghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.tar.bz2
ghostscript-gpl-patches-5ff1d6955496b3cf9a35042c9ac35db43bc336b1.zip
Import Ghostscript 9.54ghostscript-9.54
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
Diffstat (limited to 'base/gdevkrnlsclass.c')
-rw-r--r--base/gdevkrnlsclass.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/base/gdevkrnlsclass.c b/base/gdevkrnlsclass.c
index 8625df4c..d615a100 100644
--- a/base/gdevkrnlsclass.c
+++ b/base/gdevkrnlsclass.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2020 Artifex Software, Inc.
+/* Copyright (C) 2001-2021 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -15,11 +15,12 @@
#include "gx.h"
#include "gxdcolor.h"
-#include "gdevkrnlsclass.h" /* 'standard' built in subclasses, currently First/Last Page and object filter */
+#include "gdevkrnlsclass.h" /* 'standard' built in subclasses, currently Page, Object, and Nup filter */
/* If set to '1' ths forces all devices to be loaded, even if they won't do anything.
* This is useful for cluster testing that the very presence of a device doesn't
- * break anything.
+ * break anything. This requires that all of these devices pass through if the params
+ * they use are 0/NULL.
*/
#define FORCE_TESTING_SUBCLASSING 0
@@ -28,6 +29,44 @@ int install_internal_subclass_devices(gx_device **ppdev, int *devices_loaded)
int code = 0;
gx_device *dev = (gx_device *)*ppdev, *saved;
+ /*
+ * NOTE: the Nup device should precede the PageHandler so the FirstPage, LastPage
+ * and PageList will filter pages out BEFORE they are seen by the nesting.
+ */
+
+#if FORCE_TESTING_SUBCLASSING
+ if (!dev->NupHandlerPushed) {
+#else
+ if (!dev->NupHandlerPushed && dev->NupControl != 0) {
+#endif
+ code = gx_device_subclass(dev, (gx_device *)&gs_nup_device, sizeof(Nup_device_subclass_data));
+ if (code < 0)
+ return code;
+
+ saved = dev = dev->child;
+
+ /* Open all devices *after* the new current device */
+ do {
+ dev->is_open = true;
+ dev = dev->child;
+ }while(dev);
+
+ dev = saved;
+
+ /* Rewind to top device in chain */
+ while(dev->parent)
+ dev = dev->parent;
+
+ /* Note in all devices in chain that we have loaded the NupHandler */
+ do {
+ dev->NupHandlerPushed = true;
+ dev = dev->child;
+ }while(dev);
+
+ dev = saved;
+ if (devices_loaded)
+ *devices_loaded = true;
+ }
#if FORCE_TESTING_SUBCLASSING
if (!dev->PageHandlerPushed) {
#else