diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2007-11-04 11:55:25 +0000 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2007-11-05 08:51:06 +0000 |
commit | 901b0c97523a2da00ccf91cf4cee3bf55ce989b5 (patch) | |
tree | 16542921d7beafef312d5600d89b93be20ad4330 /src/cairo-path-fixed-private.h | |
parent | 92a18464bae40b19a26402eb2aa4950cac04c3a0 (diff) | |
download | cairo-901b0c97523a2da00ccf91cf4cee3bf55ce989b5.tar.gz |
[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.
Diffstat (limited to 'src/cairo-path-fixed-private.h')
-rw-r--r-- | src/cairo-path-fixed-private.h | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/cairo-path-fixed-private.h b/src/cairo-path-fixed-private.h index 6e1300abe..f506c3449 100644 --- a/src/cairo-path-fixed-private.h +++ b/src/cairo-path-fixed-private.h @@ -46,18 +46,24 @@ enum cairo_path_op { typedef char cairo_path_op_t; /* make cairo_path_fixed fit a 512 bytes. about 50 items */ -#define CAIRO_PATH_BUF_SIZE ((512 - 12 * sizeof (void*)) \ - / (sizeof (cairo_point_t) + sizeof (cairo_path_op_t))) +#define CAIRO_PATH_BUF_SIZE ((512 - 4 * sizeof (void*) - sizeof (cairo_path_buf_t)) \ + / (2 * sizeof (cairo_point_t) + sizeof (cairo_path_op_t))) typedef struct _cairo_path_buf { struct _cairo_path_buf *next, *prev; + int buf_size; int num_ops; int num_points; - cairo_path_op_t op[CAIRO_PATH_BUF_SIZE]; - cairo_point_t points[CAIRO_PATH_BUF_SIZE]; - + cairo_path_op_t *op; + cairo_point_t *points; } cairo_path_buf_t; +typedef struct _cairo_path_buf_fixed { + cairo_path_buf_t base; + + cairo_path_op_t op[CAIRO_PATH_BUF_SIZE]; + cairo_point_t points[2 * CAIRO_PATH_BUF_SIZE]; +} cairo_path_buf_fixed_t; struct _cairo_path_fixed { cairo_point_t last_move_point; @@ -65,8 +71,8 @@ struct _cairo_path_fixed { unsigned int has_current_point : 1; unsigned int has_curve_to : 1; - cairo_path_buf_t *buf_tail; - cairo_path_buf_t buf_head[1]; + cairo_path_buf_t *buf_tail; + cairo_path_buf_fixed_t buf_head; }; #endif /* CAIRO_PATH_FIXED_PRIVATE_H */ |