summaryrefslogtreecommitdiff
path: root/gs
diff options
context:
space:
mode:
authorRaph Levien <raph.levien@artifex.com>2002-11-02 07:33:48 +0000
committerRaph Levien <raph.levien@artifex.com>2002-11-02 07:33:48 +0000
commita9b3aefc68c9d7cbec4828a0eb1c65b9e5d857cf (patch)
tree61ccb77ad3cfd131c23d92ae36d225ed4be3bd5f /gs
parent2087ac06af54bac4a1306a399413efa8be88bc43 (diff)
Adds UseWTS user parameter to enable WTS, rather than a compile-time
#define USE_WTS as before. Also, WTS is now only enabled when AccurateScreens is selected. git-svn-id: http://svn.ghostscript.com/ghostscript/trunk@3279 a1074d23-0009-0410-80fe-cf8c14f379e6
Diffstat (limited to 'gs')
-rw-r--r--gs/src/gsht1.c18
-rw-r--r--gs/src/gshtscr.c20
-rw-r--r--gs/src/gxht.h6
-rw-r--r--gs/src/zusparam.c13
4 files changed, 47 insertions, 10 deletions
diff --git a/gs/src/gsht1.c b/gs/src/gsht1.c
index 2fd15c658..bee93ab02 100644
--- a/gs/src/gsht1.c
+++ b/gs/src/gsht1.c
@@ -174,11 +174,8 @@ gs_sethalftone_prepare(gs_state * pgs, gs_halftone * pht,
gx_ht_order_component *pocs = 0;
int code = 0;
-/* #define USE_WTS */
-#ifdef USE_WTS
- if (gs_sethalftone_try_wts(pht, pgs, pdht) == 0)
+ if (gs_currentusewts() && gs_sethalftone_try_wts(pht, pgs, pdht) == 0)
return 0;
-#endif
switch (pht->type) {
case ht_type_colorscreen:
@@ -574,19 +571,19 @@ gs_sethalftone_try_wts(gs_halftone *pht, gs_state *pgs,
int num_comps = dev->color_info.num_components;
int depth = dev->color_info.depth;
- /* todo: we probably want to fail if AccurateScreens is false */
-
if (pht->type != ht_type_multiple)
/* Only work with Type 5 halftones. todo: we probably want
to relax this. */
return 1;
-#if 0
+ if_debug2('h', "[h]%s, num_comp = %d\n",
+ dev->color_info.separable_and_linear == GX_CINFO_SEP_LIN ? "Separable and linear" : "Not separable and linear!",
+ pht->params.multiple.num_comp);
+
if (dev->color_info.separable_and_linear != GX_CINFO_SEP_LIN &&
pht->params.multiple.num_comp > 1)
/* WTS is only enabled for separable or monochrome devices. */
return 1;
-#endif
/* only work with bilevel (not multilevel) devices */
if (depth > num_comps) {
@@ -610,6 +607,11 @@ gs_sethalftone_try_wts(gs_halftone *pht, gs_state *pgs,
for (i = 0; i < num_comp; i++) {
if (components[i].type != ht_type_spot)
return 1;
+ else {
+ gs_spot_halftone *spot = &components[i].params.spot;
+ if (!spot->accurate_screens)
+ return 1;
+ }
}
pocs = gs_alloc_struct_array( pgs->memory,
diff --git a/gs/src/gshtscr.c b/gs/src/gshtscr.c
index aa2508adb..c5fc7c789 100644
--- a/gs/src/gshtscr.c
+++ b/gs/src/gshtscr.c
@@ -59,8 +59,9 @@ private RELOC_PTRS_WITH(screen_enum_reloc_ptrs, gs_screen_enum *eptr)
}
RELOC_PTRS_END
-/* Define the default value of AccurateScreens that affects */
-/* setscreen and setcolorscreen. */
+/* Define the default value of AccurateScreens that affects setscreen
+ and setcolorscreen. Note that this is effectively a global, and
+ thus gets in the way of reentrancy. We'll want to fix that. */
private bool screen_accurate_screens;
/* Default AccurateScreens control */
@@ -75,6 +76,21 @@ gs_currentaccuratescreens(void)
return screen_accurate_screens;
}
+/* As with AccurateScreens, this is also effectively a global. However,
+ it is going away soon. */
+private bool screen_use_wts;
+
+void
+gs_setusewts(bool use_wts)
+{
+ screen_use_wts = use_wts;
+}
+bool
+gs_currentusewts(void)
+{
+ return screen_use_wts;
+}
+
/* Define the MinScreenLevels user parameter similarly. */
private uint screen_min_screen_levels;
diff --git a/gs/src/gxht.h b/gs/src/gxht.h
index 6c9292860..96ecd9ee5 100644
--- a/gs/src/gxht.h
+++ b/gs/src/gxht.h
@@ -214,6 +214,12 @@ extern_st(st_halftone);
void gs_setaccuratescreens(bool);
bool gs_currentaccuratescreens(void);
+/*
+ * Set/get the value for UseWTS. Also a static, but it's going away.
+ */
+void gs_setusewts(bool);
+bool gs_currentusewts(void);
+
/* Initiate screen sampling with optional AccurateScreens. */
int gs_screen_init_memory(gs_screen_enum *, gs_state *,
gs_screen_halftone *, bool, gs_memory_t *);
diff --git a/gs/src/zusparam.c b/gs/src/zusparam.c
index 3497b1a9c..7fb0b8b64 100644
--- a/gs/src/zusparam.c
+++ b/gs/src/zusparam.c
@@ -451,6 +451,18 @@ set_AccurateScreens(i_ctx_t *i_ctx_p, bool val)
gs_setaccuratescreens(val);
return 0;
}
+/* Boolean values */
+private bool
+current_UseWTS(i_ctx_t *i_ctx_p)
+{
+ return gs_currentusewts();
+}
+private int
+set_UseWTS(i_ctx_t *i_ctx_p, bool val)
+{
+ gs_setusewts(val);
+ return 0;
+}
private bool
current_LockFilePermissions(i_ctx_t *i_ctx_p)
{
@@ -468,6 +480,7 @@ set_LockFilePermissions(i_ctx_t *i_ctx_p, bool val)
private const bool_param_def_t user_bool_params[] =
{
{"AccurateScreens", current_AccurateScreens, set_AccurateScreens},
+ {"UseWTS", current_UseWTS, set_UseWTS},
{"LockFilePermissions", current_LockFilePermissions, set_LockFilePermissions}
};