Age | Commit message (Collapse) | Author |
|
In preparation for work on progressive loading, update the exception
handling scheme slightly.
Until now, exceptions (as thrown with fz_throw, and caught with
fz_try/fz_catch) have merely had an informative string. They have
never had anything that can be compared to see if an error is of
a particular type.
We now introduce error codes; when we fz_throw, we now always
give an error code, and can optionally (using fz_throw_message)
give both an error code and an informative string.
When we fz_rethrow from within a fz_catch, both the error code and
the error message is maintained. Using fz_rethrow_message we can
'improve' the error message, but the code is maintained.
The error message can be read out using fz_caught_message() and the
error code can be read as fz_caught().
Currently we only define a 'generic' error. This will expand in future
versions to include other error types that may be tested for.
|
|
|
|
|
|
Tested with msysgit 1.8.3 environment.
|
|
Fix from zeniko.
|
|
|
|
|
|
The openjpeg stream reading code is supposed to return -1 to
mean 'EOF'. Update our implementation in line with this.
This stops samples_mupdf_001/402.pdf.SIGSEGV.2e4.2672 going into
an infinite loop.
|
|
|
|
To prepare for color management, we have to make the device colorspaces
per-context and able to be overridden by users.
|
|
If the colorspace given in the dictionary of a JPX image differs from
the colorspace given in the image itself, decode to the native image
format, then convert.
This goes a long way towards fixing "1439 - color softmask fails to
draw jpx image.pdf" (aka hivemind.pdf). The lack of transfer function
support hopefully explains the rest.
|
|
Thanks to Zeniko for pointing out this fix.
|
|
It seems that JPX images can be supplied in indexed format, with
both a palette internal to the jpx stream, and a palette in the
PDF. Googling seems to suggest that the internal palette should
be ignored in this case, and the external palette applied.
Fortunately, since OpenJPEG-1.5 there is a flag that can be used
to tell OpenJPEG not to decode palettes. We update the code here
to spot that there is an external palette, and to set this flag.
|
|
C's standard is copy(dst, src), so we move to adopt that here.
Hopefully no one is calling this routine other than us - if they are,
then I apologise! Better to aim for consistency before we freeze
the API at v1.0 than to carry an inconsistent API around ever after.
|
|
Attempt to separate public API from internal functions.
|
|
|
|
|