summaryrefslogtreecommitdiff
path: root/src/cairo-traps.c
Commit message (Collapse)AuthorAgeFilesLines
* Rename cairo_lines_compare_at_y into _cairo_lines_compare_at_y and fix syntaxMarc Jeanmougin2021-04-021-1/+1
| | | | Fixes https://gitlab.freedesktop.org/cairo/cairo/-/issues/467
* Misc. typosluz.paz2019-01-311-1/+1
| | | | | | | Found via `codespell -i 3 -w -I ../cairo-word-whitelist.txt -L tim,ned,uint` Follow up of 12cb59be7da Reviewed-by: Bryce Harrington <bryce@bryceharrington.org>
* Avoid indiscriminate use of VALGRIND_MAKE_MEM_NOACCESS.John Lindgren2015-06-261-1/+1
| | | | | | | | | Marking stack-allocated objects as no-access creates false positives, which distract from finding real memory errors. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=52548 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* stroke,traps: Emit join without loss of precisionChris Wilson2014-09-291-14/+71
| | | | | | | | | | | | | | As the target renderers operate at a different sample resolution then we use internally for coordinate representation, there is always a potential for discrepancies in the line gradients when passing around trapezoids. To overcome this, the protocol specification of trapezoids uses the full lines and vertical range as opposed to vertices and so long as we always use the same lines for conjoint trapezoids, they remain abutting in the rasteriser. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=84115 Testcase: bug-84115 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* stroke: Make the incremental trapezoid stroker optionally available againChris Wilson2013-01-031-0/+252
| | | | | | | | | | | Whilst it cannot handle self-intersecting strokes (which includes the antialias region of neighbouring lines and joints), it is about 3x faster to use than the more robust algorithm. As some backends delegate the rendering, the quality may still be preserved and so they should be responsible for choosing the appropriate method for generation of the stroke geometry. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* doc: Make the documentation name match the function nameAndrea Canciani2012-03-291-1/+1
| | | | | Fixes the 'symbol not found' errors caused by mismatches between the documentation name and the name in the code.
* traps: Use the mono-scan-converter to reduce the number of trapsChris Wilson2012-03-041-0/+62
| | | | | | | | This trick only seems effective with mono-rasterisation, with a win of about 10% for tiger-demo --antialias=none. At other antialias setting, performance is reduced. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* debug-trapsChris Wilson2011-10-111-0/+35
|
* Introduce a new compositor architectureChris Wilson2011-09-121-0/+61
| | | | | | | | | | | | | | | | | | 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. :)
* clip: Rudimentary support for clip-polygon extractionChris Wilson2011-07-191-22/+73
| | | | | | | 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>
* Update FSF addressAndrea Canciani2010-04-271-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
* surface-fallback: Convert to composite rectanglesChris Wilson2010-01-221-23/+24
|
* Move _cairo_error() to a standalone headerChris Wilson2010-01-221-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.
* [clip] Apply surface offset when combining with clip maskChris Wilson2009-08-291-6/+2
| | | | | | In order to correctly combine the clip mask with the compositing mask the clip path must be offset so that it is relative to the destination surface.
* [tessellate] Rectangular special caseChris Wilson2009-08-291-7/+21
| | | | | | | | 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.
* [slope] Inline _cairo_slope_init()Chris Wilson2009-08-291-0/+1
| | | | | Move the definition to a separate header file and allow callers to inline the simple function.
* [clip] Use geometric clipping for unaligned clipsChris Wilson2009-08-291-91/+119
| | | | | | 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.
* [tessellator] Special case rectilinear tessellationChris Wilson2009-08-291-0/+2
| | | | | | | | | | | | | | | | | | | | 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.
* [traps] Increase exponential expansion factor.Chris Wilson2009-08-291-5/+3
| | | | | Grow the traps more rapidly, as the allocations are very short-lived so the over-allocation is less of an issue.
* [traps] Compute extents on demand.Chris Wilson2009-08-291-314/+126
|
* Eliminate self-intersecting strokes.Chris Wilson2009-08-291-26/+46
| | | | | | | | | | | | | | | | | | | | 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. ...
* Remove clip handling from generic surface layer.Chris Wilson2009-07-231-10/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ▏
* Reinstate cairo_region_create_rectangles()Søren Sandmann Pedersen2009-06-151-19/+28
| | | | | | | | cairo_region_union_rectangle() is linear in the number of rectangles in the region. There is no way to make it significantly faster without losing the ability to return errors synchronously, so a cairo_region_create_rectangles() is needed to avoid a large performance regression.
* valgrindify init/fini routinesChris Wilson2009-06-041-0/+4
| | | | | Annotate object init/fini routines to detect use-after-free for on-stack/embedded objects.
* [memfault] Manually inject faults when using stack allocationsChris Wilson2009-04-231-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.
* [traps] Propagate allocation failure.Chris Wilson2009-03-301-13/+10
| | | | Report failure to allocation region.
* [region] Expand rect to rectangle in a couple of namesSøren Sandmann Pedersen2009-03-281-1/+1
| | | | | | | | | Specifically, cairo_region_union_rect -> cairo_region_union_rectangle cairo_region_create_rect -> cairo_region_create_rectangle Also delete cairo_region_clear() which is not that useful.
* [region] Delete cairo_region_create_rectangles()Søren Sandmann Pedersen2009-03-281-37/+23
| | | | | | It was only used in _cairo_traps_extract_region() which could be simplified significantly by calling cairo_region_union_rect() repeatedly instead.
* [region] Remove underscores from _cairo_region_*Søren Sandmann2009-03-281-5/+5
|
* [region] Consistently use rectangles in the API of regionsSøren Sandmann Pedersen2009-03-281-15/+16
| | | | | | | | | | | Usually, rectangles are more useful than boxes, so regions should only expose rectangles in their public API. Specifically, _cairo_region_num_boxes becomes _cairo_region_num_rectangles _cairo_region_get_box becomes _cairo_region_get_rectangle Remove the cairo_box_int_t type
* [region] Make cairo_region_t a malloced object.Søren Sandmann2009-03-281-5/+9
|
* Mark allocation failures as unlikely.Chris Wilson2008-11-291-2/+2
| | | | | Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
* Mark if(status) as being unlikely.Chris Wilson2008-11-291-6/+6
| | | | | The error paths should be hit very rarely during normal operation, so mark them as being unlikely so gcc may emit better code.
* [traps] Whitespace.Chris Wilson2008-10-301-13/+20
| | | | Fixup whitespace in line with CODING_STYLE and rest of file.
* [traps] Discard trivially empty trapezoid.Chris Wilson2008-10-041-2/+9
| | | | | | The convex_quad tessellator (and possibly even the more general polygon tessellator) will generate empty trapezoids when given a rectangle which can be trivially discarded before inserting into traps.
* [traps] Reset extents on clearing.Chris Wilson2008-10-041-0/+2
| | | | | When clearing the array of current trapezoids, reset the extents to infinite so that they are properly recomputed.
* [trap] Trivial reject if trapezoid is entirely above or belowChris Wilson2008-09-241-0/+4
| | | | Also check whether is vertically within limits.
* [traps] Adjust lines if either point is on the boundary.Chris Wilson2008-09-241-4/+4
| | | | | | If either point lies on the limit and the other outside, adjust the line to be parallel to the boundary. This adjusts the previous test where both points needed to be entirely outside.
* [traps] Limit extents to imposed constraints.Chris Wilson2008-09-241-1/+14
| | | | | | | When reporting the extents of the traps, constrain them to the imposed limits. This is relied upon in the analysis-surface which sets the limits on the traps (based on clip/surface extents) and then reports the extents of the traps as the region of the operation.
* [stroke] Optimise rectilinear strokes.Chris Wilson2008-09-191-0/+18
| | | | | | | | | | Avoid the overhead of sorting the rectangle in _cairo_traps_tessellate_convex_quad() by constructing the trap directly from the line segment. This also has secondary effects in only passing the non-degenerate trap to _cairo_traps_add_trap(). For rectilinear Hilbert curves this makes the rectilinear stoker over 4x faster.
* Simple perf tweaks for a rectilinear Hilbert curve.Chris Wilson2008-09-191-110/+65
| | | | | Some tweaks to avoid stack copies and branches that save ~25% in _cairo_traps_tessellate_convex_quad().
* [trap] Fixup a double _cairo_traps_fini().Chris Wilson2008-09-191-0/+8
| | | | | | | The rectilinear stroke finalized the cairo_traps_t passed to it - which was then subsequently used without re-initialized. So instead of finalizing the structure, just remove any traps that we may have added (leaving the limits and memory intact).
* [cairo-traps] Fix overflow in traps_path codeBehdad Esfahbod2008-05-151-9/+10
| | | | | This was causing the user-font test failure in type1 subsetting code as the type1 code creates a font at size 1000.
* [cairo-traps] Add _cairo_traps_path()Behdad Esfahbod2008-05-091-0/+46
| | | | It appends path for each trap to the path.
* Add more consts to function signatures and remove stale prototypeBehdad Esfahbod2008-05-091-4/+6
|
* Optimize dashed strokes, part 2Vladimir Vukicevic2008-02-051-0/+8
| | | | | Pass down the bounding box to the stroker, and avoid doing expensive calculations for dash segments that are outside the box.
* [doc] Make sure all function names in docs are followed by ()Behdad Esfahbod2008-01-281-1/+1
|
* [doc] Make sure all type names in docs are prefixed by #Behdad Esfahbod2008-01-281-1/+1
|
* [cairo-traps] Typo caught by valgrind.Chris Wilson2008-01-101-1/+1
| | | | | | | | | | | | ==3429== Conditional jump or move depends on uninitialised value(s) ==3429== at 0x4E3FB0F: _cairo_box_round_to_rectangle (cairo-fixed-private.h:196) ==3429== by 0x4E34B29: _cairo_clip_intersect_to_rectangle (cairo-clip.c:162) ==3429== by 0x4E31943: cairo_push_group_with_content (cairo.c:495) ==3429== by 0x403044: draw (clip-zero.c:48) ==3429== by 0x404221: cairo_test_expecting (cairo-test.c:377) ==3429== by 0x64701C3: (below main) (libc-start.c:222) Caused by setting extents->p2.y to zero twice.
* [cairo-traps] Return zero extents if it contains no traps.Chris Wilson2008-01-051-1/+5
| | | | | | | | Previously, _cairo_traps_extents () returned the extents p1={INT_MAX, INT_MAX} p2={INT_MIN, INT_MIN} for an empty traps leading to integer overflow when computing the width using p2-p1 and causing further overflows within libpixman. [For example this caused the allocation of massive regions with test/mask and the PS backend.]