Commit graph

21 commits

Author SHA1 Message Date
Brian Ewins
1471b3f00a [path-fixed] add _cairo_path_fixed_interpret_flat
_cairo_path_fixed_interpret_flat flattens the path as it
interprets it, meaning that a curve_to callback is not
required.
2008-01-21 12:01:44 -08:00
Chris Wilson
e82b0f46b2 [cairo-path-fixed] Consolidate cairo_path_buf_t when copying.
When copying the cairo_path_fixed_t, consolidate the list of
dynamically allocated cairo_path_buf_t into a single buffer.
2007-12-27 12:55:50 +00:00
Chris Wilson
e0187ad49b [cairo-path-fixed] Ensure the points array is naturally aligned, take 2.
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 12:46:24 +00:00
Chris Wilson
d8169b8cef [cairo-path-fixed] Ensure the array of points is correctly aligned.
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-12-27 10:45:25 +00:00
Emmanuel Pacaud
0359ad6c8d Compilation warning suppression (char as array subscript).
cairo_path_op_t is a char, and can't be directly used as array subscript.
2007-11-11 00:18:19 +01:00
Emmanuel Pacaud
1b71af7e61 Fix _cairo_path_fixed_init_copy.
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.
2007-11-11 00:14:34 +01:00
Chris Wilson
901b0c9752 [cairo-path-fixed] Exponentially enlarge cairo_path_buf_t.
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-11-05 08:51:06 +00:00
Chris Wilson
6fdb7f129c Simplify return value from cairo_path_fixed_get_current_point().
The only caller of cairo_path_fixed_get_current_point(), used the status
return to determine whether or not the path had a current point (and did
not propagate the error) - for which we had already removed the
_cairo_error() markup. Now we reduce the boolean status return to a
cairo_bool_t, with a net reduction in code.
2007-10-30 10:43:55 +00:00
Chris Wilson
7ff80234e3 [cairo-path-fixed] Drop the _cairo_error() markup.
Do not use _cairo_error(CAIRO_STATUS_NO_CURRENT_POINT) within
_cairo_path_fixed_get_current_point() as the only caller,
cairo_get_current_point(), expects and handles that status.
2007-10-16 10:42:15 +01:00
Chris Wilson
bed8239f03 [cairo-error] Clean up all the warnings and missing _cairo_error() calls.
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 13:31:44 +01:00
Chris Wilson
8ad56b308a [malloc/error] Add call to _cairo_error() after a failed malloc.
Blitz all allocations to ensure that they raise a
_cairo_error(CAIRO_STATUS_NO_MEMORY) on failure.
2007-10-04 00:42:30 +01:00
Emmanuel Pacaud
ac51fff0db Add a new fill_stroke surface backend method.
This method is for use in vector backends, where fill immediatly followed by
stroke command with the same path can be emited in the same backend command.
This commit also factorize the detection of such cases in the meta surface
backend and automatically call the fill_stroke method on replay.
2007-08-25 20:49:50 +02:00
Vladimir Vukicevic
f97bb5613a Fix path_fixed_offset_and_scale to apply scale and offset in right order 2007-08-20 17:32:05 -07:00
Vladimir Vukicevic
9c38aa3b96 [fixpt] Use _cairo_fixed_mul insted of manual multiplication 2007-07-18 22:45:21 +02:00
Behdad Esfahbod
8fbf50d31d [src] Make sure all source files #include "cairoint.h" as their first include
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-04-03 20:28:11 -04:00
Behdad Esfahbod
39679b1b21 [cairo-path-fixed] Fix "comparison between signed and unsigned" warnings 2007-03-20 18:01:41 -04:00
Behdad Esfahbod
1bd073a1a2 [cairo-path-fixed] Merge op and arg bufs
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-13 05:14:18 -04:00
Behdad Esfahbod
5750d669af [cairo-path-fixed] Avoid malloc for small paths
We do this by including an initial op and arg buf in cairo_path_fixed_t,
so for small paths we don't have to alloc those buffers.

The way this is done is a bit unusual.  Specifically, using an array of
length one instead of a normal member:

-    cairo_path_op_buf_t *op_buf_head;
+    cairo_path_op_buf_t  op_buf_head[1];

Has the advantage that read-only use of the buffers does not need any
change as arrays act like pointers syntactically.  All manipulation code
however needs to be updates, which the patch supposed does.  Still, there
seems to be bugs remaining as cairo-perf quits with a Bad X Request error
with this patch.
2007-03-13 05:14:18 -04:00
Carl Worth
bc7072064e cairo-path-fixed: Don't add redundant, succesive MOVE_TO operations to the path
Instead, we can simply tweak the argument value for the last
MOVE_TO operation that's already at the end of the path.

This helps backends like pdf that are currently emitting all
of the redundant MOVE_TO operations in the output.
2007-01-17 16:24:00 -08:00
Carl Worth
ba531642f7 Add optimization for rectilinear stroke
This custom stroking code allows backends to use optimized region-based
drawing operations for rectilinear strokes. This results in a 5-25x
performance improvement when drawing rectilinear shapes:

image-rgb          box-outline-stroke-100 0.18 -> 0.01: 25.58x speedup
████████████████████████▋
image-rgba         box-outline-stroke-100 0.18 -> 0.01: 25.57x speedup
████████████████████████▋
 xlib-rgb          box-outline-stroke-100 0.49 -> 0.06:  8.67x speedup
███████▋
 xlib-rgba         box-outline-stroke-100 0.22 -> 0.04:  5.39x speedup
████▍

In other words, using cairo_stroke instead of cairo_fill to draw the
same shape was 5-15x slower before, but is 1.2-2x faster now.
2006-12-22 17:59:20 -08:00
Carl Worth
13c143bb52 Rename cairo-path.c to cairo-path-fixed.c 2006-12-19 13:10:00 -08:00
Renamed from src/cairo-path.c (Browse further)