summaryrefslogtreecommitdiff
path: root/source/fitz/draw-path.c
AgeCommit message (Collapse)Author
2017-06-13Introduce fz_rasterizer encapsulationRobin Watts
This is intended to be a way to allow us to implement compiletime/runtime selection of different scan converter implementations.
2017-05-29Make PI/RADIAN/SQRT2/LN2 global single precision float constants.Sebastian Rasmussen
2017-04-27Include required system headers.Tor Andersson
2017-04-14Scan converter; API tweak.Robin Watts
Decide whether to dash or not in the scan converter, not the draw-device.
2017-04-13Scan converter; simplify API.Robin Watts
In all cases we reset the gel before populating it, so pull this out of the draw device into the population routines.
2016-02-22Rename fz_path_processor to fz_path_walker.Tor Andersson
2016-01-13Add lots of consts.Robin Watts
In general, we should use 'const fz_blah' in device calls whenever the callee should not alter the fz_blah. Push this through. This shows up various places where we fz_keep and fz_drop these const things. I've updated the fz_keep and fz_drops with appropriate casts to remove the consts. We may need to do the union dance to avoid the consts for some compilers, but will only do that if required. I think this is nicer overall, even allowing for the const<->no const problems.
2015-09-30Ensure that dots are non-zero sized.Robin Watts
In fz_add_line_dot, if the flatness is too low, we can end up with dots being 1 dimensional. Ensure that we always use at least 3 vertexes to approximate a dot. This was inspired by (but does not fix) bug 696172.
2015-07-27Limit dash phase to length of dash pattern.Sebastian Rasmussen
Previously out of range phase values were accepted which led to overly long loops when processing moveto. This could be triggered e.g. by 2222222222222222222 [ 4 6 ] 0 d in a content stream.
2015-07-27Cosmetic rearrangement of code for drawing paths.Sebastian Rasmussen
In preparation for a bugfix concerning path phase.
2015-04-06Antidropout followup: cope with stroking too.Robin Watts
Stroke segments that are horizontal or vertical get the same antidropout treatment as filled rectangles.
2015-04-06Bug 694367: Attempt to avoid dropouts of rectangles.Robin Watts
This is not a complete general fix for features dropping out of rendered line art, but merely a fix for one of the more common cases. When rendering rectangles (currently, specifically only those rectangles that are actually defined as rectangles within the path structure), if they are axis aligned, then ensure that they always fill the subpixel line they are on.
2015-03-24Path rework for improved memory usage.Robin Watts
Firstly, we make the definition of the path structures local to path.c. This is achieved by using an fz_path_processor function to step through paths enumerating each section using callback functions. Next, we extend the internal path representation to include other section types, including quads, beziers with common control points rectangles, horizontal, vertical and degenerate lines. We also roll close path sections up into the previous sections commands. The hairiest part of this is that fz_transform_path has to cope with changing the path commands depending on the matrix. This is a relatively rare operation though.
2015-02-17Add ctx parameter and remove embedded contexts for API regularity.Tor Andersson
Purge several embedded contexts: Remove embedded context in fz_output. Remove embedded context in fz_stream. Remove embedded context in fz_device. Remove fz_rebind_stream (since it is no longer necessary). Remove embedded context in svg_device. Remove embedded context in XML parser. Add ctx argument to fz_document functions. Remove embedded context in fz_document. Remove embedded context in pdf_document. Remove embedded context in pdf_obj. Make fz_page independent of fz_document in the interface. We shouldn't need to pass the document to all functions handling a page. If a page is tied to the source document, it's redundant; otherwise it's just pointless. Fix reference counting oddity in fz_new_image_from_pixmap.
2014-08-19don't render non-empty dashing with zero-length phaseSimon Bünzli
Adobe Reader and Microsoft XPS viewer differ in their handling of non-empty dashed strokes where the phase is 0: Adobe Reader considers these to be faulty and omits them while Microsoft XPS Viewer renders them the same as an empty dash (i.e. solid). This patch makes Fitz no longer render such strokes and ensures that MuXPS never emits them so that the desired behavior results (this is the easier implementation since XPS rendering code renders stroked paths in a single location whereas PDF rendering does it all over the place). See https://code.google.com/p/sumatrapdf/issues/detail?id=2339 for a testcase.
2014-01-13Avoid rendering errors caused by linejoins on tiny distances.Robin Watts
If we perform a linejoin that ends up being over an impossibly small distance, we can get a rendering error. This is caused by trying to calculate scale = linewidth/sqrtf(len), where len < FLT_EPSILON. Avoid this by rearranging the code slightly - no extra calculations required. Also given that sn == bn at all times within the stroking code, just remove bn. Credit for spotting this problem goes to Simon for tracking the problem with rounding_artifact_due_to_closepath.pdf. My fix just fixes the problem at a lower level than his does.
2013-09-30Bug 694526: Spot non-invertable matrices and bale before strokingRobin Watts
The bug fix added in the previous commit fails to work in this case (hang-9527.pdf) because the matrix is not invertible and hence the clipping rectangle ends up infinite. Spot this case here and return early.
2013-09-30Bug 694526: Fix hang in stroking path.Robin Watts
The first file of this bug (hang-66.pdf) hangs while stroking a VERY long line segment; so long that 'used' is sufficinetly large that: used += dash_segment_len doesn't result in a change in the value of used. The fix is to clip strokes to the edge of the gel's clip area, meaning that this should never occur.
2013-09-13Fix various compile warnings spotted by the cluster.Robin Watts
2013-09-08Separate command and coordinate arrays in fz_path structure.Tor Andersson
2013-06-20Rearrange source files.Tor Andersson