summaryrefslogtreecommitdiff
path: root/src/cairo-path-fixed.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix cast between incompatible function types warningsAdrian Johnson2021-08-221-2/+10
| | | | warning: cast between incompatible function types from ‘cairo_status_t (*)(void *, const cairo_point_t *)’ {aka ‘enum _cairo_status (*)(void *, const struct _cairo_point *)’} to ‘cairo_status_t (*)(void *, const cairo_point_t *, const cairo_slope_t *)’ {aka ‘enum _cairo_status (*)(void *, const struct _cairo_point *, const struct _cairo_slope *)’} [-Wcast-function-type]
* Use uintptr_t for all casts between pointer and integerAdrian Johnson2021-07-251-2/+2
| | | | | | | | | | | | On 64-bit windows, long is 32-bit. When compiling there are a large number of warnings about mismatched sizes when casting long to/from a pointer. Use the (u)intptr_t type for any integer that will have a pointer stored in it. Use a (u)intptr_t cast when integers are stored in pointers to silence warnings. Fixes #263
* build: Fix various compiler warningsGeorge Matsumura2020-11-071-1/+1
| | | | | | This fixes a few compiler warnings that were encountered with gcc 9.3.0. Signed-off-by: George Matsumura <gmmatsumura01@bvsd.org>
* Use _cairo_malloc instead of mallocAdrian Johnson2018-05-071-1/+1
| | | | | | | | | | _cairo_malloc(0) always returns NULL, but has not been used consistently. This patch replaces many calls to malloc() with _cairo_malloc(). Fixes: fdo# 101547 CVE: CVE-2017-9814 Heap buffer overflow at cairo-truetype-subset.c:1299 Reviewed-by: Bryce Harrington <bryce@osg.samsung.com>
* 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>
* Preserve current-point in copy_path()/append_path() sequenceBehdad Esfahbod2014-01-271-0/+3
| | | | Fixes path-currentpoint test.
* path: Fix a bug in line intersectionMartin Robinson2013-03-141-12/+27
| | | | | | Before the intersection code was not taking into account that both quotients are required to be in the range (0,1) for the segments to intersect or handling the case of negative numerators and denominators.
* path: Fix bbox computation for negative scale factorsChris Wilson2013-02-121-0/+11
| | | | | | | | The fast path for transforming a path by a simple scale factor, forgot to fix up the orientation of the box if that scale factor was negative. Reported-by: Edward Zimmermann <Edward.Zimmermann@cib.de> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* gl/msaa: Add a fast path for fills that are simple quadsMartin Robinson2013-01-251-34/+102
| | | | | Instead of invoking Bentley-Ottman for fills that are simple quadrilaterals, just pass the geometry straight to OpenGL.
* path: Update last_move_point after move-toChris Wilson2012-09-051-0/+1
| | | | | | Reported-and-tested-by: Jussi Kukkonen <jku@linux.intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54549 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Split cairo-list into struct+inlinesChris Wilson2012-04-191-0/+1
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Split cairo-box-privates into struct+inlinesChris Wilson2012-04-191-1/+1
| | | | | References: https://bugs.freedesktop.org/show_bug.cgi?id=48577 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* path-fixed: Silence gcc warningsAndrea Canciani2012-02-201-1/+1
| | | | | | | | | | | | | | | | | _cairo_path_fixed_last_op() contains an assertion, which gcc doesn't like to inline. Since it is a static function, which basically accesses a value, gcc will inline it anyway when assertions are disabled, so remove the "inline" hint to reduce gcc warning noise when doing debug builds. Fixes: cairo-path-fixed.c: In function '_cairo_path_fixed_drop_line_to': cairo-path-fixed.c:373:1: warning: inlining failed in call to '_cairo_path_fixed_last_op.isra.5.part.6': call is unlikely and code size would grow [-Winline] cairo-path-fixed.c:400:1: warning: called from here [-Winline] ...
* path: Fix a minor oversight in 1ce5d4707cf26061Uli Schlachter2011-09-161-1/+1
| | | | | | | | | The plan was "path: Skip calls to zero-length memcpy". However, this skipped calls if the buffer was still empty, which means that it skipped all calls. Fixes: Half the test suite, lots of assertion failures Signed-off-by: Uli Schlachter <psychon@znc.in>
* path: Skip calls to zero-length memcpyChris Wilson2011-09-161-0/+3
| | | | | | | | | | | | We attempt to copy 0 points onto the array of path points for a close-path. This is pointless and an unnecessary function call under MSVC at least. Based on a patch by Steve Snyder, incorporating Behdad's review comments. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=37836 Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* Introduce a new compositor architectureChris Wilson2011-09-121-0/+57
| | | | | | | | | | | | | | | | | | 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. :)
* stroke: Convert the outlines into contour and then into a polygonChris Wilson2011-08-151-1/+1
| | | | | | | | | | | | 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>
* fixed: Allow the implicit close of the last fill path to complete a fill-boxChris Wilson2011-08-101-4/+4
| | | | Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* fill: A horizontal/vertical line is also a degenerate fill boxChris Wilson2011-08-091-13/+21
| | | | | | | | | | Since we discard empty fill boxes whilst filling, we can also treat horizontal/vertical lines as a filled box and so proceed with the rectangular fast path in the presence of cairo_rectangle (x, y, w, h) with w == 0 || h == 0. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
* path: Fix _cairo_path_fixed_is_rectangle()Andrea Canciani2011-03-181-1/+4
| | | | | | | | | | | __cairo_path_fixed_is_rectangle() is used by the PS and PDF backends to check if a path is equivalent to a rectangle when stroking. This is different from being a rectangle when filling, because of the implicit close_path appended to every subpath when filling. Fixes stroke-open-box. See https://bugs.freedesktop.org/show_bug.cgi?id=34560
* path: Silence warningsAndrea Canciani2010-12-131-1/+1
| | | | | | | | gcc complains that: cairo-path-fixed.c:400: warning: inlining failed in call to '_cairo_path_fixed_drop_line_to': call is unlikely and code size would grow
* path: Remove support for inverse direction interpretationAndrea Canciani2010-12-101-34/+11
| | | | | | The previous commit guarantees that paths are always interpreted in the forward direction, so the code allowing both directions is not needed anymore.
* path: Always interpret in forward directionAndrea Canciani2010-12-101-7/+4
| | | | | | 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.
* path: Tighten transformed extentsAndrea Canciani2010-10-291-0/+15
| | | | | The transformation code should produce tight extents if they are to be used in the new simple extents functions.
* path: Tighten curve_to extentsAndrea Canciani2010-10-291-4/+2
| | | | | | The additional time spent in the computation of tight extents for the curve_to operation doesn't seem to be significant, but it makes the extents computations faster and the approximations more accurate.
* path: Replace _cairo_path_fixed_extents_add with _cairo_box_add_pointAndrea Canciani2010-10-291-18/+3
| | | | | Path extents now satisfy _cairo_box_add_point requirements, so it can be used instead of _cairo_path_fixed_extents_add.
* path: Fix _cairo_path_fixed_transformAndrea Canciani2010-10-291-16/+34
| | | | | | current_point and last_move_to were previously left in their old position (which could lead to incorrect flag computation if other operations were added to the path) and flags were not updated.
* path: Recompute flags in _cairo_path_fixed_scale_and_offsetAndrea Canciani2010-10-291-10/+9
| | | | | | | | | Only fill_maybe_region can change its value because the transformation preserves vertical and horizontal lines, but can move the points and make them integer if they were not or non-integer if they were. Recomputing it is just as easy as checking if all the points are integer and the path is fill_is_rectilinear.
* path: Transform current_point and last_move_to in ↵Andrea Canciani2010-10-291-0/+4
| | | | | | | | _cairo_path_fixed_scale_and_offset They were previously left in their old position (which could lead to incorrect flag computation if other operations were added to the path).
* path: Recompute flags in _cairo_path_fixed_translateAndrea Canciani2010-10-291-11/+12
| | | | | | | | | Only fill_maybe_region can change its value because the transformation preserves vertical and horizontal lines, but can move the points and make them integer if they were not or non-integer if they were. Recomputing it is just as easy as checking if all the points are integer and the path is fill_is_rectilinear.
* path: Cleanup close_pathAndrea Canciani2010-10-291-6/+2
| | | | | | Instead of explicitly calling _cairo_fixed_move_to, setting the needs_move_to flags is sufficient because the current_point is already updeted correctly.
* path: Make _cairo_path_fixed_last_op assert on empty pathAndrea Canciani2010-10-291-2/+1
| | | | | _cairo_path_fixed_last_op should now only be used on non-empty path (to test if the previous operation was a line_to).
* path: Cleanup _cairo_path_fixed_iter_at_endAndrea Canciani2010-10-291-10/+1
| | | | | The last operation of a path cannot be a move_to anymore (since move_to is only added if another operation is added after it).
* path: Cleanup _cairo_path_fixed_transformAndrea Canciani2010-10-291-11/+10
| | | | | | Clean up the code and make sure that _cairo_path_fixed_translate is used whenever the _cairo_fixed_to_double rounding would result in the matrix being approximated with a translation.
* path: Log flagsAndrea Canciani2010-10-291-2/+13
| | | | When logging path operations, also log computed flags.
* path: Rename fill optimization flagsAndrea Canciani2010-10-291-21/+26
| | | | Rename fill optimization flags making fill_ their common prefix.
* path: Add stroke_is_rectilinear flagAndrea Canciani2010-10-291-21/+24
| | | | | | Stroke and fill rectilinearity cannot be represented by a single flag without missing the opportunity of considering some strokes rectilinear.
* path: New path construction logicAndrea Canciani2010-10-291-51/+60
| | | | | | | | | | | Now move_to's are actually added to the path when followed by a drawing operation (line_to, curve_to or close_path). This is implemented by updating the current_point and setting the needs_move_to when a move_to operation is requested. Whenever a drawing operation is requested and the needs_move_to flag is set, a move_to is added before the drawing operation.
* path: Drop degenerate line_to in _cairo_path_fixed_curve_toAndrea Canciani2010-10-291-0/+11
| | | | | | When a degenerate line_to is followed by a curve_to operation, the line_to can be safely dropped, just like for degenerate line_to followed by line_to.
* path: Move _cairo_path_fixed_add at the end of line_to and curve_toAndrea Canciani2010-10-291-8/+3
|
* box: Add box headerAndrea Canciani2010-10-291-0/+1
| | | | | | | Add a new header implementing very simple box functions: - initialization with the two extrema - extension with a point - in/out test
* path: Cleanup _cairo_path_fixed_line_toAndrea Canciani2010-10-291-14/+8
| | | | | | The low-level line_to optimizations can be implemented in a more abstract way using _cairo_path_fixed_penultimate_point and _cairo_path_fixed_drop_line_to.
* path: Simplify close_pathAndrea Canciani2010-10-291-20/+17
| | | | | | | Instead of explicitly computing the flag in close_path, manually close the path with a line_to, then drop the last operation if it is a line_to (it might be another operation if the line_to was ignored because it would have been degenerate).
* path: Add utility functionsAndrea Canciani2010-10-291-0/+28
| | | | | | | Add a function to get the penultimate point and another one to drop the last operation (assuming it is a line_to). This allows some more abstraction in the line_to and close_path code.
* path: Rename _cairo_path_last_op to _cairo_path_fixed_last_opAndrea Canciani2010-10-291-6/+6
| | | | | Aestetical change, to make the naming consistent with that of the other functions.
* path: Make path equality independent of flagsAndrea Canciani2010-10-291-4/+1
| | | | | | | Flags for the same path can be different depending on its "history" (in particular if it was constructed and transformed they might be different from what they would be if each point was transformed and then the path constructed).
* path: Improve hashingAndrea Canciani2010-10-291-10/+10
| | | | | | | Make the hash independent of buf bucketing, extents and flags. This makes the hash depend only on the actual content of the path, not on how it is stored or on any computed property.
* path: Replace _cairo_path_fixed_is_equal with _cairo_path_fixed_equalAndrea Canciani2010-10-291-35/+0
| | | | | | | | Remove _cairo_path_fixed_is_equal and use _cairo_path_fixed_equal instead. The latter function can recognize that two paths are equal even if the drawing commands have been partitioned in a different way in the buf list.
* path: Exponentially grow buffer based on populated points and ops.Chris Wilson2010-06-111-20/+19
| | | | | | | | Instead of simply doubling the buffer size every time we overflow a point or an op, enlarge the buffer to fit twice the number of used points and ops. We expect paths to be fairly consistent in the mix of operations, and this allows the buffer size to tune itself to actual usage and reduce wastage.
* Remove useless null checks of a and b in _cairo_path_fixed_equaltimeless2010-05-071-14/+8
| | | | | | 'a' and 'b' are dereferenced before being checked for null. From https://bugzilla.mozilla.org/show_bug.cgi?id=555706