summaryrefslogtreecommitdiff
path: root/source/fitz
AgeCommit message (Collapse)Author
2018-02-13Add fz_begin_layer/fz_end_layer.Robin Watts
Call these from the PDF interpreter. Make the DisplayList and Trace devices cope. Use these in the SVG output device.
2018-02-13Bug 699018: Null terminate buffer in fz_snprintf() even if too short.Sebastian Rasmussen
Previously the trailing null terminator would not be written if the formatted string ended up longer than the buffer.
2018-02-12jbig2: Improve error message.Sebastian Rasmussen
2018-02-08Add 'null' output device so we can remove NULL checks in hot functions.Tor Andersson
2018-02-08Add FZ_DEBUG_HTML option to EPUB parser.Tor Andersson
2018-02-08Fix silly mistake in fz_output buffering.Tor Andersson
fz_write_byte forgot to write the byte after needing to flush the buffer.
2018-02-06Workaround for Android: include limits.h where SIZE_MAX is used.Sebastian Rasmussen
SIZE_MAX is surprisingly supposed to be in stdint.h, but Android headers for API levels < 21 accidentally put SIZE_MAX in limits.h. Headers for API levels >= 21 correctly moved SIZE_MAX to stdint.h. This is the situation for Android NDK r14 and earlier. Android NDK r15 and later implement a header unification strategy: all sets of headers for each API level are combined into a single set of headers covering all API levels. Any differences are expressed by #ifdeffing on __ANDROID_API__. When this was done the moving of SIZE_MAX from limits.h to stdint.h was kept and, importantly, no #ifdefs were used in limits.h/stdint.h concerning SIZE_MAX. This means that the move of SIZE_MAX was retroactively introduced for API levels < 21 in Android NDK r15 and later. For this reason whenever mupdf uses SIZE_MAX it must include both: * stdint.h (not just in order to follow the POSIX specification, but also to compile successfully using Android NDK r15 and later) * and limits.h (in order to compile successfully using Android NDK r14 and earlier) Hence these need to include both stdint.h and limits.h, because: * source/fitz/memory.c uses SIZE_MAX * source/fitz/store.c uses SIZE_MAX The mupdf header include/mupdf/fitz/system.h includes stdint.h so any file that includes system.h will automatically have stdint.h This is true for both files. limits.h on the other hand needs to be explicitly included by whomever uses SIZE_MAX. This was already done by source/fitz/store.c but not by source/fitz/memory.c, but has now been added.
2018-02-06Include limits.h where INT_MAX/INT_MIN/PATH_MAX/UINT_MAX are used.Sebastian Rasmussen
2018-02-06Bug 698989: Throw upon unsupported bpc when unpacking image.Sebastian Rasmussen
Previously mupdf would silently ignore this situation and leave the buffer uninitialized leading to further issues. Thanks to oss-fuzz for reporting.
2018-02-06Bug 698988: Handle out of range predictors in filter.Sebastian Rasmussen
Thanks to oss-fuzz for reporting.
2018-02-06Remove redundant call to fz_rethrow().Sebastian Rasmussen
2018-02-06Free fz_output cache buffer when dropping fz_output.Sebastian Rasmussen
2018-02-02Generalise the null filter to handle more than a single range.Paul Gardiner
This is needed to simplify the way the bytes for hashing are passed to pkcs7 functions.
2018-02-01Drop JPEG/J2K/JPEG-XR/PNG/TIFF colorspaces even upon exception.Sebastian Rasmussen
For TIFF it was not just the colorspace, but other data as well.
2018-01-31Rename confusing fz_stream close callback to drop.Tor Andersson
2018-01-31Add buffering to fz_output.Tor Andersson
2018-01-31Reduce size of pool allocator blocks to minimize waste.Tor Andersson
A lot of EPUB pool allocated data is much smaller than the default size, leading to a lot of wasted memory.
2018-01-24Make sure to drop color converter when painting shades, even upon error.Sebastian Rasmussen
2018-01-24Bug 698904: Drop pixmap only once upon error when painting shades.Sebastian Rasmussen
If fz_new_pixmap_with_bbox() threw conv would be NULL and temp would be pointing to a pixmap that would be dropped 2 times. If fz_clone_pixmap_area_with_different_seps() threw temp and conv would be pointing to the same pixmap that would be dropped 3 times.
2018-01-24Bug 698904: Upon error both free color converter and clear its pointer.Sebastian Rasmussen
Without this change future calls to fz_fin_cached_color_converter() will try to dereference the already freed pointer.
2018-01-24Allow oversize allocations in pool allocator.Tor Andersson
2018-01-24Fix 698872: Do not trust ICC profile unconditionally in PNG files.Tor Andersson
2018-01-24Fix github issue #5: wrong return type from vec_dot in stext-device.cTor Andersson
2018-01-24Fix failure of non-incremental document saving.Paul Gardiner
An earlier commit changed the mode used to open a file for saving so that it could also be read from. The mode used was rb+ independently of whether the saving mode was incremental or not. Doing so neglected that for non-incemental saves the file may not already exist in which case opening rb+ will fail. This commit arranges that wb+ is used in the non-incremental case.
2018-01-19Add fz_output_as_streamPaul Gardiner
This provides a way for some output streams to also be read, a feature needed for the sake of document signing. Currently this is supported only for file output.
2018-01-15Fix 698865: Warn when failing to load embedded ICC profile in PNG images.Tor Andersson
Do not throw an exception, just ignore the faulty color profile.
2018-01-11Only do lock checking if using custom locks.Sebastian Rasmussen
The lock checking functions are always enabled in debug mode, but since they are not thread safe they may not be used in a multi-threaded application. Multi-threaded applications are required to set their own locking functions so the lock checking functions should only be run if the default locking functions are in use.
2018-01-10Handle pixmaps without alpha in fz_tint_pixmap.Tor Andersson
2018-01-10Add colorspace type enum and use it instead of hardcoded checks on N.Tor Andersson
2018-01-10Refactor and fix hash lookups when decoding image subarea tiles.Tor Andersson
The subarea rect used for lookups could mismatch the subarea returned by the get_pixmap function due to adjusting to whole bytes. Refactor and use a common subarea adjustment function. Many image formats which do not support subarea tiles will decode and cache the full image, so if a subarea tile cannot be found, look for the full image tile as well.
2018-01-10Fix initializer syntax for VS2005.Tor Andersson
2018-01-04Bug 698836: Fix build with FZ_ENABLE_JPX=0.Tor Andersson
2018-01-04Add portable pseudo-random number generator based on the lrand48 family.Tor Andersson
2018-01-02Fix thread debugging code to always use ms_clock()Robin Watts
2017-12-20Bug 698827: Correct reference counting when creating pixmap from pixmap.Sebastian Rasmussen
Previously the copy had as many reference counts as the original pixmap which lead to leaks of pixmaps.
2017-12-13Parse XML using pool allocator.Tor Andersson
This needs adding a fz_xml_doc type to hold the pool.
2017-12-06Ensure that our ICC base spaces have colorant names.Robin Watts
2017-12-06Update fz_convert_separation_colors to cope with unnamed separations.Robin Watts
Well, at least not to crash.
2017-12-06Bug 698801: Always copy background in when clipping an imagemask.Robin Watts
Don't attempt to rely on alpha, as it is incompatible with the way we clip through the mask at the end.
2017-11-23Allow RGB based proofing profile and output intentMichael Vrhel
Also do not do the extra group push if the destination pixmap is in the proper color space and has all the required sep support.
2017-11-22Prefer using fz_snprintf over snprintf.Sebastian Rasmussen
This way the MuPDF library itself only uses fz_snprintf for consistent formatting.
2017-11-22Use custom allocator everywhere zlib is used.Sebastian Rasmussen
2017-11-22Warn on irretrievable glyph name.Sebastian Rasmussen
2017-11-17Fix build if lcms2 is not present.Tor Andersson
We NEED lcms2art (the artifex branch) and cannot build with stock lcms2. Disable ICC support if the lcms2 thirdparty library is not present.
2017-11-15Bug 698745: Avoid broken colorspaces in NO_ICC builds.Robin Watts
If we attempt to make an icc colorspace in a NO_ICC build, throw an exception. This stops us ending up with 'UNKNOWN' colorspaces in the system.
2017-11-13Bug 698369: Fix stroking issue when closepath is infinitessimal.Robin Watts
If the move due to a closepath is infinitessimal, fz_stroke_lineto skips it as it cannot accurately figure out what the direction is. It appears we have had some code in fz_stroke_closepath to cope with exactly this case, but it does the wrong thing. This dates back all the way to the initial import of the code, so presumably it worked at some point, and stopped working somewhere along the line.
2017-11-10Remove fz_android_fprintf.Tor Andersson
Use android logging for throw/warn like we do with OutputDebugString on windows.
2017-11-10Fix potential problem with null path segments leaving dots.Robin Watts
When stroking paths if we meet segments of 0 length, we can't determine a direction, thus start/end caps are omitted. Line widths are irrelevant, and we thus render nothing. (Note that moves on their own do NOT count as a line segment). The exception to this is where we are using round caps, whereupon whatever direction the path is taken to have, the appearance will be the same - and this we render the segment as a dot. We have code in the renderer already to do this, but it looks to me like it could be fooled into leaving a dot by us first doing a move, a lineto the same point, and then a lineto to somewhere else. The current code sets the 'dot' value to 1 when it detects the degenerate line, and doesn't reset when it meets a non-degenerate line later. Accordingly I've changed the code here to account for such a circumstance. This produces no diffs in the cluster testing, but seems more correct to me.
2017-11-10Remove unused variables.Tor Andersson
2017-11-09Bug 698307: Improve stdint.h detection logic in openjpeg wrapper.Robin Watts
Thanks to Tamir Evan for this tweak.