summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'base/gxclist.h')
-rw-r--r--base/gxclist.h58
1 files changed, 55 insertions, 3 deletions
diff --git a/base/gxclist.h b/base/gxclist.h
index e1e7ff1b..cdb0136f 100644
--- a/base/gxclist.h
+++ b/base/gxclist.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001-2019 Artifex Software, Inc.
+/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
@@ -182,7 +182,7 @@ typedef struct gx_clist_state_s gx_clist_state;
uint data_size; /* size of buffer */\
gx_band_params_t band_params; /* band buffering parameters */\
bool do_not_open_or_close_bandfiles; /* if true, do not open/close bandfiles */\
- int is_printer; /* if true, then clist is based on a prn device */\
+ dev_proc_dev_spec_op((*orig_spec_op)); /* Original dev spec op handler */\
/* Following are used for both writing and reading. */\
gx_bits_cache_chunk *cache_chunk; /* the only chunk of bits */\
gx_bits_cache bits;\
@@ -329,6 +329,7 @@ struct gx_device_clist_writer_s {
/* above set when not at page level with no SMask or when */
/* the page level BM, shape or opacity alpha needs tranaparency */
int pdf14_trans_group_level;/* 0 when at page level group -- push increments, pop decrements */
+ /* -1 when PUSH_DEVICE not yet performed to prevent spurious ops */
int pdf14_smask_level; /* 0 when at SMask None -- push increments, pop decrements */
bool page_pdf14_needed; /* save page level pdf14_needed state */
@@ -477,7 +478,7 @@ void clist_update_trans_bbox(gx_device_clist_writer *dev, gs_int_rect *bbox);
/* Make a clist device for accumulating. Used for pattern-clist as well as */
/* for pdf14 pages that are too large to be done in page mode. */
gx_device_clist *
-clist_make_accum_device(gx_device *target, const char *dname, void *base, int space,
+clist_make_accum_device(gs_memory_t *mem, gx_device *target, const char *dname, void *base, int space,
gx_device_buf_procs_t *buf_procs, gx_band_params_t *band_params,
bool use_memory_clist, bool uses_transparency,
gs_pattern1_instance_t *pinst);
@@ -547,6 +548,11 @@ clist_enable_multi_thread_render(gx_device *dev);
void
clist_teardown_render_threads(gx_device *dev);
+/* Minimum BufferSpace needed when writing the clist */
+/* This is an exported function because it is used to set up render threads */
+/* and in clist_init_states to make sure the buffer is large enough */
+size_t clist_minimum_buffer(int nbands);
+
#ifdef DEBUG
#define clist_debug_rect clist_debug_rect_imp
void clist_debug_rect_imp(int x, int y, int width, int height);
@@ -609,4 +615,50 @@ void clist_debug_set_ctm_imp(const gs_matrix *m);
crop_copy_y(dev, data, data_x, raster, id, y, h);\
END
+/* Devices that are expected to be able to 'mutate' into being clist
+ * devices have to be constructed in a particular way. They have to
+ * have to have the "header" be padded out to a given size (so the clist
+ * fields can all fit in at the top), and then the device specific
+ * fields can follow this.
+ * These fields should follow gx_device_common. */
+#define gx_device_clist_mutatable_common\
+ byte skip[max(sizeof(gx_device_memory), sizeof(gx_device_clist)) -\
+ sizeof(gx_device) + sizeof(double) /* padding */];\
+ long buffer_space; /* amount of space for clist buffer, */\
+ /* 0 means not using clist */\
+ byte *buf; /* buffer for rendering */\
+ gs_memory_t *buffer_memory; /* allocator for command list */\
+ gs_memory_t *bandlist_memory; /* allocator for bandlist files */\
+ uint clist_disable_mask; /* mask of clist options to disable */\
+ gx_device_procs orig_procs /* original (std_)procs */
+
+
+#define GX_CLIST_MUTATABLE_DEVICE_DEFAULTS \
+ { 0 }, /* skip */\
+ 0, /* buffer_space */\
+ NULL, /* buf */\
+ 0, /* buffer_memory */\
+ 0, /* bandlist_memory */\
+ 0, /* clist_disable_mask */\
+ { NULL } /* orig_procs */
+
+typedef struct {
+ gx_device_common;
+ gx_device_clist_mutatable_common;
+} gx_device_clist_mutatable;
+
+extern_st(st_device_clist_mutatable);
+#define public_st_device_clist_mutatable() /* in gxclist.c */\
+ gs_public_st_complex_only(st_device_clist_mutatable,\
+ gx_device_clist_mutatable, "gx_device_clist_mutatable", 0, \
+ device_clist_mutatable_enum_ptrs, device_clist_mutatable_reloc_ptrs,\
+ gx_device_finalize)
+#define st_device_clist_mutatable_max_ptrs\
+ (st_device_clist_mutable_max_ptrs)
+
+/* A useful check to determine if a device that can be mutated to be a
+ * clist has undergone such a mutation. */
+#define CLIST_MUTATABLE_HAS_MUTATED(pdev) \
+ (((gx_device_clist_mutatable *)(pdev))->buffer_space != 0)
+
#endif /* gxclist_INCLUDED */