summaryrefslogtreecommitdiff
path: root/draw/draw_edge.c
AgeCommit message (Collapse)Author
2013-06-20Rearrange source files.Tor Andersson
2013-06-19Exception handling changesRobin Watts
In preparation for work on progressive loading, update the exception handling scheme slightly. Until now, exceptions (as thrown with fz_throw, and caught with fz_try/fz_catch) have merely had an informative string. They have never had anything that can be compared to see if an error is of a particular type. We now introduce error codes; when we fz_throw, we now always give an error code, and can optionally (using fz_throw_message) give both an error code and an informative string. When we fz_rethrow from within a fz_catch, both the error code and the error message is maintained. Using fz_rethrow_message we can 'improve' the error message, but the code is maintained. The error message can be read out using fz_caught_message() and the error code can be read as fz_caught(). Currently we only define a 'generic' error. This will expand in future versions to include other error types that may be tested for.
2013-06-18Split fitz.h into subheaders.Tor Andersson
2013-06-18Merge common and internal headers into one.Tor Andersson
2013-06-18Move header files into separate include directory.Tor Andersson
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-01-30Rename fz_irect back to fz_bbox.Tor Andersson
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-30Eliminate fz_bbox in favor of fz_rect everywhere.Tor Andersson
2013-01-11Bug 693534: 0 bits of antialiasing brokenRobin Watts
When I optimised sharp edge rendering back in commit 720859d, I made a mistake that can result in broken renderings. Fixed here. Thanks for Dan Waleke for reporting this.
2012-12-12Fix whitespace.Robin Watts
Thanks to zeniko for the heads up.
2012-12-08Optimise sharp scan conversion as we did with aa scan conversion.Robin Watts
In doing this work, it strikes me that there is an unoptimised case left in the aa scan conversion; when we are plotting whole scanlines with gel->alen = 0, we can skip the entire blit. This happens relatively rarely so the extra cost of the test may be more than is worthwhile.
2012-11-27Update scan converter to cope better with rectangular paths.Robin Watts
Currently the scan converter advances one 'subpixel' scanline at a time; here we update it to work in multiple subpixel scanlines at a time. If we spot that the gel consists of entirely vertical edges, then we calculate the height for which those edges will remain unchanged. This allows us to deal quickly with rectangular paths. In the case of large vertical only edges, we can process multiple scanlines (not just subpixel scanlines) at once.
2012-07-18Fix missing diagram in 1522*.pdfRobin Watts
Since the commit to replace abs/min/max/clamp with inline versions, "1522 - diagramm missing above 88 pc zoom.pdf" has been missing a diagram. This is because the diagram contains sections like: -2147483648 -2147483648 m -2147483648 2147483647 l 2147483647 2147483647 l 2147483647 -2147483648 l These extreme values, when transformed would give floating point values that when naively cast down to int, flip sign (e.g. extreme positive when cast to int becomes extreme negative). I had been relying on the cast down giving sane results to enable me to use fz_clampi. Revert to using fz_clamp and all is fine.
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-11Fix Bug 693102: Overflows in large pixmap indexing.Robin Watts
When we allocate a pixmap > 2G, but < 4G, the index into that pixmap, when calculated as an int can be negative. Fix this with various casts to unsigned int. If we ever move to support >4G images we'll need to rejig the casting to cast each part of the element to ptrdiff_t first.
2012-04-05Fix potential problems on malloc failure.Robin Watts
Don't reset the size of arrays until we have successfully resized them.
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-13Fix Bug 692915: fz_copy_aa_context was broken.Robin Watts
Code was copying the wrong structure. Thanks to Pedro Rivera for pointing this out.
2012-03-12More API tidying.Robin Watts
Make fz_clone_context copy existing AA settings. Add accessor function for fz_bitmap. Add more documentation for various functions/types.
2012-03-06Split fitz.h/mupdf.h into internal/external headers.Robin Watts
Attempt to separate public API from internal functions.
2012-01-10Fix many spelling errors.Sebastian Rasmussen
2012-01-06Various fixes to avoid arithmetic problems.Robin Watts
Various fixes to avoid overflow problems, division by zeros, use of uninitialised variables etc. All from/suggested by Zenikos patch.
2011-12-17More Memory Squeezing fixes.Robin Watts
2011-12-16Add fz_malloc_struct, and make code use it.Robin Watts
The new fz_malloc_struct(A,B) macro allocates sizeof(B) bytes using fz_malloc, and then passes the resultant pointer to Memento_label to label it with "B". This costs nothing in non-memento builds, but gives much nicer listings of leaked blocks when memento is enabled.
2011-12-06Move antialias levels into context.Robin Watts
In builds that support configurable layers of antialiasing, move the variables that control this into the context. This makes it possible to safely use different levels of antialiasing in different threads.
2011-09-21Add warning context.Tor Andersson
2011-09-21Rename malloc functions for arrays (fz_calloc and fz_realloc).Tor Andersson
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-10Fix segfault inducing typo in non-aa scanconverter.Tor Andersson
2011-04-10Make global edge list struct opaque, and remove active edge list struct.Tor Andersson
2011-04-08draw_edge.c: Plug memory leak.Tor Andersson
2011-04-08Remove inline keyword where it is not strictly necessary for performance.Tor Andersson
Also put the function on the same line for inline functions, so they stick out and are easy to find with grep.
2011-04-08Add special case non-aa scan converter with accompanying blit functions.Tor Andersson
Also turn on font hinting when rendering non-aa text.
2011-04-07Add AA_BITS define to control antialias level of line art.Robin Watts
AA_BITS < 0 => Runtime configurable. AA_BITS = 0 => No antialiasing AA_BITS > 0 => At least that many bits of accuracy (to a max of 8). If unspecified, default is 8, so old behaviour is maintained.
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-04-04draw: Rename files in draw directory.Tor Andersson