[cairo-path-fixed] Fine-tune size of buffer

such that cairo_path_fixed_t fits in 512 bytes.
This commit is contained in:
Behdad Esfahbod 2007-03-08 16:52:09 -05:00
parent 1bd073a1a2
commit 85aff353ca
2 changed files with 8 additions and 6 deletions

View file

@ -44,7 +44,9 @@ typedef enum cairo_path_op {
} __attribute__ ((packed)) cairo_path_op_t; /* Don't want 32 bits if we can avoid it. */
/* XXX Shall we just not use char instead of hoping for __attribute__ working? */
#define CAIRO_PATH_BUF_SIZE 64
/* 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)))
typedef struct _cairo_path_buf {
struct _cairo_path_buf *next, *prev;
@ -57,13 +59,13 @@ typedef struct _cairo_path_buf {
} cairo_path_buf_t;
struct _cairo_path_fixed {
cairo_path_buf_t buf_head[1];
cairo_path_buf_t *buf_tail;
cairo_point_t last_move_point;
cairo_point_t current_point;
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];
};
#endif /* CAIRO_PATH_FIXED_PRIVATE_H */

View file

@ -49,11 +49,11 @@ static const cairo_t cairo_nil = {
CAIRO_STATUS_NO_MEMORY, /* status */
{ 0, 0, 0, NULL }, /* user_data */
{ /* path */
{0}, NULL, /* buf_head, buf_tail */
{ 0, 0 }, /* last_move_point */
{ 0, 0 }, /* current point */
FALSE, /* has_current_point */
FALSE /* has_curve_to */
FALSE, /* has_curve_to */
NULL, {0} /* buf_tail, buf_head */
},
NULL /* gstate */
};