diff options
author | Ken Sharp <ken.sharp@artifex.com> | 2021-05-29 19:18:29 +0100 |
---|---|---|
committer | Ken Sharp <ken.sharp@artifex.com> | 2021-05-29 19:18:29 +0100 |
commit | 9b9fd74e5adae9913a07423518c1452b135d3c00 (patch) | |
tree | 406d54f8892b830bed4481cbb28637feeb844666 /base/sjpx_openjpeg.c | |
parent | 36e09729adad6b9dceca9ebfaca30d3980d1df40 (diff) | |
download | ghostpdl-9b9fd74e5adae9913a07423518c1452b135d3c00.tar.gz |
pdfwrite - Add a PassThrough for JPX encoded images
Bug #703891 "Add PassThrough for JPX images to pdfwrite"
Behaves in exactly the same way as the existing pass through for JPEG
images, and has the same limitations. See vectorDevices.htm.
Several test suite files show (mostly relatively minor) progressions
with this enhancement.
Diffstat (limited to 'base/sjpx_openjpeg.c')
-rw-r--r-- | base/sjpx_openjpeg.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/base/sjpx_openjpeg.c b/base/sjpx_openjpeg.c index 8276cedd7..deaccd80a 100644 --- a/base/sjpx_openjpeg.c +++ b/base/sjpx_openjpeg.c @@ -701,6 +701,14 @@ s_opjd_process(stream_state * ss, stream_cursor_read * pr, if (in_size > 0) { + if (state->PassThrough && state->PassThroughfn) { + if (state->PassThrough && state->PassThroughfn && !state->StartedPassThrough) { + state->StartedPassThrough = 1; + (state->PassThroughfn)(state->device, NULL, 1); + } + (state->PassThroughfn)(state->device, (byte *)pr->ptr + 1, (byte *)pr->limit - (byte *)pr->ptr); + } + /* buffer available data */ code = opj_lock(ss->memory); if (code < 0) return code; @@ -776,6 +784,10 @@ s_opjd_set_defaults(stream_state * ss) { state->alpha = false; state->colorspace = gs_jpx_cs_rgb; + state->StartedPassThrough = 0; + state->PassThrough = 0; + state->PassThroughfn = NULL; + state->device = (void *)NULL; } /* stream release. @@ -786,6 +798,10 @@ s_opjd_release(stream_state *ss) { stream_jpxd_state *const state = (stream_jpxd_state *) ss; + if (state->PassThrough && state->PassThroughfn && state->StartedPassThrough) { + state->StartedPassThrough = 0; + (state->PassThroughfn)(state->device, NULL, 0); + } /* empty stream or failed to accumulate */ if (state->codec == NULL) return; |