summaryrefslogtreecommitdiff
path: root/src/cairo-polygon.c
AgeCommit message (Collapse)AuthorFilesLines
2011-10-12spans: Refresh polygon limits after trimming the composite extentsChris Wilson1-13/+31
Trimming the composite extents may result in the clip being reconstructed, but we the polygon continued to hold a reference into the freed clip's array of boxes. So if we intend to reuse the polygon limits after performing the clip we need to refresh them. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-09-12Introduce a new compositor architectureChris Wilson1-13/+39
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-15stroke: Convert the outlines into contour and then into a polygonChris Wilson1-13/+35
In step 1 of speeding up stroking, we introduce contours as a means for tracking the connected edges around the stroke. By keeping track of these chains, we can analyse the edges as we proceed and eliminate redundant vertices speeding up rasterisation. Coincidentally fixes line-width-tolerance (looks like a combination of using spline tangent vectors and tolerance). Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-28polygon: Fix generic case of edge clippingAndrea Canciani1-76/+51
The edge clipper is more complicated than it should be and contains a subtle bug: when an edge is almost horizontal, it is always considered as having a positive slope. Explain what should be done and do it in a simpler way. Fixes horizontal-clip.
2011-07-28polygon: Simplify code for edge clippingAndrea Canciani1-47/+33
Add some comments about what's going on and clean up the branches by sharing common computations.
2011-07-27polygon: Fix clipping of edges outside of their rangeChris Wilson1-4/+4
Uli Schlachter analysed the error behind the polygon reduction and discovered that it was due to the clipping of a line which intersects the clip box (p1, p2) but is range limited by (top, bottom) to be inside the clip box. Fixes hatching Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-27polygon: Don't skip clipped horizontal edgesChris Wilson1-3/+0
As Andrea Canciani pointed out even if it is horizontal within the clip box, it may still have vertical extents outside of the clip box for which we need to project onto the clip boundary in order to maintain the correct polygon winding. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
2011-07-19clip: Rudimentary support for clip-polygon extractionChris Wilson1-0/+111
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-11/+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-88/+0
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-06-11polygon: Reorder conditionals based on likelihood.Chris Wilson1-15/+15
The vast majority of edges will be unclipped, so process those first.
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-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-09-03[polygon] Compute the limit of the limits slightly more efficientlyChris Wilson1-12/+12
Initialize the bbox to the first limit, as frequently there will only be a single (or at least a small number) limit.
2009-09-03[polygon] Fix discard with non-banded disjoint clip boxesChris Wilson1-5/+24
The early discard checked if the line was below the last clip-box, or if above the first. However, the clip-boxes are only sorted on by the bottom (not the strict XY-banded sort of the regions) and so this was erroneously discarding lines.
2009-08-29[polygon] Return status from path opsChris Wilson1-6/+12
This tidies the common case which was to call, for example, _cairo_polygon_line_to(); _cairo_polygon_status();
2009-08-29[slope] Inline _cairo_slope_init()Chris Wilson1-0/+2
Move the definition to a separate header file and allow callers to inline the simple function.
2009-08-29[clip] Use geometric clipping for unaligned clipsChris Wilson1-147/+182
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[polygon] Amalgamate collinear edgesChris Wilson1-7/+51
Combine sequential collinear edges into a single edge, this benefits immensely by feeding fewer edges into either the tessellator or spans.
2009-08-29Eliminate self-intersecting strokes.Chris Wilson1-19/+250
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-06-04valgrindify init/fini routinesChris Wilson1-0/+4
Annotate object init/fini routines to detect use-after-free for on-stack/embedded objects.
2009-04-23[memfault] Manually inject faults when using stack allocationsChris Wilson1-0/+5
Ensure that no assumptions are made that a small allocation will succeed by manually injecting faults when we may be simply allocating from an embedded memory pool. The main advantage in manual fault injection is improved code coverage - from within the test suite most allocations are handled by the embedded memory pools.
2008-11-29Mark allocation failures as unlikely.Chris Wilson1-1/+1
Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
2008-11-16[spline] Eliminate intermediate allocations during spline decomposition.Chris Wilson1-12/+11
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-18[polygon] Reduce number of branches.Chris Wilson1-50/+21
Minimise the number of conditionals taken whilst constructing the polygon.
2008-06-13Enlarge the embedded arrays to eliminate frequent allocations.Chris Wilson1-14/+5
Enlarge the embedded arrays of edges and points for cairo_polygon_t and cairo_spline_t respectively, such that the frequent allocations are eliminated whilst running a firefox3 benchmark.
2007-10-04[cairo-error] Clean up all the warnings and missing _cairo_error() calls.Chris Wilson1-4/+2
Every time we assign or return a hard-coded error status wrap that value with a call to _cairo_error(). So the idiom becomes: status = _cairo_error (CAIRO_STATUS_NO_MEMORY); or return _cairo_error (CAIRO_STATUS_INVALID_DASH); This ensures that a breakpoint placed on _cairo_error() will trigger immediately cairo detects the error.
2007-10-04[malloc] Check for integer overflow when realloc'ing.Chris Wilson1-1/+2
Perform similar sanity checks to Vlad's _cairo_malloc_ab() but on the arguments to realloc instead.
2007-10-04[cairo-polygon] Add a _cairo_error().Chris Wilson1-0/+1
Add a _cairo_error() to an originating error site.
2007-06-29[fix] Avoid int overflow when allocating large buffersVladimir Vukicevic1-1/+1
This patch introduces three macros: _cairo_malloc_ab, _cairo_malloc_abc, _cairo_malloc_ab_plus_c and replaces various calls to malloc(a*b), malloc(a*b*c), and malloc(a*b+c) with them. The macros return NULL if int overflow would occur during the allocation. See CODING_STYLE for more information.
2007-04-10Add a status field to cairo_polygon_tCarl Worth1-27/+33
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-10Rename ARRAY_LEN to ARRAY_LENGTHCarl Worth1-1/+1
Yet another victim in my hunt against abbreviations within cairo's implementation.
2007-04-09cairo-polygon - trivial propagation of error statusChris Wilson1-5/+3
_cairo_polygon_move_to() returns an error status so use it.
2007-04-03[src] Make sure all source files #include "cairoint.h" as their first includeBehdad Esfahbod1-1/+0
This is necessary to avoid many portability problems as cairoint.h includes config.h. Without a test, we will regress again, hence add it. The inclusion idiom for cairo now is: #include "cairoint.h" #include "cairo-something.h" #include "cairo-anotherthing-private.h" #include <some-library.h> #include <other-library/other-file.h> Moreover, some standard headers files are included from cairoint.h and need not be included again.
2007-03-20Define and use ARRAY_LENBehdad Esfahbod1-1/+1
2007-03-13[polygon,spline,traps] Avoid free(NULL)Behdad Esfahbod1-1/+1
2007-03-13[cairo-polygon] Add a cache of eight edges to cairo_polygon_tBehdad Esfahbod1-7/+23
Many, if not most, of polygons have very few edges. This avoids calling malloc() for those cases.
2007-03-13[cairo_polygon_t] Change has_current_point from int to cairo_bool_tBehdad Esfahbod1-4/+4
2007-03-13[cairo-polygon] Clean-up realloc algorithm for clarityBehdad Esfahbod1-11/+7
2006-06-06Remove all remaining trailing whitespace.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. Note that the above script would have also created all the changes from the previous commits to remove trailing whitespace.
2005-02-22Switch from broken cworth@isi.edu address to canonical cworth@cworth.org ↵Carl Worth1-1/+1
address.
2004-12-23Remove unused CAIRO_TRAPS_GROWTH_INC.Carl Worth1-3/+2
Resize arrays by doubling rather than by linear increments. Add new bug exposed centi_unfinished.svg.
2004-10-21Convert all files to utf-8. Add copyright information to cairo_png_surface.c.Carl Worth1-1/+1
2004-09-04Add the MPL as a new license option, in addition to the LGPL.Carl Worth1-10/+27
2004-08-02Fix to explicitly refer to GNU Lesser Public License 2.1 rather than the ↵Carl Worth1-7/+5
Library Public License version 2 or 'any later version'
2004-08-02Change from MIT license to LGPL.Carl Worth1-20/+14
2003-12-08Clean up cairo_path_callbacks to have move_to, line_to, curve_to, abd ↵Carl Worth1-33/+23
close_path instead of add_edge, add_spline, and done_sub_path. Much, much nicer. Provide cairo_polygon_move_to and cairo_polygon_line_to instead of cairo_polygon_add_point. Track change in cairo_polygon interface.
2003-11-21Use 0 and 1 not False and True, (to avoid false dependency on X headers).Carl Worth1-2/+2
Use cairo_point_double_t not XPointDouble, (to avoid false dependency on X headers). Thanks to "Sasha V." <sasha@aftercode.net> for pointing these out.
2003-10-23Fixed copyright attribution to refer to "University of Southern CaliforniaCarl Worth1-1/+1
2003-10-04Remove abbreviation of "point" as "pt". Fix cairo_destrot, ↵Carl Worth1-18/+18
cairo_set_target_surface, and cairo_set_target_image to act appropriately in the face of non-zero status.