summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-03-24Rework handling of PDF names for speed and memory.Robin Watts
Currently, every PDF name is allocated in a pdf_obj structure, and comparisons are done using strcmp. Given that we can predict most of the PDF names we'll use in a given file, this seems wasteful. The pdf_obj type is opaque outside the pdf-object.c file, so we can abuse it slightly without anyone outside knowing. We collect a sorted list of names used in PDF (resources/pdf/names.txt), and we add a utility (namedump) that preprocesses this into 2 header files. The first (include/mupdf/pdf/pdf-names-table.h, included as part of include/mupdf/pdf/object.h), defines a set of "PDF_NAME_xxxx" entries. These are pdf_obj *'s that callers can use to mean "A PDF object that means literal name 'xxxx'" The second (source/pdf/pdf-name-impl.h) is a C array of names. We therefore update the code so that rather than passing "xxxx" to functions (such as pdf_dict_gets(...)) we now pass PDF_NAME_xxxx (to pdf_dict_get(...)). This is a fairly natural (if widespread) change. The pdf_dict_getp (and sibling) functions that take a path (e.g. "foo/bar/baz") are therefore supplemented with equivalents that take a list (pdf_dict_getl(... , PDF_NAME_foo, PDF_NAME_bar, PDF_NAME_baz, NULL)). The actual implementation of this relies on the fact that small pointer values are never valid values. For a given pdf_obj *p, if NULL < (intptr_t)p < PDF_NAME__LIMIT then p is a literal entry in the name table. This enables us to do fast pointer compares and to skip expensive strcmps. Also, bring "null", "true" and "false" into the same style as PDF names. Rather than using full pdf_obj structures for null/true/false, use special pointer values just above the PDF_NAME_ table. This saves memory and makes comparisons easier.
2015-03-24Don't pass interpreter context to pdf_processor opcode callbacks.Tor Andersson
Update buffer and filter processors. Filter both colors and stroke states. Move OCG hiding logic into interpreter.
2015-03-23Pass context to pdf_page_contents_process callback.Tor Andersson
2015-03-20Fix Memtrace for 64bit operation.Robin Watts
2015-03-20Workaround bug in ftoa.Tor Andersson
2015-03-20Add fz_fprintf function.Tor Andersson
2015-03-20Automatically update /Length and /Filter in pdf_update_stream.Tor Andersson
2015-03-20First attempt at mupdf tizen build.Robin Watts
2015-03-20Update .gitignore to ignore x64 build files.Robin Watts
2015-03-20Fix Win32 builds of MuPDF; freetype config options not found.Robin Watts
Fred had updated a path in an include file. The Makefiles cope with this, the VS solution does not.
2015-03-16switch to VER-2-5-5 of freetype.fredrossperry
2015-03-12VS solution: bring x64 libmupdf into line with other files.Robin Watts
The lib was being built in an odd place.
2015-03-01Bug 695658: Fix crash with mutool clean -l -aRobin Watts
We were failing to allow for the change in length of the hint stream caused by the ascii encoding when calculating offsets.
2015-02-27Bug 695853: Fix pdf clean operation with invalid refs in input file.Robin Watts
MuPDF (and other PDF readers) treat invalid references as 'null' objects. For instance, in the supplied file, object 239 is supposedly free, but a reference is made to it. When cleaning (or linearising) a file, we renumber objects; such illegal refs then end up pointing somewhere else. The workaround here is simply to spot the invalid refs during the mark phase, and to set the referencing to null.
2015-02-27gsview and windows: Fixes for changes in mupdf APIMichael Vrhel
Also a few fixes in the project files based upon recent updates.
2015-02-26Clean up some type casts.Tor Andersson
2015-02-26tweak pdf_parse_file_specRobin Watts
pdf_parse_file_spec sometimes extracts the wrong path from a FileSpec: E.g. the /DOS path should never be returned under Unix systems, neither should be the old /Mac paths. For consistency, this patch also converts filesystem paths under Windows into a format applications will expect (e.g. from "/C/path/..." to "C:\path\..."). Finally, pdf_parse_file_spec is exposed to callers (SumatraPDF requires that for manually processing FZ_ANNOT_FILEATTACHMENT and embedded files).
2015-02-25Allow pdf_device to be created with pre-populated buffer.Robin Watts
When watermarking, we may want to use the PDF device on an existing buffer. In this case, we have no 'contents' object.
2015-02-25Add post processing option to page operator cleaning.Robin Watts
In order to be able to watermark etc, we want the ability to add more operators/resources after page cleaning. Add a post processing hook to enable this to be done more easily.
2015-02-25Bug 695851: Fix SEGV in mutool info.Robin Watts
Add missing initialisation of glo.ctx required due to API change.
2015-02-25Add 64 bit windows builds to MSVC solution.Robin Watts
A few casts are required within the code, along with a few #ifdef changes. Some tweaks to curl are required too.
2015-02-25iOS: Minor cleanups to match current best practiceJoseph Heenan
2015-02-25iOS: Fix some warnings in the 64bit buildJoseph Heenan
2015-02-25iOS: Disable empty body warningJoseph Heenan
This silences this warning: thirdparty/jbig2dec/jbig2_text.c:899:73: warning: for loop has empty body [-Wempty-body] for (SBSYMCODELEN = 0; (1 << SBSYMCODELEN) < SBNUMSYMS; SBSYMCODELEN++); ^ thirdparty/jbig2dec/jbig2_text.c:899:73: note: put the semicolon on a separate line to silence this warning
2015-02-25iOS: Suppress warnings about unused functionsJoseph Heenan
There are a fair number of warnings about unused functions, mostly in third-party modules, and we would like the build to be warning free. We need to change the main Makefile, as -Wall is currently added in Makerules, and we need our -Wno-unused-function in XCFLAGS to be after -Wall on the command line for it to have any effect.
2015-02-25filter-fax.c: remove cf_uncompressed_decode, it's never usedJoseph Heenan
2015-02-25iOS: conform to recent mupdf API changes.fredrossperry
2015-02-25Avoid fz_begin_tile_id ever returning an undefined value.Robin Watts
Silly oversight.
2015-02-25Fix Android builds.Robin Watts
Update android Core.mk file for html document handler, and fix a stray fz_free_page that didn't get updated.
2015-02-25Text device; collect matrix and bbox for images too.Robin Watts
We were not filling in the matrix and bbox fields for images collected as part of the text extraction device. Fixed here.
2015-02-24Update display list tile skipping.Robin Watts
When we meet cached tiles when rendering the display list, we need to skip over their contents. Previously we did this by skipping display list nodes in their entirety. With the new display list scheme however, we cannot simply skip nodes completely as the graphic state changes must be remembered. We therefore update the list playback routine to keep track of the clip depth and to skip the function calls as required.
2015-02-24Fix incorrect object culling in display list.Robin Watts
I was testing an untransformed rectangle. This was not being picked up as our cluster tests use the identity matrix.
2015-02-24Update MSVC solution with html entries. Fix windows issues with html.Robin Watts
Add the new source files to the solution. Windows builds whinge about float->double conversions. Fix these with explicit casts. Avoid calling strtof and strcasecmp.
2015-02-24Bug 695843: Tweak bboxes of type3 fonts; honour the d1 values.Robin Watts
The example file for this bug has an invalid font bbox. The current code uses this bbox (or some multiple of it) to clip the glyphs size. In the new code, when we convert the glyphs to display lists we watch for the bbox given in any d1 operator used. If we find one, we gather the rectangle specified and store it as the glyph rectangle in the fz_font. If we then attempt to bound a glyph that used d1, it happens instantly without needing to run the list. This seems to match acrobats behaviour. Tests indicate that Acrobat never clips d0 glyphs, so our behaviour is still different here, but I am not changing this at the moment. Also, I note that t3flags should be a un unsigned short but are currently just a char. Fix that too. Also fix some missing code in fz_new_font that would cause leaks if mallocs failed.
2015-02-24Simplify/Correct logic in pdf_show_charRobin Watts
Move the logic in pdf_show_char to use the same idiom as used elsewhere. Specifically this ensures that empty rects are handled correctly.
2015-02-24fz_irect_from_rect; don't make a non empty irect from an empty rect.Robin Watts
This avoids up problems with a forthcoming commit.
2015-02-24Squash some warnings from scan build.Robin Watts
2015-02-23Merge branch 'html'Tor Andersson
Conflicts: Makefile
2015-02-23Update pdf-js-none for context passing changes.Tor Andersson
2015-02-23Fix double-malloc error.Tor Andersson
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!