summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-02-20Add fz_trim_path and call it.Robin Watts
Whenever we fz_keep a path, it's an indication that we're going to be keeping the path around for a while (anod not changing it any more). We therefore take the opportunity to trim the path buffers down.
2015-02-20Rejig display device to have a more compact memory representation.Robin Watts
Rather than a linked list of display nodes, we use solid block of serialised data. We send a 32bit word, which contains various bitfields. These bitfields indicate the command type, and the presence or absence of various fields (such as paths, colorspaces, colors etc). If these fields are not present, they are held to be the same as the previous values.
2015-02-20Do not crash on text extraction on pages with no text.Robin Watts
Thanks to malc for pointing out the problem.
2015-02-18Fix typos and reference counting errors in CBZ.Tor Andersson
2015-02-18Fix 695831: integer overflow in PNG and TIFF loaders.Tor Andersson
2015-02-17Bring Windows app up to date with API changes.Robin Watts
2015-02-17Fix memory leak in fz_page.Tor Andersson
2015-02-17Use embedded superclass struct instead of user pointer in devices.Tor Andersson
2015-02-17Add helper functions to keep/drop reference counts with locking.Tor Andersson
Add locks around fz_path and fz_text reference counting.
2015-02-17Remove pointless return value checks when calling fz_open_file.Tor Andersson
fz_open_file does not return NULL on failure -- it throws an exception!
2015-02-17Add ctx parameter and remove embedded contexts for API regularity.Tor Andersson
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
2015-02-17Rename fz_close_* and fz_free_* to fz_drop_*.Tor Andersson
Rename fz_close to fz_drop_stream. Rename fz_close_archive to fz_drop_archive. Rename fz_close_output to fz_drop_output. Rename fz_free_* to fz_drop_*. Rename pdf_free_* to pdf_drop_*. Rename xps_free_* to xps_drop_*.
2015-02-17Reference count fz_document.Tor Andersson
2015-02-17Reference count fz_path and fz_text.Tor Andersson
Disallow modification of shared fz_path and fz_text objects. They should follow a create once, consume often pattern, and as such should be immutable once created.
2015-02-10Add some Memento_labels to aid debugging of leaks.Robin Watts
2015-02-10Attempting to render a JPEG with xres and yres set to 1 fails.Robin Watts
We end up trying to scale the JPEG up 72 times and fail a malloc. A better plan is to make the image handler disbelieve any xres or yres values less than 72dpi. We take care to still preserve aspect ratios etc.
2015-02-10Print dialog release when new document is opened.Michael Vrhel
If this release is not done, the previous documents pages appear in the preview and bad things happen if you try to step through the pages in the preview.
2015-02-10Disable options that are not currently possible to do when the source is an ↵Michael Vrhel
image. Currently if the source was a png, jpeg or cbz file we can't do conversions with ghostscript and also we can't print. So I will disable the controls for now and we can look into adding that functionality later if we want. Disable printing capability for image based formats. Currently printing is all XPS based. If the source document is JPG, PNG or CBZ we don't currently have a method for creating the XPS content for these. We could do a bitmap print or possibly wrap up the images in a XPS file or just do a direct bitmap print via some C# magic. I need to investigate. For the short time, though it is simply disabled.
2015-02-05Fix makefile dependencies (gen_font_droid.h is no more).Tor Andersson
2015-02-03Installer changes for gsview.nsiMichael Vrhel
Addition of license information. Also changes to ensure registry keys used by application are removed during the uninstall. Many changes in the installer code to ensure that the file type associations are made and the proper icons are displayed for each file type.
2015-02-03Update URW fonts.Tor Andersson
Add the new URW base fonts that include greek and cyrillic scripts. These new fonts remove the need for DroidSans as a generic fallback font.
2015-02-03Update MuJS.Tor Andersson
2015-01-27Fix mismatching allocation and deallocation issues.Michael Vrhel
The form of delete should match the form that is used in the new command. Otherwise the behavior is undefined.
2015-01-27Move OK and Cancel to lower left of dialog. Suggested by Fred-Ross Perry.Michael Vrhel
2015-01-27Remove visual studio based installers and add nsis installerMichael Vrhel
2015-01-27Fix issue in display list CacheMichael Vrhel
The commit fc05b51c2b198dcc5553f6de1b8fb0e22e7d28ae cleaned up a few issues in the display list cache but it introduced issues when multiple threads are using the lists. In particular one thread could be using a list at the tail of the cache list, while another thread is adding one to the cache, and removing the entry at the tail. The solution is to make sure the ref count of the list is incremented when someone is using the list and making sure that it gets decremented when they are done with the list.
2015-01-27Catch exception thrown for case when character conversion failsMichael Vrhel
2015-01-22Fix android scrolling bug.Robin Watts
Spotted by "Pogon". The code to choose between horizontal and vertical scrolling was broken due to a missing ! in a condition. Cut and Paste error.
2015-01-21Fix rebase/merge error in previous commit.Tor Andersson
2015-01-21Update MuJS.Tor Andersson
2015-01-21Remove dead structure definition, pdf_obj_read_state.Robin Watts
This isn't used anywhere.
2015-01-20don't omit patterns with huge xstep/ystep valuesSimon Bünzli
If a pattern is expected to be rendered exactly once and its relevant part covers the target area, the xstep and ystep values may be far larger than the pattern's relevant content. Due to rounding applied in pdf_show_pattern, such patterns have been omitted so far. This issue is exposed e.g. by the document linked from http://forums.fofou.org/sumatrapdf/topic?id=3184639 .
2015-01-20don't decode '8' and '9' as octal digitsSimon Bünzli
At https://github.com/sumatrapdfreader/sumatrapdf/issues/66 there's a document which contains a string (\358) which is parsed as (\360) with the 8 overflowing instead of as (\0358) with the 8 being the first character after the octal escape. This patch restricts octal digits to '0' to '7' to fix that issue.
2015-01-20remove some lonely tabs and move some braces onto their own linesSimon Bünzli
2015-01-20fix crash caused by commit 90c560641d9b459a658029eefc4cbb02fdbca0b5Simon Bünzli
When loading e.g. the file from bug 694567, MuPDF uses an unitialized variable because pdf_document::xref_index contains values relative to the document's original multi-part xref while the actual xref is the repaired single-part one (and thus the cached value is too large). Properly resetting the xref_index before starting reparation fixes this crash.
2015-01-20fix memory leak introduced with commit 90c560641d9b459a658029eefc4cbb02fdbca0b5Simon Bünzli
2015-01-20Bug 695770: fix TODO in commit d7c0c0856b31be17823ae4745b2c542a9c71765fSimon Bünzli
pdf_xref_find_subsection does indeed solidify the wrong xref section: it should operate only on the oldest xref and not overwrite the most recent one with older entries.
2015-01-20don't try extracting object number 0Simon Bünzli
pdfextract_main by default iterates through all objects from number 0 to the size of the document's xref table. Object number 0 is however always supposed to be free, so pdfextract consistently fails and shows a slightly confusing warning. Object extraction should by default start at object 1 in order to prevent this warning.
2015-01-20Fix reference counting of display lists in Cache.cppMichael Vrhel
Fred Ross-Perry found some issues with the display list counting. This fixes the problems. Also he found a spot where we should have been doing just the page contents as opposed to the page.
2015-01-20Fix VS2013 project to build after files added and removed.Michael Vrhel
2015-01-20Rework of gsview printing with addition of new Print control dialogMichael Vrhel
This adds an additional project (gsprint.vxcproj) which will do the necessary native calls to bring up the custom print dialog for the output device. We can then obtain the settings and make the appropriate page size adjustments in creating our xps content.
2015-01-06Add xref_index to speed searching of sparse xrefs.Robin Watts
Add a new index that quickly maps object number to the first xref in which an object appears. This appears to get us the speed back that we lost when moving to sparse xrefs.
2015-01-05Another PDF Xref speedup from Malc.Robin Watts
Following the recent change to hold pdf xrefs in their native 'sparse' representation, searching the xref takes longer. Malc has investigated this slowdown and found that it can be largely avoided by not searching the xref lists first. A modified version of his first patch has gone in already (getting us from 10x slower to just 5x slower). This commit is a modified version of a second patch from him. Again it works by avoiding searching the xref list twice. The original version of this patch 1) appears broken to me, as it could return the wrong xref entry when object streams have more than one object in them, and 2) supposedly gets the speed back to the original 'pre-sparse change' speed. I have updated the patch to fix 1), and I hope this should not affect 2). I am slightly suspicious that removing a search can get us a 5x speed increase, but certainly this is an improvemnet. There is scope for us further reducing the search times, by us using a new table to map object number -> xref number, but unless we find a case where we are noticably slower than before, I think we can ignore this.
2014-12-29Remove unnecessary test.Robin Watts
We know i >= 0 as we've already thrown if i < 0 earlier. Credit to Malc for spotting this.
2014-12-29Performance optimisation with pdf_cache_object/pdf_get_xref_entryRobin Watts
The recent change to holding pdf xrefs in a sparse format has resulted in a significant decrease in speed (x10). Malc points out that some of this (2x) can be recovered simply by making pdf_cache_object return the entry which it found the object in. This saves us having to immediately call pdf_get_xref_entry again afterwards. I am still thinking about ways to try and get the remaining time back.
2014-12-29Fix windows build failure.Robin Watts
C89 code is preferable to gcc code; define variables at the start of blocks.
2014-12-18Bug 695746: make LZW decoder slightly more tolerantSimon Bünzli
Ghostscript's LZW decoder accepts invalid LZW code 4096 if it's immediately followed by LZW clear code 256 for handling files produced by certain broken encoders and other common PDF readers seem to have similar error handling. This patch makes MuPDF tolerate such broken files as well.
2014-12-12prevent warning C4090Simon Bünzli
MSVC complains about using const char** as argument to qsort or free which both expects pointers to (pointers to)* non-const values. Adding type casts fixes the warning.
2014-12-12make xps_read_part report correct part sizesSimon Bünzli
Starting with commit 2f4cdd4fd0580e3121773e89a7c6e7a9e1ffa54b, xps_read_part zero-terminates the read data. It does however also count that zero-terminator to the part's size which confuses callers handling non-text data.
2014-12-12fix memory leaksSimon Bünzli
Commit 5add23c7233c3f34fdfa6387873b1d3bdb93e1d6 and commit 2f4cdd4fd0580e3121773e89a7c6e7a9e1ffa54b introduced three memory leaks which only appear in error cases: * unzip.c leaks if a ZIP archive uses a compression method other than store or Deflate * xps-zip.c leaks if fz_open_archive_with_stream throws for broken ZIP archives * xps-zip.c leaks also if a piece of a split file is missing