summaryrefslogtreecommitdiff
path: root/fitz/res_shade.c
AgeCommit message (Collapse)Author
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-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.
2012-10-05Make shadings hold the data streams compressed.Robin Watts
This reduces memory use by another 10% on the 2 testfiles mentioned in the previous commit (see bug 693330).
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-01Handle axial and radial shadings the same way as other shadings.Sebastian Rasmussen
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-07-06Remove debugging functions for release builds.Sebastian Rasmussen
2012-03-13Make fz_print functions all take a FILE *.Robin Watts
Also tidy up the taking of fz_context *'s, and hide an unwanted indent param.
2012-03-13Rename some functions and accessors to be more consistent.Tor Andersson
Debug printing functions: debug -> print. Accessors: get noun attribute -> noun attribute. Find -> lookup when the returned value is not reference counted. pixmap_with_rect -> pixmap_with_bbox. We are reserving the word "find" to mean lookups that give ownership of objects to the caller. Lookup is used in other places where the ownership is not transferred, or simple values are returned. The rename is done by the sed script in scripts/rename3.sed
2012-03-06Split fitz.h/mupdf.h into internal/external headers.Robin Watts
Attempt to separate public API from internal functions.
2012-02-03Be consistent about passing a fz_context in path/text/shade functions.Tor Andersson
2012-01-19Multi-threading support for MuPDFRobin Watts
When we moved over to a context based system, we laid the foundation for a thread-safe mupdf. This commit should complete that process. Firstly, fz_clone_context is properly implemented so that it makes a new context, but shares certain sections (currently just the allocator, and the store). Secondly, we add locking (to parts of the code that have previously just had placeholder LOCK/UNLOCK comments). Functions to lock and unlock a mutex are added to the allocator structure; omit these (as is the case today) and no multithreading is (safely) possible. The context will refuse to clone if these are not provided. Finally we flesh out the LOCK/UNLOCK comments to be real calls of the functions - unfortunately this requires us to plumb fz_context into the fz_keep_storable function (and all the fz_keep_xxx functions that call it). This is the largest section of the patch. No changes expected to any test files.
2012-01-02Bound shades by the supplied bbox.Robin Watts
Fix a 'TODO'. When asking for the bounds of a shading, simply convert the shadings bbox and intersect with that.
2011-12-15Fix warnings/errors on unix builds.Robin Watts
Fix warnings/errors thrown up by the last few commits (which were only tested on windows).
2011-12-15Rework pdf_store to fz_store, a part of fz_context.Robin Watts
Firstly, we rename pdf_store to fz_store, reflecting the fact that there are no pdf specific dependencies on it. Next, we rework it so that all the objects that can be stored in the store start with an fz_storable structure. This consists of a reference count, and a function used to free the object when the reference count reaches zero. All the keep/drop functions are then reimplemented by calling fz_keep_sharable/fz_drop_sharable. The 'drop' functions as supplied by the callers are thus now 'free' functions, only called if the reference count drops to 0. The store changes to keep all the items in the store in the linked list (which becomes a doubly linked one). We still make use of the hashtable to index into this list quickly, but we now have the objects in an LRU ordering within the list. Every object is put into the store, with a size record; this is an estimate of how much memory would be freed by freeing that object. The store is moved into the context and given a maximum size; when new things are inserted into the store, care is taken to ensure that we do not expand beyond this size. We evict any stored items (that are not in use) starting from the least recently used. Finding an object in the store now takes a reference to it already. LOCK and UNLOCK comments are used to indicate where locks need to be taken and released to ensure thread safety.
2011-09-15Add context to mupdf.Robin Watts
Huge pervasive change to lots of files, adding a context for exception handling and allocation. In time we'll move more statics into there. Also fix some for(i = 0; i < function(...); i++) calls.
2011-04-04Le Roi est mort, vive le Roi!Tor Andersson
The run-together words are dead! Long live the underscores! The postscript inspired naming convention of using all run-together words has served us well, but it is now time for more readable code. In this commit I have also added the sed script, rename.sed, that I used to convert the source. Use it on your patches and application code.
2011-03-29Don't shorten colorspace to 'cs' in structs and other names.Tor Andersson
2010-12-29Support linear shadings as a special case in the fitz shading struct and ↵Tor Andersson
renderer.
2010-07-17Remove all trailing whitespace.Tor Andersson
2010-07-01Compute shading bounding box using the triangle mesh.Tor Andersson
2010-06-30Refactor and clean up shading code a bit.Tor Andersson
2010-06-29Reformat to remove all instances of double spaces (to easier spot ↵Tor Andersson
indentation errors in the future).
2010-05-22Rename shade to shading.Sebastian Rasmussen
2010-04-19Improved debug printing of shading to show vertex grouping into triangles.Sebastian Rasmussen
2010-04-17Fix omitted initialization in shade debug printing.Sebastian Rasmussen
2010-04-17Added function to print fitz shading objects for debugging.Sebastian Rasmussen
2010-04-11Rename functions fz_intersectirects and fz_transformaabb.Tor Andersson
2009-12-03Consolidate include lines to a single fitz.h.Tor Andersson
2009-12-02Killing time. Butchered display tree and disabled all calls to it.Tor Andersson
2009-02-28Merge and move header files into the source directories.Tor Andersson
2009-02-28Moved Fitz files into one directory.Tor Andersson
2005-06-04new world orderTor Andersson
2005-03-30rename and shuffle -- part 2Tor Andersson