summaryrefslogtreecommitdiff
path: root/src/cairo-path-fixed.c
AgeCommit message (Collapse)AuthorFilesLines
2009-10-30path: Skip any secondary degenerate line-to segments.Chris Wilson1-3/+10
Only the very first line-to following a move-to can have any significance if degenerate whilst stroking, so skip all others. In other words, 0 0 m 0 0 l stroke produces a capped degenerate path (i.e a dot), 0 0 m 0 0 l 0 0 l stroke produces the same degenerate stroke, and 0 0 m 0 0 l 1 0 l stroke produce a horizontal line.
2009-10-30path: Misclassification of rectilinear after degenerate line-toChris Wilson1-49/+52
Malte Nuhn reported hitting an assertion: cairo-path-stroke.c:1816: _cairo_rectilinear_stroker_line_to: Assertion `a->x == b->x || a->y == b->y' failed. http://bugs.freedesktop.org/show_bug.cgi?id=24797 when stroking an apparently simple path: 0 8.626485 m 0 8.626485 l 5.208333 2.5 l 10.416667 2.5 l 15.625 2.5 l 20.833333 2.5 l 26.041667 2.5 l 31.25 2.5 l 36.458333 2.5 l 41.666667 2.5 l 46.875 2.5 l 52.083333 2.5 l 57.291667 2.5 l 62.5 2.5 l 67.708333 2.5 l 72.916667 2.5 l 78.125 2.5 l 83.333333 2.5 l 88.541667 2.5 l 93.75 2.5 l 98.958333 2.5 l 104.166667 2.5 l 109.375 2.5 l 114.583333 2.5 l 119.791667 2.5 l 125 2.5 l stroke which upon reduction becomes: 0.000000 8.625000 m 5.207031 2.500000 l 125.000000 2.500000 l stroke The bug is that after spotting a repeated line-to we move the previous end-point without reclassifying the path, hence we miss the non-rectilinear step.
2009-08-29[path] Return the canonical box.Chris Wilson1-4/+24
When returning the single box that represents a path, always return it consistently wound.
2009-08-29[path-fixed] Distinguish cw and ccw boxesChris Wilson1-2/+2
To correctly handle retessellating trapezods constructed from alternately wound boxes, then we need to pass that information from the path to the tessellator. We do this by switching the direction of the box if the first edge is horizontal as opposed to vertical.
2009-08-29[path] Handle the implicit close for path_fixed_is_box()Chris Wilson1-15/+18
_cairo_path_fixed_is_box() is only called for filled paths and so must handle the implicit close (which was already being correctly handled by _cairo_path_fixed_iter_is_box).
2009-08-29[path] Eliminate redundant line-to before a closeChris Wilson1-0/+22
As the close implicitly issues a line-to to the initial point, remove an identical line-to if present.
2009-08-29[path] Discard redundant line-toChris Wilson1-21/+28
Eliminate repeated line-to to the current point.
2009-08-29[slope] Inline _cairo_slope_init()Chris Wilson1-0/+1
Move the definition to a separate header file and allow callers to inline the simple function.
2009-08-06[path] Extend identical lines.Chris Wilson1-3/+28
If a subsequent PATH_OP is just a continuation of the previous line, i.e. it has the same gradient, then just replace the end-point of the previous line with the new point rather than adding a new operation. Surprisingly this occurs in the wild, but the main motivation is a future optimisation to reduce the number of intersections during stroke-to-path.
2009-07-29[path] Fix iter to handle circular list of buffersChris Wilson1-2/+7
When switching the path over to use the circularly linked list, 73f801, I missed updating the path iterator.
2009-07-29[path] Remove the broken rel-curve-to as line-toChris Wilson1-6/+0
As pointed out by Andrea, and now tested by test/degenerate-rel-curve-to, this attempt at removing degenerate curve-to was broken.
2009-07-28[path] Remove the erroneous conversion of a 'zero-length' curve-toChris Wilson1-3/+0
As pointed out by Andrea, and now tested by test/degenerate-curve-to, a curve-to that begins and ends on the same point may extend further due to its control points. It can not be simply replaced with a degenerate line-to. In order to do so we will need more extensive degeneracy checking, ala _cairo_spline_init().
2009-07-27Revert "[path] Convert straight curve-to to line-to"Carl Worth1-12/+0
This reverts commit c72ca2f2296b5fbc5859059b98221e5ffe087dae. This commit was broken as verified by the curve-to-as-line-to test case.
2009-07-27[path] Convert straight curve-to to line-toChris Wilson1-0/+12
Avoid the high cost associated with curves if we can convert the curve to a straight line.
2009-07-23Remove clip handling from generic surface layer.Chris Wilson1-63/+138
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 ▏
2009-07-05[path] Don't include current-point in hashChris Wilson1-8/+9
As we don't strictly use the current-point in comparing paths, exclude it from the hash. Similarly use the path content flags as a cheap means to differentiate contents.
2009-07-05[path] Use cairo_list_t instead of open-coding its ownChris Wilson1-121/+105
Use the cairo_list_t and its style of iterators to improve the readability of the cairo_path_buf_t management. Note the complications that arise from the embedding of the initial buf -- however the macros do help make the unusual manipulations more identifiable.
2009-07-05[path] Add path watch debuggingChris Wilson1-0/+26
Simple debug macro to print the path to stderr during construction.
2009-07-05[path] Evaluate is_box && is_region during constructionChris Wilson1-181/+105
Whilst constructing the path, if the operations continue to be axis-aligned lines, allow the is_box and is_region flags to persist. These are set to false as soon as a curve-to is added, a diagonal or in the case of is_region a non-integer point.
2009-06-17[path] Fix missing implicit move-toNis Martensen1-3/+3
When cairo_curve_to happens to start a new subpath (e.g., after a call to cairo_new_sub_path()), it also needs to update the last_move_point. Otherwise the new current point after a close_path() will be at an unexpected position. Therefore, call _cairo_path_fixed_move_to() explicitly.
2009-06-04valgrindify init/fini routinesChris Wilson1-7/+3
Annotate object init/fini routines to detect use-after-free for on-stack/embedded objects.
2009-03-17Support compiling without fontconfigBehdad Esfahbod1-1/+1
Adds a new, fake, fontconfig font backend. Fontconfig can be disabled using --disable-fc, in which case the toy text API wont find fonts and the internal font will always be used. Also defines the feature macro CAIRO_HAS_FC_FONT. The two fontconfig-specific functions in cairo-ft.h depend on that macro now.
2009-01-29[path] A degenerate curve_to becomes a line_to.Chris Wilson1-1/+1
Be consistent.
2008-12-14[doc] Fix erroneous doc comment.Chris Wilson1-1/+1
A normal comment was marked as a gtk-doc entry and thus causing gtk-doc to complain.
2008-12-12[path] Mark points as const during _cairo_path_fixed_interpret()Chris Wilson1-46/+40
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-5/+2
Yikes! The callback could fail so we need to propagate the error status.
2008-12-06[path-fixed] New _cairo_path_fixed_is_region().M Joonas Pihlaja1-0/+96
We want to hit the current fast paths for rendering axis aligned rectilinear paths rather than spans, and for that we need to be able to identify regional paths.
2008-12-06[path-fixed] Avoid extra indirection when iterating already flat paths.M Joonas Pihlaja1-0/+9
Perform a plain iteration rather than a flattening one if the path knows it doesn't have any curves.
2008-11-29Mark allocation failures as unlikely.Chris Wilson1-2/+2
Use the gcc likelihood annotation to indicate that allocation failures are extremely unlikely.
2008-11-29Mark if(status) as being unlikely.Chris Wilson1-7/+7
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-5/+9
Also scan for appendages of simple rectangles.
2008-11-29[path] Carefully check for no more points.Chris Wilson1-3/+12
As the empty path points to an embedded buf, we cannot rely on the buf pointer being NULL to mark end-of-path.
2008-11-25[fill] Emit rectangles for GdkRegionChris Wilson1-8/+116
Scan the path for a series of consistently wound rectangles.
2008-11-16[spline] Eliminate intermediate allocations during spline decomposition.Chris Wilson1-18/+9
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-11-13Add CairoScript backend.Chris Wilson1-0/+164
A new meta-surface backend for serialising drawing operations to a CairoScript file. The principal use (as currently envisaged) is to provide a round-trip testing mechanism for CairoScript - i.e. we can generate script files for every test in the suite and check that we can replay them with perfect fidelity. (Obviously this does not provide complete coverage of CairoScript's syntax, but should give reasonable coverage over the operators.)
2008-06-01Fix now-detected doc formatting issuesBehdad Esfahbod1-0/+2
2008-05-28[cairo-path-fixed] Fixe compiler warningBehdad Esfahbod1-1/+1
2008-05-13[cairo-path-fixed] Implement full-matrix _cairo_path_fixed_transform()Behdad Esfahbod1-18/+36
Based on patch from Peter Clifton.
2008-05-10Fix gtk-doc warningsBehdad Esfahbod1-1/+1
2008-05-09[cairo-path-fixed] Add _cairo_path_fixed_append()Behdad Esfahbod1-0/+46
2008-05-09[cairo-path-fixed] Add a couple consts to function signaturesBehdad Esfahbod1-2/+2
2008-03-15Fix bug in _cairo_path_fixed_is_equalAdrian Johnson1-2/+4
Ensure the entire path is compared.
2008-02-26Use PDF 're' operator for rectangle pathsAdrian Johnson1-0/+24
Modify cairo-pdf-operators.c to emit to 're' path operator when the path contains only a rectangle. This can only be done when the path is logically equivilent to the the path drawn by the 're' operator. Otherwise dashed strokes may start on the wrong line. ie the path must be equivalent to: cairo_move_to (cr, x, y); cairo_rel_line_to (cr, width, 0); cairo_rel_line_to (cr, 0, height); cairo_rel_line_to (cr, -width, 0); cairo_close_path (cr); which is also equivilent to cairo_rectangle().
2008-02-25[quartz] Optimize path handling where possibleVladimir Vukicevic1-0/+81
2008-01-21[path-fixed] add _cairo_path_fixed_interpret_flatBrian Ewins1-0/+99
_cairo_path_fixed_interpret_flat flattens the path as it interprets it, meaning that a curve_to callback is not required.
2007-12-27[cairo-path-fixed] Consolidate cairo_path_buf_t when copying.Chris Wilson1-8/+25
When copying the cairo_path_fixed_t, consolidate the list of dynamically allocated cairo_path_buf_t into a single buffer.
2007-12-27[cairo-path-fixed] Ensure the points array is naturally aligned, take 2.Chris Wilson1-6/+6
By enlarging buf_size to ensure the correct alignment of the points array with the cairo_path_buf_t block, we can efficiently use the padding bytes to store more ops.
2007-12-27[cairo-path-fixed] Ensure the array of points is correctly aligned.Chris Wilson1-3/+6
In http://bugs.gentoo.org/show_bug.cgi?id=203282, it was identified that the cairo_path_buf was causing unaligned accesses (thus generating SIGBUS on architectures like the SPARC) to its array of points. As we manually allocate a single block of memory for the cairo_path_buf_t and its arrays, we must also manually ensure correct alignment - as opposed to cairo_path_buf_fixed_t for which the compiler automatically aligns the embedded arrays.
2007-11-11Compilation warning suppression (char as array subscript).Emmanuel Pacaud1-2/+2
cairo_path_op_t is a char, and can't be directly used as array subscript.
2007-11-11Fix _cairo_path_fixed_init_copy.Emmanuel Pacaud1-0/+2
All the copied data buffers except the first one weren't completely initialized (num_ops and num_points). That was the cause of the failure of some vector surface tests, like random-intersections.