[gs-cvs] rev 8294 - trunk/gs/src
giles at ghostscript.com
giles at ghostscript.com
Mon Oct 15 17:36:28 PDT 2007
Author: giles
Date: 2007-10-15 17:36:27 -0700 (Mon, 15 Oct 2007)
New Revision: 8294
Modified:
trunk/gs/src/sjpx.c
trunk/gs/src/zfjpx.c
Log:
It's the client's responsibility to call the set_defaults
method on a new stream. Bug 689362.
DETAILS:
The JPXDecode stream implementation was calling set_defaults
from within its own init method, clobbering the colorspace
request passed in through the stream's parameter dictionary.
Modified: trunk/gs/src/sjpx.c
===================================================================
--- trunk/gs/src/sjpx.c 2007-10-15 22:31:54 UTC (rev 8293)
+++ trunk/gs/src/sjpx.c 2007-10-16 00:36:27 UTC (rev 8294)
@@ -52,9 +52,8 @@
stream_jpxd_state *const state = (stream_jpxd_state *) ss;
int status = 0;
- s_jpxd_set_defaults(ss);
state->jpx_memory = ss->memory ? ss->memory->non_gc_memory : gs_lib_ctx_get_non_gc_memory_t();
-
+
status = jas_init();
jas_set_error_cb(s_jpx_jas_error_cb);
#ifdef JPX_DEBUG
@@ -430,21 +429,22 @@
}
/* set stream defaults.
- this hook exists to avoid confusing the gc with bogus
- pointers. we use it similarly just to NULL all the pointers.
- (could just be done in _init?)
+ This hook exists to avoid confusing the gc with bogus
+ pointers. We also set a default for client-settable
+ parameters like the requested output colorspace.
*/
static void
s_jpxd_set_defaults(stream_state *ss)
{
stream_jpxd_state *const state = (stream_jpxd_state *) ss;
-
+
state->stream = NULL;
state->image = NULL;
state->offset = 0;
state->buffer = NULL;
state->bufsize = 0;
state->buffill = 0;
+ /* the following can be set by the client before calling init() */
state->colorspace = gs_jpx_cs_unset;
}
Modified: trunk/gs/src/zfjpx.c
===================================================================
--- trunk/gs/src/zfjpx.c 2007-10-15 22:31:54 UTC (rev 8293)
+++ trunk/gs/src/zfjpx.c 2007-10-16 00:36:27 UTC (rev 8294)
@@ -13,9 +13,9 @@
/* $Id$ */
-/* this is the ps interpreter interface to the JPXDecode filter
+/* This is the ps interpreter interface to the JPXDecode filter
used for (JPEG2000) scanned image compression. PDF only specifies
- a decoder filter, and we don't currently implement anything else */
+ a decoder filter, and we don't currently implement anything else. */
#include "memory_.h"
#include "ghost.h"
@@ -47,6 +47,8 @@
ref *csname = NULL;
stream_jpxd_state state;
+ /* it's our responsibility to call set_defaults() */
+ (*s_jpxd_template.set_defaults)(&state);
state.jpx_memory = imemory->non_gc_memory;
if (r_has_type(op, t_dictionary)) {
check_dict_read(*op);
More information about the gs-cvs
mailing list