mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-04 15:18:08 +02:00
[path] Carefully check for no more points.
As the empty path points to an embedded buf, we cannot rely on the buf pointer being NULL to mark end-of-path.
This commit is contained in:
parent
424aba9be5
commit
d2bcf1d76d
2 changed files with 17 additions and 8 deletions
|
|
@ -54,9 +54,9 @@ typedef char cairo_path_op_t;
|
|||
|
||||
typedef struct _cairo_path_buf {
|
||||
struct _cairo_path_buf *next, *prev;
|
||||
int buf_size;
|
||||
int num_ops;
|
||||
int num_points;
|
||||
unsigned int buf_size;
|
||||
unsigned int num_ops;
|
||||
unsigned int num_points;
|
||||
|
||||
cairo_path_op_t *op;
|
||||
cairo_point_t *points;
|
||||
|
|
@ -90,8 +90,8 @@ _cairo_path_fixed_equal (const cairo_path_fixed_t *a,
|
|||
|
||||
typedef struct _cairo_path_fixed_iter {
|
||||
cairo_path_buf_t *buf;
|
||||
int n_op;
|
||||
int n_point;
|
||||
unsigned int n_op;
|
||||
unsigned int n_point;
|
||||
} cairo_path_fixed_iter_t;
|
||||
|
||||
cairo_private void
|
||||
|
|
|
|||
|
|
@ -759,7 +759,7 @@ _cairo_path_fixed_offset_and_scale (cairo_path_fixed_t *path,
|
|||
cairo_fixed_t scaley)
|
||||
{
|
||||
cairo_path_buf_t *buf = &path->buf_head.base;
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
while (buf) {
|
||||
for (i = 0; i < buf->num_points; i++) {
|
||||
|
|
@ -790,7 +790,7 @@ _cairo_path_fixed_transform (cairo_path_fixed_t *path,
|
|||
cairo_matrix_t *matrix)
|
||||
{
|
||||
cairo_path_buf_t *buf;
|
||||
int i;
|
||||
unsigned int i;
|
||||
double dx, dy;
|
||||
|
||||
if (matrix->yx == 0.0 && matrix->xy == 0.0) {
|
||||
|
|
@ -1058,7 +1058,7 @@ _cairo_path_fixed_iter_init (cairo_path_fixed_iter_t *iter,
|
|||
static cairo_bool_t
|
||||
_cairo_path_fixed_iter_next_op (cairo_path_fixed_iter_t *iter)
|
||||
{
|
||||
if (++iter->n_op == iter->buf->num_ops) {
|
||||
if (++iter->n_op >= iter->buf->num_ops) {
|
||||
iter->buf = iter->buf->next;
|
||||
iter->n_op = 0;
|
||||
iter->n_point = 0;
|
||||
|
|
@ -1079,6 +1079,12 @@ _cairo_path_fixed_iter_is_box (cairo_path_fixed_iter_t *_iter,
|
|||
|
||||
iter = *_iter;
|
||||
|
||||
if (iter.n_op == iter.buf->num_ops &&
|
||||
! _cairo_path_fixed_iter_next_op (&iter))
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check whether the ops are those that would be used for a rectangle */
|
||||
if (iter.buf->op[iter.n_op] != CAIRO_PATH_OP_MOVE_TO)
|
||||
return FALSE;
|
||||
|
|
@ -1149,6 +1155,9 @@ _cairo_path_fixed_iter_at_end (const cairo_path_fixed_iter_t *iter)
|
|||
if (iter->buf == NULL)
|
||||
return TRUE;
|
||||
|
||||
if (iter->n_op == iter->buf->num_ops)
|
||||
return TRUE;
|
||||
|
||||
if (iter->buf->op[iter->n_op] == CAIRO_PATH_OP_MOVE_TO &&
|
||||
iter->buf->num_ops == iter->n_op + 1)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue