summaryrefslogtreecommitdiff
path: root/src/cairo-path-fill.c
AgeCommit message (Collapse)AuthorFilesLines
2011-09-30fill: Fix unantialiased rectilinear-fill-to-boxesChris Wilson1-5/+11
We were calling the antialias close function from the unantialiased paths - a function that operates on a completely different structure to the one passed in. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12Introduce a new compositor architectureChris Wilson1-21/+48
Having spent the last dev cycle looking at how we could specialize the compositors for various backends, we once again look for the commonalities in order to reduce the duplication. In part this is motivated by the idea that spans is a good interface for both the existent GL backend and pixman, and so they deserve a dedicated compositor. xcb/xlib target an identical rendering system and so they should be using the same compositor, and it should be possible to run that same compositor locally against pixman to generate reference tests. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> P.S. This brings massive upheaval (read breakage) I've tried delaying in order to fix as many things as possible but now this one patch does far, far, far too much. Apologies in advance for breaking your favourite backend, but trust me in that the end result will be much better. :)
2011-08-13stroke: Rely on the tessellator to remove self-intersectionsChris Wilson1-245/+0
As handling joins/caps between line segments shorter than half_line_width is tricky. Rather than also fixing the bug in traps, remove that code. The plan is to avoiding hitting the traps code, short-circuiting several steps along the fast rectangular paths. Fixes line-width-overlap. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19clip: Rudimentary support for clip-polygon extractionChris Wilson1-5/+107
Step 1, fix the failings sighted recently by tracking clip-boxes as an explicit property of the clipping and of composition. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2010-12-10polygon: Merge _cairo_polygon_init and _cairo_polygon_limitAndrea Canciani1-10/+6
_cairo_polygon_limit() had to be called immediately after _cairo_polygon_init() (or never at all). Merging the two calls is a simple way to enforce this rule.
2010-12-10fill: Simplify path to polygon conversionAndrea Canciani1-50/+41
Using _cairo_path_fixed_interpret_flat() greatly simplifies the path to polygon conversion (because it already converts curve_to's to line_to's). This commit also removes the optimization which merges two consecutive lines if they have the same slope, because it's unlikely (since it should already happen during path construction), it doesn't provide better performance (at least not measurable with the currently available cairo-traces) and bloats the code.
2010-12-10path: Always interpret in forward directionAndrea Canciani1-1/+0
Path are always interpreted in forward direction, so the ability of interpreting in the opposite direction (which is very unlikely to be useful at all) can be removed.
2010-10-29path: Do not access flags directlyAndrea Canciani1-4/+4
Use inline accessors to hide the flags in the code. This ensures that flags that need additional computations (example: is_rectilinear for the fill case) are always used correctly.
2010-05-10region: _cairo_region_create_in_error()Chris Wilson1-5/+2
Avoid leaks when reporting memfault associated with constructing regions.
2010-04-27Update FSF addressAndrea Canciani1-1/+1
I updated the Free Software Foundation address using the following script. for i in $(git grep Temple | cut -d: -f1 ) do sed -e 's/59 Temple Place[, -]* Suite 330, Boston, MA *02111-1307[, ]* USA/51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA/' -i "$i" done Fixes http://bugs.freedesktop.org/show_bug.cgi?id=21356
2010-01-22fill: Convert rectilinear paths to boxes.Chris Wilson1-1/+75
A quick and efficient method for extracting the set of boxes that represent the path when filled.
2010-01-22Move _cairo_error() to a standalone headerChris Wilson1-0/+1
A pending commit will want to include some utility code from cairo and so we need to extricate the error handling from the PLT symbol hiding.
2009-10-18[path] Fix compiler warningsBenjamin Otte1-4/+3
2009-08-29[path] Return the canonical box.Chris Wilson1-32/+0
When returning the single box that represents a path, always return it consistently wound.
2009-08-29[clip] Use the rectangular tessellator to extract boxesChris Wilson1-7/+22
2009-08-29[tessellate] Rectangular special caseChris Wilson1-26/+14
Add an even simpler sweep-line tessellator for rectangular trapezoids (as produced by the rectilinear stoker and box filler). This is so simple it even outperforms pixman's region validation code for the purposes of path-to-region conversion.
2009-08-29[fill] Use trivial rectilinear_to_trapsChris Wilson1-0/+74
Avoid a small amount of unnecessary overhead by performing a simple conversion of the path to traps when it consists solely of simple boxes.
2009-08-29[polygon] Return status from path opsChris Wilson1-22/+4
This tidies the common case which was to call, for example, _cairo_polygon_line_to(); _cairo_polygon_status();
2009-08-29[clip] Use geometric clipping for unaligned clipsChris Wilson1-5/+3
For the simple cases where the clip is an unaligned box (or boxes), apply the clip directly to the geometry and avoid having to use an intermediate clip-mask.
2009-08-29[fill] Early check for empty path/polygonChris Wilson1-1/+4
2009-08-29[clip] Eliminate redundant clipsChris Wilson1-0/+3
First perform a simple geometric clip to catch the majority of cases where an unaligned clip has been set outside the operation extents that can be discarded without having to use an image surface. This causes a dramatic increase of over 13x for the poppler-bug-12266 trace and little impact elsewhere for more sensible clippers.
2009-08-29[clip] Use the rectilinear tessellatorChris Wilson1-15/+64
We can ensure that we always produce a clip region when possible by using the rectilinear tessellator to convert complex, device-aligned polygons to regions. Prior to using the tessellator, we relied on pixman's region code which could only handle a union of rectangles.
2009-08-29[tessellator] Special case rectilinear tessellationChris Wilson1-91/+9
For the frequent cases where we know in advance that we are dealing with a rectilinear path, but can not use the simple region code, implement a variant of the Bentley-Ottmann tessellator. The advantages here are that edge comparison is very simple (we only have vertical edges) and there are no intersection, though possible overlaps. The idea is the same, maintain a y-x sorted queue of start/stop events that demarcate traps and sweep through the active edges at each event, looking for completed traps. The motivation for this was noticing a performance regression in box-fill-outline with the self-intersection work: 1.9.2 to HEAD^: 3.66x slowdown HEAD^ to HEAD: 5.38x speedup 1.9.2 to HEAD: 1.57x speedup The cause of which was choosing to use spans instead of the region handling code, as the complex polygon was no longer being tessellated.
2009-08-29[fallback] Avoid going through traps for trivial regions.Chris Wilson1-0/+129
2009-08-29Eliminate self-intersecting strokes.Chris Wilson1-53/+56
We refactor the surface fallbacks to convert full strokes and fills to the intermediate polygon representation (as opposed to before where we returned the trapezoidal representation). This allow greater flexibility to choose how then to rasterize the polygon. Where possible we use the local spans rasteriser for its increased performance, but still have the option to use the tessellator instead (for example, with the current Render protocol which does not yet have a polygon image). In order to accommodate this, the spans interface is tweaked to accept whole polygons instead of a path and the tessellator is tweaked for speed. Performance Impact ================== ... Still measuring, expecting some severe regressions. ...
2009-07-23Remove clip handling from generic surface layer.Chris Wilson1-3/+8
Handling clip as part of the surface state, as opposed to being part of the operation state, is cumbersome and a hindrance to providing true proxy surface support. For example, the clip must be copied from the surface onto the fallback image, but this was forgotten causing undue hassle in each backend. Another example is the contortion the meta surface endures to ensure the clip is correctly recorded. By contrast passing the clip along with the operation is quite simple and enables us to write generic handlers for providing surface wrappers. (And in the future, we should be able to write more esoteric wrappers, e.g. automatic 2x FSAA, trivially.) In brief, instead of the surface automatically applying the clip before calling the backend, the backend can call into a generic helper to apply clipping. For raster surfaces, clip regions are handled automatically as part of the composite interface. For vector surfaces, a clip helper is introduced to replay and callback into an intersect_clip_path() function as necessary. Whilst this is not primarily a performance related change (the change should just move the computation of the clip from the moment it is applied by the user to the moment it is required by the backend), it is important to track any potential regression: ppc: Speedups ======== image-rgba evolution-20090607-0 1026085.22 0.18% -> 672972.07 0.77%: 1.52x speedup ▌ image-rgba evolution-20090618-0 680579.98 0.12% -> 573237.66 0.16%: 1.19x speedup ▎ image-rgba swfdec-fill-rate-4xaa-0 460296.92 0.36% -> 407464.63 0.42%: 1.13x speedup ▏ image-rgba swfdec-fill-rate-2xaa-0 128431.95 0.47% -> 115051.86 0.42%: 1.12x speedup ▏ Slowdowns ========= image-rgba firefox-periodic-table-0 56837.61 0.78% -> 66055.17 3.20%: 1.09x slowdown ▏
2008-12-12[path] Mark points as const during _cairo_path_fixed_interpret()Chris Wilson1-26/+7
Use const to document the read-only nature of the arguments passed to the callbacks.
2008-12-12[spline] Propagate errors during add point.Chris Wilson1-8/+3
Yikes! The callback could fail so we need to propagate the error status.
2008-11-29Mark if(status) as being unlikely.Chris Wilson1-3/+3
The error paths should be hit very rarely during normal operation, so mark them as being unlikely so gcc may emit better code.
2008-11-29[fill] Allow rectangles to be implicitly closed.Chris Wilson1-1/+1
Also scan for appendages of simple rectangles.
2008-11-25[fill] Emit rectangles for GdkRegionChris Wilson1-17/+68
Scan the path for a series of consistently wound rectangles.
2008-11-16[spline] Eliminate intermediate allocations during spline decomposition.Chris Wilson1-15/+8
The spline decomposition code allocates and stores points in a temporary buffer which is immediately consumed by the caller. If the caller supplies a callback that handles each point computed along the spline, then we can use the point immediately and avoid the allocation.
2008-09-23[fill] Check for the most common rectilinear case first.Chris Wilson1-7/+11
Avoid the iterative search for the extreme points by first checking the most likely arrangement (as produced by cairo_rectangle() under no transformation).
2008-09-19[fill] Construct trap using rectangle directly.Chris Wilson1-2/+14
Avoid the overhead in sorting the edges within _cairo_traps_tessellate_convex_quad() by using our prior knowledge that we have a simple rectangle and construct the trap from the extreme points.
2008-02-25[quartz] Optimize path handling where possibleVladimir Vukicevic1-64/+2
2008-01-28[doc] Make sure all macro names in docs are prefixed by %Behdad Esfahbod1-1/+1
2007-11-05[cairo-path-fixed] Exponentially enlarge cairo_path_buf_t.Chris Wilson1-1/+1
Allocate subsequent path bufs twice as large as the previous buf, whilst still embedding a small initial buf into cairo_path_fixed_t that handles the most frequent usage.
2007-04-10Add a status field to cairo_polygon_tCarl Worth1-25/+11
Now, the functions to add new data to a polygon all become void, and there's a new _cairo_polygon_status call to query the status at the end of a sequence of operations. With this change, we fix many callerswhich were previously not checking the return values of _cairo_polygon functions by adding only a single call to _cairo_polygon_status rathern than several new checks.
2007-04-09cairo-path-fill - trivial missing unused resultChris Wilson1-1/+1
Actually assign the result that is tested on the next line...
2007-03-13[cairo-path-fixed] Merge op and arg bufsBehdad Esfahbod1-26/+25
This means, we have to malloc only one buffer, not two. Worst case is that one always draws curves, which fills the arg (point) buffer six times faster than op buffer. But that's not a big deal since each op takes 1 byte, while each point takes 8 bytes. So op space is cheap to spare, so to speak (about 10% memory waste at worst).
2007-03-05Optimize filling of a path that is a single device-axis-aligned rectangle.Carl Worth1-0/+93
It turns out that this case is extremely common and worth avoiding the overhead of the path iteration and tessellation code. The optimization here works only for device-axis-aligned rectangles It should be possible to generalize this to catch more cases, (such as any convex quadrilateral with 4 or fewer points). This fix results in a 1.4-1.8x speedup for the rectangles perf case: image-rgb rectangles-512 7.80 1.22% -> 4.35 1.62%: 1.79x speedup ▊ image-rgba rectangles-512 7.71 4.77% -> 4.37 0.30%: 1.77x speedup ▊ xlib-rgba rectangles-512 8.78 5.02% -> 5.58 5.54%: 1.57x speedup ▋ xlib-rgb rectangles-512 11.87 2.71% -> 8.75 0.08%: 1.36x speedup ▍ Which conveniently overcomes the ~ 1.3x slowdown we had been seeing for this case since 1.2. Now, compared to 1.2.6 we see only a speedup: image-rgba rectangles-512 6.19 0.29% -> 4.37 0.30%: 1.42x speedup ▎ image-rgb rectangles-512 6.12 1.68% -> 4.35 1.62%: 1.41x speedup ▎ xlib-rgba rectangles-512 7.48 1.07% -> 5.58 5.54%: 1.34x speedup ▏ xlib-rgb rectangles-512 10.35 1.03% -> 8.75 0.08%: 1.18x speedup ▏
2006-11-22Switch from old tessellator to new tessellatorCarl Worth1-3/+3
2006-06-06Remove initial, final, and duplicate blank lines.Carl Worth1-1/+0
This patch was produced by running git-stripspace on all *.[ch] files within cairo. Note that this script would have also created all the changes from the previous commits to remove trailing whitespace.
2006-06-06Remove extraneous whitespace from "blank" lines.Carl Worth1-1/+1
This patch was produced with the following (GNU) sed script: sed -i -r -e 's/^[ \t]+$//' run on all *.[ch] files within cairo.
2005-08-04New files. Move code for manipulating cairo_clip_t out into cairo_clip_* ↵Kristian Høgsberg1-11/+9
functions and put them in cairo-clip.c. Rewrite to use new cairo_clip_t functions for manipulating the clip state, change the clip_and_composite_trapezoids call tree to use cairo_clip_t instead of cairo_gstate_t. Use new cairo_clip_t function to maintain clip state while replaying. Pass fill rule and tolerance directly, to break gstate dependency. New function. Set the clip for a surface as specified by the cairo_clip_t. Move translate_traps() from cairo-gstate.c to here and rename it. Reviewed by: otaylor
2005-03-23Remove unneeded includes of cairo-path-fixed-private.h.Carl Worth1-1/+0
Fix indentation.
2005-03-23Rename cairo_path_real_t to cairo_path_fixed_t and fix all _cairo_path ↵Carl Worth1-10/+10
functions to be named as _cairo_path_fixed functions. Track name change of cairo_path_real_t and _cairo_path_fixed functions.
2005-03-23Begin the process of breaking up cairoint.h, moving structure definitions of ↵Carl Worth1-0/+3
cairo_t, cairo_gstate_t, and cairo_path_real_t into their own header files. Track changes to header files, reaching into the new private headers where necessary.
2005-03-18* src/cairo.c: (cairo_copy_path), (cairo_copy_path_flat), ↵Carl Worth1-1/+3
(cairo_append_path): Rename cairo_copy_path_data, cairop_copy_path_data_flat, and cairo_append_path_data to cairo_copy_path, cairo_copy_path_flat, and cairo_append_path. Add new cairo_path_t, containing a cairo_path_data_t array and an explicit length. Remove CAIRO_PATH_END_PATH terminator from cairo_path_data_t. Rename the internal path object from cairo_path_t to cairo_path_real_t.
2005-02-22Switch from broken cworth@isi.edu address to canonical cworth@cworth.org ↵Carl Worth1-1/+1
address.