summaryrefslogtreecommitdiff
path: root/xps
AgeCommit message (Collapse)Author
2013-05-29Rename some find/lookup functions to be in line with documentation.Tor Andersson
2013-05-29Silence warnings.Tor Andersson
2013-05-16Add colorspace context.Tor Andersson
To prepare for color management, we have to make the device colorspaces per-context and able to be overridden by users.
2013-05-10Update fz_bound_{text,path} functions.Robin Watts
Pass stroke state into fz_bound_text to allow for stroked text. Simplifies some calling code. Add consts to clarify the meanings of the calls.
2013-05-06Fix formatting.Tor Andersson
2013-05-03Simple Image file format recogniserRobin Watts
Now can open jpeg/png/tiff files within mupdf.
2013-04-11Move pdf_image to fz_image.Robin Watts
In order to be able to output images (either in the pdfwrite device or in the html conversion), we need to be able to get to the original compressed data stream (or else we're going to end up recompressing images). To do that, we need to expose all of the contents of pdf_image into fz_image, so it makes sense to just amalgamate the two. This has knock on effects for the creation of indexed colorspaces, requiring some of that logic to be moved. Also, we need to make xps use the same structures; this means pushing PNG and TIFF support into the decoding code. Also we need to be able to load just the headers from PNG/TIFF/JPEGs as xps doesn't include dimension/resolution information. Also, separate out all the fz_image stuff into fitz/res_image.c rather than having it in res_pixmap.
2013-03-20Silence warnings.Tor Andersson
2013-02-20Bug 693639: Avoid heap overflow and leaks in error cases.Robin Watts
Avoid heap overflow in the error case in fz_end_tile. Avoid leaking all previously loaded annotations from pdf_load_annots if pdf_is_dict throws an exception. Various whitespace fixes. Many thanks to zeniko.
2013-02-20Bug 693639: allow OpenXPS extension and XML namespaces.Tor Andersson
Thanks to zeniko.
2013-02-20Bug 693639: plug various memory leaks.Tor Andersson
Thanks to zeniko. Also ensure that pdf_free_annot copes with NULL.
2013-02-06Change to pass structures by reference rather than value.Robin Watts
This is faster on ARM in particular. The primary changes involve fz_matrix, fz_rect and fz_bbox. Rather than passing 'fz_rect r' into a function, we now consistently pass 'const fz_rect *r'. Where a rect is passed in and modified, we miss the 'const' off. Where possible, we return the pointer to the modified structure to allow 'chaining' of expressions. The basic upshot of this work is that we do far fewer copies of rectangle/matrix structures, and all the copies we do are explicit. This has opened the way to other optimisations, also performed in this commit. Rather than using expressions like: fz_concat(fz_scale(sx, sy), fz_translate(tx, ty)) we now have fz_pre_{scale,translate,rotate} functions. These can be implemented much more efficiently than doing the fully fledged matrix multiplication that fz_concat requires. We add fz_rect_{min,max} functions to return pointers to the min/max points of a rect. These can be used to in transformations to directly manipulate values. With a little casting in the path transformation code we can avoid more needless copying. We rename fz_widget_bbox to the more consistent fz_bound_widget.
2013-01-30Pass content/clip bbox to device functions by value.Tor Andersson
2013-01-23Bug 693520: Fix rendering of non-orthogonal gradients.Robin Watts
Jarkko Poyry(*) points out that gradients are incorrectly rendered when they aren't axis aligned. This review fixes it here using a patch inspired by both his and zenikos patch. Thanks guys. Further thanks to zeniko for spotting that it applies to the XPS code too and providing a patch. * Apologies for the lack of the accent - my editor/git gives problems with them in commit messages.
2013-01-11Bug 693519: Replace char * with const char * in open document.Robin Watts
Simple patch to replace const char * with char *. I made the patch myself, but I suspect it's extremely close to the one submitted by Evgeniy A Dushistov, who reported the bug - many thanks!
2012-12-13Bug 693290: Avoid potential infinite loop in xps path parsing.Robin Watts
Another patch from zeniko; if we read an unknown cmd while parsing a path string, ensure that we skip over any subsequent numbers to avoid going into an infinite loop.
2012-12-13Bug 693290: Potential NULL deref in xpsRobin Watts
Another fix from zeniko. Thanks again.
2012-11-30Bug 693290: Various fixes found from fuzzing.Robin Watts
Thanks to zeniko for finding various problems and submitting a patch that fixes them. This commit covers the simpler issues from his patch; other commits will follow shortly. * Out of range LZW codes. * Buffer overflows and error handling in image_jpeg.c * Buffer overflows in tiff handling * buffer overflows in cmap parsing. * Potential double free in font handling. * Buffer overflow in pdf_form.c * use of uninitialised value in error case in pdf_image.c * NULL pointer dereference in xps_outline.c
2012-11-29Bug 693463: Fix various memory leaks.Robin Watts
All these leaks were spotted by zeniko, so credit/thanks to him.
2012-11-26Move XML parser into fitz directory.Tor Andersson
2012-11-26xps: Move XML parser into fitz namespace.Tor Andersson
2012-11-26xps: Fix potential off-by-one buffer overwrite in XML parser.Tor Andersson
2012-11-26xps: Save text content in XML nodes.Tor Andersson
New accessor xml_text() will return NULL or text content of a node. Tag names for text nodes is the empty string "". Fix bug 692191.
2012-11-20Obsess about whitespace.Tor Andersson
2012-10-25Support separate rendering of the main page contents and the annotationsPaul Gardiner
2012-10-01Move to consistently refer to "Linear" shadings rather than "Axial" ones.Robin Watts
Thanks to Sebras for pointing out our schitzophrenia here.
2012-10-01Bug 693330: Change shadings to decompose to meshes at render time.Robin Watts
Currently, the mupdf code loads shadings at parse time, and instantly decomposes them into a mesh of triangles. This mesh of triangles is the transformed and rendered as required. Unfortunately the storage space for the mesh is typically much greater than the original representation. In this commit, we move the shading stream parsing/decomposition code into a general 'fz_process_mesh' function within res_shade. We then grab a copy of the buffer at load time, and 'process' (decompose/paint) at render time. For the test file on the bug, memory falls from the reported 660Mb to 30Mb. For another test file (txt9780547775815_ingested.pdf page 271) it reduces memory use from 750Meg to 33Meg. These figures could be further reduced by storing the compressed streams from the pdf file rather than the uncompressed ones. Incorporating typo fix and unused function removal from Sebras. Thanks. Remove unused function in shading code
2012-09-04Merge branch 'master' into formsPaul Gardiner
Conflicts: pdf/pdf_xref_aux.c
2012-08-28Add fz_open_document_with_stream function.Tor Andersson
Use a "magic" string for filetype detection: filename or mime-type.
2012-08-23Silence some warnings.Robin Watts
Mountian Lion causes various different warnings to be given, possibly because a change to clang by default. Fix them here.
2012-08-08Merge branch 'master' into formsPaul Gardiner
Conflicts: Makefile apps/mudraw.c pdf/pdf_write.c win32/libmupdf-v8.vcproj
2012-08-06Check whether font in xps has charmap before using itSebastian Rasmussen
Thanks to Zeniko for pointing out this fix.
2012-08-06Make use of fz_always instead of repeating code for error and normal pathSebastian Rasmussen
2012-08-01Merge branch 'master' into formsPaul Gardiner
Conflicts: pdf/mupdf-internal.h pdf/pdf_font.c
2012-07-20Pass original font name to fz_new_font from PDF interpreter.Tor Andersson
Improves text device output when using substitute fonts. Fixes bug #693019.
2012-07-17Handle glyphs that are too large to render as pixmaps.Tor Andersson
2012-07-09Make synthetic font styles match XPS spec more closely.Tor Andersson
Shear by 20 degrees for italic. Use 2% wider metrics for bold.
2012-07-05Merge branch 'master' into formsRobin Watts
2012-07-05Move to static inline functions from macros.Robin Watts
Instead of using macros for min/max/abs/clamp, we move to using inline functions. These are more typesafe, and should produce equivalent code on compilers that support inline (i.e. pretty much everything we care about these days). People can always do their own macro versions if they prefer.
2012-06-20Reduce amount of boiler plate by casting function pointers to void*.Tor Andersson
Remove the shim indirection layer for fz_document. A little less type safe, but a lot less boiler plate.
2012-05-08Switch to reading content streams on the fly during interpretation.Robin Watts
Previously, before interpreting a pages content stream we would load it entirely into a buffer. Then we would interpret that buffer. This has a cost in memory use. Here, we update the code to read from a stream on the fly. This has required changes in various different parts of the code. Firstly, we have removed all use of the FILE lock - as stream reads can now safely be interrupted by resource (or object) reads from elsewhere in the file, the file lock becomes a very hard thing to maintain, and doesn't actually benefit us at all. The choices were to either use a recursive lock, or to remove it entirely; I opted for the latter. The file lock enum value remains as a placeholder for future use in extendable data streams. Secondly, we add a new 'concat' filter that concatenates a series of streams together into one, optionally putting whitespace between each stream (as the pdf parser requires this). Finally, we change page/xobject/pattern content streams to work on the fly, but we leave type3 glyphs using buffers (as presumably these will be run repeatedly).
2012-04-17Add Meta interface to fz_document.Robin Watts
Use this to reintroduce "Document Properties..." in mupdf viewer.
2012-03-28Fix access of recently freed memory.Tor Andersson
2012-03-28Whitespace fixes.Tor Andersson
2012-03-14Bug 692917: Move to dynamic stroke_states.Robin Watts
Move fz_stroke_state from being a simple structure whose contents are copied repeatedly to being a dynamically allocated reference counted object so we can cope with large numbers of entries in the dash array.
2012-03-14Combine Opacity attribute with alpha from #RGBA specified colors.Tor Andersson
2012-03-14Parse path geometry for separate filling and stroking.Tor Andersson
If a path is both stroked and filled, we need to treat IsStroking during parsing differently, so we should create two separate paths for filling and stroking. Thanks to SumatraPDF for the patch.
2012-03-14Support alternate content / markup compatibility tags in XPS.Tor Andersson
2012-03-14Implement Repeat and Reflect gradients in XPS.Tor Andersson
Thanks to SumatraPDF for the patch.
2012-03-14Support StyleSimulation for fonts in XPS.Tor Andersson