summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-01-02Add rebinding for fz_streams.Robin Watts
2014-01-02Add rebinding for fz_output.Robin Watts
2014-01-02Bug 694585: Further improve mesh rendering timesRobin Watts
Add a cached color converter mechanism. Use this for rendering meshes to speed repeated conversions. This reduces a (release build to ppm at default resolution) run from 23.5s to 13.2 seconds.
2014-01-02Bug 694585: Slow rendering of meshesRobin Watts
In the existing code for meshes, we decompose the mesh down into quads (or triangles) and then call a process routine to actually do the work. This process routine typically maps each vertexes position/color and plots it. As each vertex is used several times by neighbouring patches, this results in each vertex being processed several times. The fix in this commit is therefore to break the processing into 'prepare' and 'process' phases. Each vertex is 'prepared' before being used in the 'process' phase. This cuts the number of prepare operations in half. In testing, this reduced the time for a (release build, generating ppm at default resolution) run from 33.4s to 23.5s.
2014-01-02Improve PDF repair logic.Robin Watts
When we meet a broken PDF file, we attempt to repair it. We do this by reading tokens from the file and attempting to interpret them as a normal PDF stream. Unfortunately, if the file is corrupt enough so that we start to read from the middle of a stream, and we happen to hit an '(' character, we can go into string reading mode. We can then end up skipping over vast swathes of file that we could otherwise repair. We fix this here by using a new version of the pdf_lex function that refuses to ever return a string. This means we may take more time over skipping things than we did before, but are less likely to skip stuff. We also tweak other parts of the pdf repair logic here. If we hit a badly formed piece of data, clear the num/gen we have stored so that the next plausible piece we get does not get assigned to a random object number.
2014-01-02Cull code unused as a result of the "tolerate inline images..." fix.Robin Watts
Remove code that's not used any more as a result of the previous fix, plus some code that was unused anyway.
2014-01-02fix memory leak in pdf_repair_xrefSimon Bünzli
The 0 null object is leaked if a document refers to 0 0 obj before requiring a delayed reparation (seen e.g. with 3324.pdf.asan.3.2585).
2014-01-02Fix memory leak in pdf_xref_size_from_old_trailer.Robin Watts
Thanks to Simon for spotting the original problem. This is a slight tweak on the patch he supplied.
2014-01-02Bug 694569: suspicious for loop in pdf-device.cPaul Gardiner
Replace an explicit i = i by a comment in a for loop where i is already at the correct starting value.
2014-01-02Bug 694732: Android: draw single point strokes when inkingPaul Gardiner
Make single-point strokes display by special casing them as circles. Thanks for Michael Cadilhac for the suggestion.
2014-01-02Bug 694729: Rounding the InkPaul Gardiner
Use round caps and joins so as to better match the result of drawing, and also so that single dots display. Thanks to Michael Cadilhac for the suggestion.
2014-01-02Bug 694753: Android: Recompute the patch on PageView.update()Paul Gardiner
In some cases freshly-created annotations could fail to appear because the HQ patch was being left in place even when zoomed fully in, and when in that state, the patch was not updated. The bug was usually hidden by an onLayout call being triggered with an out- of-date patch, which causes the HQ patch to be removed. The bug is fixed by having addHq remove the patch when fully zoomed out. Since now addHq may sometimes add the patch and sometimes remove it, I've renamed it to updateHq. Correctness of this fix has not been checked because I was unable to trigger the bad behaviour on my test device.
2014-01-01Bug 693320: Avoid unaligned accesses in SHA routines.Robin Watts
Avoid unnecessary copies. Minimise calls to isbigendian.
2014-01-01tolerate inline images without EOF markersSimon Bünzli
This is required for e.g. 1980_-_compressed_inline_image.pdf and Bug690300.pdf .
2014-01-01don't fail on invalid object streamsSimon Bünzli
At https://code.google.com/p/sumatrapdf/issues/detail?id=2436 , there's a document with an empty xref section which since recently causes a repair to be triggered. Repairs then stop when pdf_repair_obj_stms fails on an object which isn't even required for the document to render. Such broken object streams should rather be ignored same as broken objects are ignored in pdf_init_document.
2013-12-30Bug 694564: Move pdf_lookup_page_obj to be iterativeRobin Watts
Avoid recursion to avoid stack overflows.
2013-12-24Bug 694587: Fix pattern repeat calculationRobin Watts
The pattern repeat calculation should be done in pattern space, but one of the arguments in the calculation was being taken from device space. Fix this. Also only apply the bias in the case where the bias would make it larger. 173 progressions.
2013-12-24Bug 694810: Implement late file repair for PDFs.Robin Watts
Currently, if we spot a bad xref as we are reading a PDF in, we can repair that PDF by doing a long exhaustive read of the file. This reconstructs the information that was in the xref, and the file can be opened (and later saved) as normal. If we hit an object that is not in the expected place however, we cannot trigger a repair at that point - so xrefs with duff offsets in (within the bounds of the file) will never be repaired. This commit solves that by triggering a repair (just once) whenever we fail to parse an object in the expected place.
2013-12-23Bug 694712: Do not create empty Contents stream for new pages.Robin Watts
Empty Contents streams are not valid - they need a length at least. The alternative approach would be to put /Length 0 and update it later.
2013-12-23Bug 694715: Fix typo in error messageRobin Watts
Thanks to Michael Cadilhac for spotting this.
2013-12-23Bug 694749: Fix transformation of hinted glyphsRobin Watts
Simple typo. Thanks to Alexander Monakov for spotting this.
2013-12-23Bug 694794: Fix blendmode use in pdf device.Robin Watts
Previously we were setting blendmode in the created form XObjects transparency group definition. This didn't work as PDF readers don't look for it there. Now we set it in the calling stream's resources, and set it before calling the group.
2013-12-23Bug 694765: Fix typo in man pages.Robin Watts
Thanks for Francesco Turco for spotting this.
2013-12-23Bug 694770: Fix typo in error message.Robin Watts
Thanks to Makoto Fujiwara for spotting this.
2013-12-19Solve subpixel rendering problems with 270 degree rotationsRobin Watts
It seems that (int)-98.5 = 98, not -99. Use floorf instead.
2013-12-18Android: a few improvements to the view handlingPaul Gardiner
While scrolling, avoid some overheads to do with image scaling that need updating only on a zoom-level change Remove a pointless invalidate call. Avoid calls to removeViewInLayout and removeAllViewsInLayout that were being made in functions not called from onLayout
2013-12-17Bug 694810: Fix crash when clicking on mupdf window after failed page load.Robin Watts
If we have a NULL page, don't attempt to pass events to it.
2013-12-17Bug 694831: Check width and height of bitmap, not width and widthRobin Watts
Thanks to Dale King for reporting this.
2013-12-17Remove duplicated XPS definitions from header.Robin Watts
2013-12-17Remove fz_context from pdf_cryptRobin Watts
Unused field. Also tweak some comments for clarity.
2013-12-16javascript: fix missing type destructionPaul Gardiner
2013-12-16iOS: add javascript supportPaul Gardiner
2013-12-16JavaScriptCore-based implementation of the MuPDF JS engine APIPaul Gardiner
2013-12-14Add in error trapping. Fix warnings. Remove Win8 deprecated calls. Fix ↵Michael Vrhel
issues with surface thumb rendering. Also, make updates for changes made to font names and 3rd party file structures.
2013-11-28Bug 694362: Pull latest jbig2dec changes in.Robin Watts
2013-11-28Pull in the latest jbig2dec changes.Robin Watts
These were the last few fixes that went back from mupdf to gs. This seems to solve bug 694362. Thanks to Shelly for this.
2013-11-28Update jbig2dec to latest version from gs.Robin Watts
Thanks to Shelly for pointing out that this needed to be done. This might solve bug 694362.
2013-11-28Put thirdparty config headers in separate directories.Tor Andersson
Only -I the config header directory if building the thirdparty library, not if using the system library. Fix bug 694808.
2013-11-28Update mupdf to use latest openjpeg pulled from ghostpdl.Robin Watts
The OpenJPEG in gs is v2, with various patches for fixes. These are in the process of being passed upstream. We now automatically pull the openjpeg tree out of GhostPDL and put it in as one particular branch in the thirdparty/openjpeg.git repo. Change to track this in MuPDF. This is in keeping with what we have been doing with the jbig2dec repo for a while now.
2013-11-28Bug 694127: Valgrind fix for pdf_decode_cmapRobin Watts
A poorly formed string can cause us to overrun the end of the buffer. Now we check the end of the string at each stage to avoid this.
2013-11-28Bug 694118: Fix valgrind warning caused by overflowing functionRobin Watts
We were miscalculating the offsets into a sampled functions table, causing us to overrun the end. Fixed here.
2013-11-27fix regression from da277059b37380d57028ff79a636f4d725c96e8fSimon Bünzli
The changes to fz_render_glyph cause the scissor rectangle to no longer match the transformation matrix which causes Type 3 glyphs to be clipped at larger resolutions.
2013-11-27track font path in fz_fontSimon Bünzli
ft_file was removed in a2c945506ea2a2b58edbde84124094c6b4f69eac even though it might still be needed by downstream consumers (such as SumatraPDF) for allowing devices to load fonts again when a font has been loaded by fz_new_font_from_file which doesn't maintain a buffer.
2013-11-27fix memory leak introduced with a2c945506ea2a2b58edbde84124094c6b4f69eacSimon Bünzli
fz_new_font_from_buffer keeps the buffer for the font, so callers which no longer need the data have to drop the buffer themselves explicitly.
2013-11-27Bug 694116: Solve valgrind issues in draw device.Robin Watts
The actual issue here is that a pixmap is dropped more times than it should be due to an error in the rendering pipeline. The problem arises because we fail to push a clip image mask, but still pop the mask off the stack later. This puts us off by 1 in the stack handling. The simplest solution to this (that will be safe no matter what mistakes are made by the caller too) is to add some simple tests in the draw device to ensure we do not free too early.
2013-11-27Bug 694114: Fix valgrind issue.Robin Watts
I believe the implementation for revision 3 is wrong. From pdf_reference17.pdf, step 5 of Algorithm 3.5 says: 5. Do the following 19 times: Take the output from the previous invocation of the RC4 function and pass it as input to a new invocation of the function; use an encryption key generated by taking each byte of the original encryption key (obtained in step 1) and performing an XOR (exclusive or) operation between that byte and the single-byte value of the iteration counter (from 1 to 19). "the original encryption key (obtained in step 1)" is pwbuf (32 bytes) not key. Even if it was key, it wouldn't be n bytes long, but only 16.
2013-11-27iOS: some fixes for iOS 7Paul Gardiner
2013-11-26Bug 694113: Solve double free causing valgrind warnings.Robin Watts
In case of an unknown function type, we free 'func'. Then we later read func->type out of the block, and drop the block. Simple solution is not to free the block initially and to let the drop of the block do it for us.
2013-11-26Add const keyword to some font function parameters.Tor Andersson
2013-11-26Add fz_advance_glyph and fz_encode_character functions.Tor Andersson