summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2012-03-01Add some more docs to fitz.hRobin Watts
Add docs for fz_store, fz_image, fz_halftones. Move fz_item definition into res_store.c as it does not need to be external. Rename fz_store_context to fz_keep_store_context to be consistent.
2012-03-01Fix incorrect handling of race condition.Robin Watts
When inserting an item into the store we check for an identically keyed item being there already (for instance a pixmap created from an image I at factor F may find that such a pixmap has already been inserted). The correct thing to do is to return the old one so we can use that in preference. The code was attempting to do this, but was returning a pointer to the fz_item rather than to the item->val. Fixed here.
2012-03-01Setjmp/longjmp exception tweaks.Robin Watts
First, fix a couple of the 'alternative formulations' of the try/catch code in the comments. Secondly, work around a Mac OS X compiler bug.
2012-03-01Remove mask entry from fz_pixmap as never used any more.Robin Watts
Also, the attempts to keep it up to date were causing race conditions in multithreading cases.
2012-02-29Fix trailing whitespace and mixed tabs/spaces in indentation.Tor Andersson
2012-02-29Fix typo that causes an undefined pointer to be freed.Robin Watts
When a font is destroyed the t3 resources are freed; due to a typo a random pointer was being freed.
2012-02-29On MacOS/iOS use _setjmp/_longjmp rather than setjmp/longjmp.Robin Watts
On Apple OSs setjmp/longjmp also mess with the signal handlers; we don't use signals, so we don't need the slowdown this causes. CLUSTER_UNTESTED as not tested on cluster.
2012-02-29Move base_object from fitz to pdf in the VS solution too.Robin Watts
Forgot to move this earlier.
2012-02-29Fix typo in hash table code.Robin Watts
When detecting a clash when inserting into a hash table (which should only ever happen in multithreaded cases), we should give a warning, and return the existing item from the table. The current code doesn't do this due to a stupid typo. Fixed here. CLUSTER_UNTESTED as we don't test multithreaded operation in the cluster.
2012-02-26Move fz_obj to be pdf_obj.Robin Watts
Currently, we are in the slightly strange position of having the PDF specific object types as part of fitz. Here we pull them out into the pdf layer instead. This has been made possible by the recent changes to make the store no longer be tied to having fz_obj's as keys. Most of this work is a simple huge rename; to help customers who may have code that use such functions we have provided a sed script to do the renaming; scripts/rename2.sed. Various other small tweaks are required; the store used to have some debugging code that still required knowledge of fz_obj types - we extract that into a nicer 'type' based function pointer. Also, the type 3 font handling used to have an fz_obj pointer for type 3 resources, and therefore needed to know how to free this; this has become a void * with a function to free it.
2012-02-26Continued documentation improvements.Sebastian Rasmussen
More changes still to come.
2012-02-26Document some more functions.Sebastian Rasmussen
2012-02-26Document the most commonly used interface functions.Sebastian Rasmussen
2012-02-26Add working example of how to render a PDF to a PNG.Sebastian Rasmussen
2012-02-26Add introductory MuPDF documentation.Sebastian Rasmussen
2012-02-25Fix assert/SEGVs seen in cluster due to using a color image as a mask.Robin Watts
When loading a JPX image with no specified colorspace, we were ending with image->colorspace being set to NULL. This caused us to treat the image as a mask. The correct fix is to inherit the colorspace from the jpx once loaded.
2012-02-25Revamp pdf lexing codeRobin Watts
A huge amount (20%+ on some files) of our runtime is spent in fz_atof. A survey of results on the net suggests we will get much better speed by writing our own atof. Part of the job of doing this involves parsing the string to identify the component parts of the number - ludicrously, we are already doing this as part of the lexing process, so it would make sense to do the atoi/atof as part of this process. In order to do this, we need somewhere to store the lexed results; rather than add a float * and an int * to every single pdf_lex call, we generalise the calls to pass a pdf_lexbuf * pointer instead of separate buffer/max/string length pointers. This should help us overall.
2012-02-25Add fz_trim_buffer function, and call it.Robin Watts
Remove stray space at the end of buffers.
2012-02-25Rework image handling for on demand decodeRobin Watts
Introduce a new 'fz_image' type; this type contains rudimentary information about images (such as native, size, colorspace etc) and a function to call to get a pixmap of that image (with a size hint). Instead of passing pixmaps through the device interface (and holding pixmaps in the display list) we now pass images instead. The rendering routines therefore call fz_image_to_pixmap to get pixmaps to render, and fz_pixmap_drop those afterwards. The file format handling routines therefore need to produce images rather than pixmaps; xps and cbz currently just wrap pixmaps as images. PDF is more involved. The stream handling routines in PDF have been altered so that they can recognise when the last stream entry in a filter dictionary is an image decoding filter. Rather than applying this filter, they read and store the parameters into a pdf_image_params structure, and stop decoding at that point. This allows us to read the compressed data for an image into memory as a block. We can then restart the image decode process later. pdf_images therefore consist of the compressed image data for images. When a pixmap is requested for such an image, the code checks to see if we have one (of an appropriate size), and if not, decodes it. The size hint is used to determine whether it is possible to subsample the image; currently this is only supported for JPEGs, but we could add generic subsampling code later. In order to handle caching the produced images, various changes have been made to the store and the underlying hash table. Previously the store was indexed purely by fz_obj keys; we don't have an fz_obj key any more, so have extended the store by adding a concept of a key 'type'. A key type is a pointer to a set of functions that keep/drop/compare and make a hashable key from a key pointer. We make a pdf_store.c file that contains functions to offer the existing fz_obj based functions, and add a new 'type' for keys (based on the fz_image handle, and the subsample factor) in the pdf_image.c file. While working on this, a problem became apparent in the existing store codel; fz_obj objects had no protection on their reference counts, hence an interpreter thread could try to alter a ref count at the same time as a malloc caused an eviction from the store. This has been solved by using the alloc lock as protection. This in turn requires some tweaks to the code to make sure we don't try and keep/drop fz_obj's from the store code while the alloc lock is held. A side effect of this work is that when a hash table is created, we inform it what lock should be used to protect its innards (if any). If the alloc lock is used, the insert method knows to drop/retake it to allow it to safely expand the hash table. Callers to the hash functions have the responsibility of taking/dropping the appropriate lock, and ensuring that they cope with the possibility that insert might drop the alloc lock, causing race conditions.
2012-02-22Fix a double free on an error path.Robin Watts
2012-02-22Tweak animations and colors.Tor Andersson
2012-02-21Set default DPI in jpeg images if the file says 0.Tor Andersson
2012-02-21Replace Android application icon with one based on the logo.Tor Andersson
2012-02-21android app: slide buttons on instead of fadingTor Andersson
2012-02-21Add android temporary files to .gitignoreTor Andersson
2012-02-21Android app: react to "Done" button when searchingPaul Gardiner
2012-02-21Add new Android button icons and tweak the layouts.Tor Andersson
2012-02-21Use a fixed duration of 400ms for scroll animation.Tor Andersson
Make fade in/out animations 200ms long, the same as the default animation duration for iOS UI animations.
2012-02-21Android app: decode the uri before using as a file namePaul Gardiner
2012-02-21Remove android/local.properties from the git.Tor Andersson
Seeing as it has local configuration, it should not be version controlled. The android manual says so.
2012-02-21Android app: make taps on side margins move to next and previousPaul Gardiner
2012-02-21Android app: implement Tor's request to clamp vertical position when height ↵Paul Gardiner
within screen
2012-02-21Go back to using a direct fade animation in favour of the ViewAnimatorPaul Gardiner
2012-02-20Android tweaks; attempt to trigger on .xps and .cbz files too.Robin Watts
In theory, the changes here should make mupdf be recognised as a handler for .xps and .cbz files (and for .pdf files without the correct mimetype). In practise I can't actually make this work right on my device. I'll open a stack overflow question and ask there.
2012-02-20Remove "MuPDF" title bar on Android app.Robin Watts
Simple change to the XML.
2012-02-20Update android app to use document interfaceRobin Watts
This adds XPS and CBZ support for free.
2012-02-20Updated MuPDF Android app from Paul Gardiner.Paul Gardiner
2012-02-16Remove mupdfdraw and muxpsdraw in favour of mudraw.Robin Watts
No other code changes.
2012-02-15Check determinant before inverting a matrix to avoid division by zero.Tor Andersson
2012-02-15Stop searching in viewer when clicking page links.Sebastian Rasmussen
2012-02-15Add braces to resolve ambiguity.Robin Watts
2012-02-15Fix typo in comment.Robin Watts
CLUSTER_UNTESTED.
2012-02-15Treat 0000000000 * n xref entries as free ones.Robin Watts
Quartz generated PDFs (and maybe others too) seem to use 000000000 65536 n to mean "free object" in defiance of the spec. Add special case code to mupdf to handle this.
2012-02-14Fix potential NULL deref in ensure_space.Robin Watts
Silly mistake in previous commit.
2012-02-13Create mudraw; mupdfdraw cloned and adapted to use fz_documentRobin Watts
All in one command line replacement for muxpsdraw and mupdfdraw.
2012-02-13Add locking around freetype calls.Robin Watts
We only open one instance of freetype per document. We therefore have to ensure that only 1 call to it takes place at a time. We introduce a lock for this purpose (FZ_LOCK_FREETYPE), and arrange to take/release it as required. We also update the font context so it is properly shared.
2012-02-13Remove STORE lock in favour of smarter use of ALLOC lock.Robin Watts
This simplifies other locking issues (notably freetype).
2012-02-13Remove arch_port.c from visual C solution/Android build.Robin Watts
File references escaped deletion in previous commit.
2012-02-11Purge unused and bit rotted fz_accelerate stuff, part 2.Tor Andersson
2012-02-11Purge unused and bit rotted fz_accelerate stuff.Tor Andersson