summaryrefslogtreecommitdiff
path: root/source/fitz
AgeCommit message (Collapse)Author
2014-10-22Fix warnings.Tor Andersson
2014-10-04Avoid redefinition warning from clang when building cmapdump.cJoseph Heenan
In file included from scripts/cmapdump.c:19: scripts/../source/fitz/ftoa.c:30:23: warning: redefinition of typedef 'ulong' is a C11 feature [-Wtypedef-redefinition] typedef unsigned long ulong; ^ scripts/../source/fitz/strtod.c:30:23: note: previous definition is here typedef unsigned long ulong; ^ 1 warning generated. (Apparently in earlier versions of clang this is an error.)
2014-09-22Fix 695467: Add and use fz_ftoa function (like dtoa but with floats).Tor Andersson
The dtoa function is for doubles (which is what MuJS uses) but for MuPDF we only need and want float precision in our output formatting.
2014-09-22Ensure that TIFFs with resolution set to zero get sane values.Robin Watts
This is required for XPS, as otherwise images can be completely omitted.
2014-09-17xps: Add fz_xml_is_tag to simplify tag matching.Tor Andersson
2014-09-17Improve XML parser.Tor Andersson
Add a whitespace preserving mode, for future use with XHTML. Also parse XHTML entities. This is not strictly according to spec, but for properly formed XML documents it should not matter.
2014-09-09test-device: Abort interpretation when color found.Robin Watts
Add a new class of errors and use them to abort interpretation when the test device detects a color page.
2014-09-08Bug 695440: fix buffer underflows in load-jpeg.cSimon Bünzli
With this change, all 32-bit values read from untrusted data through read_value are compared unmodified in order to prevent unintended integer overflows during the comparison.
2014-09-08Update test-device to check images piecemeal.Robin Watts
Rather than decoding entire image only to give up after we find the very first pixel is color, add code so that the test-device can treat the image as a stream. This means that (for most image types at least) we can bale out without decoding everything. This reduces the runtime of 3001Pages.pdf from 14 minutes to 18 seconds.
2014-09-02Fix windows build breakages due to missing NAN and INFINITY.Robin Watts
Add some #definery for platforms where NAN and INFINITY aren't defined in std headers.
2014-09-02Fix memory leaks in test_device.Robin Watts
We were failing to drop each pixmap after testing it, and to free the test_device structure at the end of each run.
2014-09-02Add fz_snprintf and use it for formatting floating point numbers.Tor Andersson
2014-09-02Add locale-independent number formatting and parsing functions.Tor Andersson
2014-09-02Clean some whitespace.Tor Andersson
2014-09-01Performance improvement for test-device.Robin Watts
When we detect that a page is color, set the ignore image hint to avoid us loading future images. The overhead on loading images is not generally huge, except for JPEG2000 ones, which currently require decoding at load time. This therefore saves lots of time for such files. Also, a tiny tweak to ignore page components with 0 alpha.
2014-08-27Revise test-device; thresholding and exhaustive checking.Tor Andersson
The original version of the test-device could characterise pages as being grayscale/color purely based on the colorspaces used. This could easily be upset by grayscale images or shadings that happened to be specified in non-grayscale colorspaces however. We now look at the actual shading and image color values, and use a threshold value to allow for some measure of rounding errors in color values that are in practice grayscale.
2014-08-27Allow NULL callback functions in the mesh processor.Tor Andersson
Let either or both of the 'prepare' and 'process' callbacks be no-ops.
2014-08-20Add full-page color tinting option and key binding to X11 viewer.Tor Andersson
win32 supports tinting, but cannot change the color from the default.
2014-08-19Only include jmemcust.h when building our own libjpeg.Tor Andersson
2014-08-19don't always write to Visual Studio's Output console in debug buildsSimon Bünzli
We build MuPDF without NDEBUG defined in order to check assertions but don't want Visual Studio's Output console flooded with warnings for broken documents. So instead of always defining USE_OUTPUT_DEBUG_STRING for debug builds under Windows, allow the VS solutions to define it when desired and to omit it when not.
2014-08-19don't render non-empty dashing with zero-length phaseSimon Bünzli
Adobe Reader and Microsoft XPS viewer differ in their handling of non-empty dashed strokes where the phase is 0: Adobe Reader considers these to be faulty and omits them while Microsoft XPS Viewer renders them the same as an empty dash (i.e. solid). This patch makes Fitz no longer render such strokes and ensures that MuXPS never emits them so that the desired behavior results (this is the easier implementation since XPS rendering code renders stroked paths in a single location whereas PDF rendering does it all over the place). See https://code.google.com/p/sumatrapdf/issues/detail?id=2339 for a testcase.
2014-08-11Fix commit: Minor optimization in test_device.Tor Andersson
Invert the boolean test to mean what is actually intended. Fixes bug 695419.
2014-07-18fix off-by-one error in fz_unblend_masked_tileSimon Bünzli
fz_image::n is used inconsistently: Sometimes it includes the alpha channel and sometimes it doesn't. At the point where fz_unblend_masked_tile is called, it doesn't.
2014-07-18fix potential memory leak in load-jpx.cSimon Bünzli
2014-07-18allow 1-bit colormaps for TIFF imagesSimon Bünzli
The TIFF specification seems to only allow for 4-bit and 8-bit colormaps. However at least Microsoft's XPS viewer also accepts 1-bit colormaps and our current code handles this case already anyway. See https://code.google.com/p/sumatrapdf/issues/detail?id=2562 for a sample document.
2014-07-17Minor optimization in test_device.Ray Johnston
Don't convert and compare color if we already know the page has color.
2014-07-17Add feature testing device, and call it from mudraw with -T flag.Tor Andersson
Currently only tests for the presence of non-grayscale color.
2014-07-01Remove some trailing space.Matt Holgate
2014-06-30Fix coding style issues and remove C99 mid-block declaration.Matt Holgate
2014-06-26Partially revert "Add missing fz_var() and fix potential memory leak."Matt Holgate
(Revert the fix for potential memory leak - there wasn't a potential memory leak as the device only takes ownership of it's display list if dev->free_user is set). This reverts commit ada560eb015e7b2208c492d47f28da8093733c4a.
2014-06-26Add missing fz_var() and fix potential memory leak.Matt Holgate
2014-06-19Fix compiler warning.Matt Holgate
2014-06-18Fix for bug #694405 - iOS Pdf CrashMatt Holgate
If an iOS app uses too much memory, the OS asks it to free up some space. If it doesn't do so in a timely manner, it will get a second warning before being killed by the OS. In other platforms, where malloc() return NULL in OOM, the store scavenger releases memory when mallocs fail. In iOS, mallocs usually never return NULL because the app is killed before this can happen. Therefore, we need to initiate a scavenge from the low memory notification instead. We evict the store to 50% of its current size when a memory warning occurs when it is in the foreground, and 0% when a memory warning occurs whilst it is in the background. Having said this, I didn't manage to get a background warning to occur, presumably because we don't request background execution Therefore, I think in practice the OS just kills the process. However, this will be useful if we ever add background execution.
2014-06-10Fix library/header version error message and makefile dependency.Tor Andersson
2014-06-09Bug 695300: Sanitize draw-device stack handling in error cases.Robin Watts
When throwing an error during fz_alpha_from_gray, the stack depth can get confused. Fix this by moving some more code into the appropriate fz_try(). In the course of fixing this bug, I added some new optional debug code to display the stack level as it runs. This is committed here disabled; just change the appropriate #define in draw-device.c to enable it. Also, add some code to run_xobject, to avoid throwing in an fz_always() clause.
2014-05-28Further fix for Bug 695260: Cope with out of memory in fz_draw_end_maskRobin Watts
If we hit an out of memory error in fz_draw_end_mask, then pop the stack, and rethrow. Ensure that the generic device code catches this error and sets the error_depth to 1 so that the final pop is ignored.
2014-05-27Fix 693517: Support /SMask/Matte preblended images.Tor Andersson
2014-05-26Fix 695261: separate TM and CTM in outline extraction and stroking steps.Tor Andersson
We used to extract the outline using the combined TM*CTM matrix and use the identity transform for stroking, thus ending up with the wrong line width. If we instead extract using the TM and then stroke with the CTM we get the correct results.
2014-05-23Fix 695041: add special fast case for 8bpp TIFF predictor.Tor Andersson
2014-05-23Bug 695183: Inflate large buffers at a time for speed.Robin Watts
When I changed the stream implementations to use implementation specific buffers, rather than a generic public one in every fz_stream, I changed fz_read_byte to only get a single byte at a time. I noted at the time that the underlying stream was free to decode larger blocks if it wanted too, but I forgot to actually do this for the flate decoder. Fixing this here should solve the speed issues.
2014-05-22Fix 695222: Treat non-breaking space (U+00A0) as white space for search.Tor Andersson
2014-05-22Fix 695247: Use exponential realloc pattern and qsort for huge paths.Tor Andersson
Grow the edge list using an exponential realloc pattern. Use qsort for huge paths and only fall back to the simple shell sort for small paths.
2014-05-19Remove jmorecfg.h from includes.Chris Liddell
2014-05-19Add an application agnostic memory handler for libjpegChris Liddell
This adds a custom memory management layer between libjpeg and the calling app - in such a way that the code can be shared between mupdf and Ghostscript/PDL.
2014-05-19Fix 694952: Limit Type 3 font glyph bbox size.Tor Andersson
Don't let a glyph's bbox be too much bigger than the font bbox.
2014-05-12better buffer underflow protection for ba15a8cd3238a3a3c098ad8b7d96cb0e405fc26fSimon Bünzli
2014-05-12correctly bound image mask clippings in bbox deviceSimon Bünzli
Same as for fz_bbox_fill_image_mask, fz_bbox_clip_image_mask must transform the unit rectangle to get the bounding bbox.
2014-05-12prevent indeterminacy by uninitialized variablesSimon Bünzli
There are two issues where variables may be used unitialized: * extract_exif_resolution fails to set xres and yres for JPEG images if there's no valid resolution unit (mainly affects XPS documents) * xps_measure_font_glyph uses hadv and vadv unitialized if the glyph id isn't valid (i.e. if FT_Get_Advance fails)
2014-05-10Fix stack overflow in fz_vfprintf.Tor Andersson
Thanks to Triet Lai.
2014-05-07minor clean-upSimon Bünzli