summaryrefslogtreecommitdiff
path: root/fitz
AgeCommit message (Collapse)Author
2013-03-25Avoid store collisions causing unnecessary evictions.Robin Watts
When storing tiling bitmaps from the draw_device to the store, we frequently hit the case where we insert tile records that are already there. (This also happens in other cases, such as an image being decoded simultaneously on 2 different threads, but more rarely). In such cases, the existing code attempts to evict store contents to bring the size down enough to fit the new object in, only to find that it needn't have. This patch attempts to fix that behaviour. The only way we know if an equivalent entry is in place already is to try to place the new one; we therefore do this earlier in the store function. If this encaching succeeds (no equivalent entry already exists) we are safe to evict as required. Should the eviction be incapable of removing enough from the store to make it fit, we now need to remove the entry we just added to the hash table. To avoid doing a full (and potentially expensive linear probe), we amend the hash table functions slightly. Firstly, we add a new function fz_hash_insert_with_pos that does the insert, but returns the position within the hashtable that the entry was inserted. Secondly, we then add a new fz_hash_remove_fast function that takes this position as an entry. The 'fast' removal function checks to see whether the entry is still correct (it always should be unless we have been very unlucky with a table rebuild, or another hashtable operation happening at the same time) and can quickly remove the entry. If lightning has struck, it works the old (slower) way.
2013-03-25Ensure that store bookkeeping doesn't go wrong on reinsertion.Robin Watts
If we find that the store already contains a copy of an object, then we don't reinsert it. We should therefore undo the addition of the object size that we just did.
2013-03-25Support creation of Ink annotations in MuPDF libraryPaul Gardiner
2013-03-22Bug 693708: Fix unclosed XML entry in fz_trace output.Robin Watts
Thanks to Brian Nixon for pointing this out.
2013-03-22Squash some warnings.Robin Watts
Some -Wshadow ones, plus some 'set but not used' ones.
2013-03-22Fix store debugging fns so that all output goes to the same file.Robin Watts
2013-03-21Add 'void' to a function declaration.Robin Watts
2013-03-21Bug 693708: Avoid dereferencing null pointer.Robin Watts
Ensure pointer is non NULL before dereferencing.
2013-03-21Simple debug code to quantify locking timesRobin Watts
2013-03-20Add caching of rendered tiles.Robin Watts
This requires a slight change to the device interface. Callers that use fz_begin_tile will see no change (and no caching will be done). We add a new fz_begin_tile_id function that takes an extra 'id' parameter, and returns 0 or 1. If the id is 0 then the function behaves exactly as fz_being_tile does, and always returns 0. The PDF and XPS code continues to call the old (uncached) version. The display list code however generates a unique id for every BEGIN_TILE node, and passes this in. If the id is non zero, then it is taken to be a unique identifier for this tile; the implementer of the fz_begin_tile_id entry point can choose to use this to implement caching. If it chooses to ignore the id (and do no caching), it returns 0. If the device implements caching, then it can check on entry for a previously rendered tile with the appropriate matrix and a matching id. If it finds one, then it returns 1. It is the callers responsibility to then skip over all the device calls that would usually happen to render the tiles (i.e. to skip forward to the matching 'END_TILE' operation).
2013-03-20Fix invalid font bboxesRobin Watts
The font bbox is wrong in some fonts, so any calculations we base on that will be wrong; in particular this affects fz_bound_glyph. We now spot an illegal bbox, and use a 'large' default.
2013-03-20Add noreturn attribute to throw/rethrow to help improve compiler warnings.Tor Andersson
2013-03-18Auto-generate appearance streams for strikeout, underline, highlightPaul Gardiner
This fixes bug #693664, and also simplifies app code. The example file attached to the bug produces strange results, but that is because the QuadPoint information is incorrect.
2013-03-01Bug 693624: Ensure that windows copes with utf8 filenamesRobin Watts
When running under Windows, replace fopen with our own fopen_utf8 that converts from utf8 to unicode before calling the unicode version of fopen.
2013-02-28Pass bbox to pdf_set_annot_appearance rather than base on display listPaul Gardiner
Use of the bbox device to derive the area of the display list can lead to bad results because of heuristics used to handle corners of stroked paths.
2013-02-28Force colorspaces to match with JPX images.Robin Watts
If the colorspace given in the dictionary of a JPX image differs from the colorspace given in the image itself, decode to the native image format, then convert. This goes a long way towards fixing "1439 - color softmask fails to draw jpx image.pdf" (aka hivemind.pdf). The lack of transfer function support hopefully explains the rest.
2013-02-26Include required quadPoints entry in created markup annotations.Paul Gardiner
Also change the way we pass the text rectangles so that non-axis-aligned ones can be permitted, and relocate the code that calculates the strike-out lines from the bounding boxes
2013-02-26Implement annotation deletion, with necessary changes to partial updatePaul Gardiner
2013-02-22Add fz_get_annot_typePaul Gardiner
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: fix UTF-8 BOM detection.Tor Andersson
A UTF-8 BOM followed by a UTF-16 BOM would treat the data as UTF-16 rather than UTF-8. Clean up the BOM detection logic. Thanks to zeniko.
2013-02-20Bug 693639: treat NULL scissor in display list as infinite rect.Tor Andersson
Thanks to zeniko.
2013-02-20Bug 693639: fix overflow due to wrong type of intermediate variable.Tor Andersson
Thanks to zeniko.
2013-02-20Bug 693639: allow OpenXPS extension and XML namespaces.Tor Andersson
Thanks to zeniko.
2013-02-20Bug 693639: fix warnings.Tor Andersson
Thanks to zeniko.
2013-02-20Bug 693639: bring fitz.h in line with source use of restrict keyword.Tor Andersson
Thanks to zeniko.
2013-02-19Bug 693639: fix integer overflow in image_tiff.cTor Andersson
Thanks to zeniko.
2013-02-19Bug 693639: don't take references on global (static) resource objects.Tor Andersson
Thanks to zeniko.
2013-02-19Bug 693639: fix incomplete error handling in null device.Tor Andersson
Thanks to zeniko.
2013-02-19Bug 693639: fix potential NULL pointer dereference in base_context.cTor Andersson
Thanks to zeniko.
2013-02-19Fix whitespace.Tor Andersson
2013-02-13Bump version number strings and dates for 1.2 release.Tor Andersson
2013-02-11Fix problem with text selection caused by 0399332d54Paul Gardiner
2013-02-06Rename bbox to irect.Tor Andersson
2013-02-06Add some 'restrict' qualifiers to hopefully speed matrix ops.Robin Watts
Also, move fz_is_infinite_rect and fz_is_empty_rect to be a static inline rather than a macro. (Static inlines are preferred over macros by at least one customers). We appear to be calling them with bboxes too, so add fz_is_infinite_bbox and fz_is_empty_bbox to solve this.
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-02-06Fix SEGVs seen on unix caused by the fz_output commit.Robin Watts
It seems that gcc requires arg lists to be 'va_copy'ied, otherwise they can't be reused. This solves problems in the rework of fz_buffer_printf.
2013-02-06Tweak text extraction block creation.Robin Watts
Better tolerate long horizontal spaces without breaking lines.
2013-02-05Tweak HTML output.Robin Watts
Send blocks as paragraphs, rather than lines. Send lines as spans.
2013-02-04Add fz_output, and make output functions use it.Robin Watts
Various functions in the code output to FILE *, when there are times we'd like them to output to other things, such as fz_buffers. Add an fz_output type, together with fz_printf to allow things to output to this.
2013-01-31Add support for annotation creationPaul Gardiner
2013-01-30Improve exception handling in fz_bound_t3_glyphPaul Gardiner
Also simplify some other functions using pdf_dict_puts_drop
2013-01-30Rename fz_irect back to fz_bbox.Tor Andersson
2013-01-30Always pass value structs (rect, matrix, etc) as values not by pointer.Tor Andersson
2013-01-30Rename fz_rect_covering_rect to fz_irect_from_rect.Tor Andersson
It used to be called fz_bbox_covering_rect. It does exact rounding outwards of a rect, so that the resulting irect will always cover the entire area of the input rect. Use fz_round_rect for fuzzy rounding where near-integer values are rounded inwards.
2013-01-30Introduce fz_irect where the old fz_bbox was useful.Tor Andersson
Inside the renderer we often deal with integer sized areas, for pixmaps and scissoring regions. Use a new fz_irect type in these places.
2013-01-30Pass content/clip bbox to device functions by value.Tor Andersson
2013-01-30Eliminate fz_bbox in favor of fz_rect everywhere.Tor Andersson
2013-01-25Make strdup take a const char * to silence some warnings.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.