diff options
Diffstat (limited to 'src/cairo-path-fixed-private.h')
-rw-r--r-- | src/cairo-path-fixed-private.h | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/src/cairo-path-fixed-private.h b/src/cairo-path-fixed-private.h index 42e64ed..e24b1c7 100644 --- a/src/cairo-path-fixed-private.h +++ b/src/cairo-path-fixed-private.h @@ -77,15 +77,24 @@ typedef struct _cairo_path_buf_fixed { cairo_point_t points[2 * CAIRO_PATH_BUF_SIZE]; } cairo_path_buf_fixed_t; +/* + NOTES: + has_curve_to => !stroke_is_rectilinear + fill_is_rectilinear => stroke_is_rectilinear + fill_is_empty => fill_is_rectilinear + fill_maybe_region => fill_is_rectilinear +*/ struct _cairo_path_fixed { cairo_point_t last_move_point; cairo_point_t current_point; unsigned int has_current_point : 1; - unsigned int has_last_move_point : 1; + unsigned int needs_move_to : 1; + unsigned int has_extents : 1; unsigned int has_curve_to : 1; - unsigned int is_rectilinear : 1; - unsigned int maybe_fill_region : 1; - unsigned int is_empty_fill : 1; + unsigned int stroke_is_rectilinear : 1; + unsigned int fill_is_rectilinear : 1; + unsigned int fill_maybe_region : 1; + unsigned int fill_is_empty : 1; cairo_box_t extents; @@ -100,7 +109,6 @@ _cairo_path_fixed_translate (cairo_path_fixed_t *path, cairo_private cairo_status_t _cairo_path_fixed_append (cairo_path_fixed_t *path, const cairo_path_fixed_t *other, - cairo_direction_t dir, cairo_fixed_t tx, cairo_fixed_t ty); @@ -135,16 +143,16 @@ _cairo_path_fixed_iter_at_end (const cairo_path_fixed_iter_t *iter); static inline cairo_bool_t _cairo_path_fixed_fill_is_empty (const cairo_path_fixed_t *path) { - return path->is_empty_fill; + return path->fill_is_empty; } static inline cairo_bool_t -_cairo_path_fixed_is_rectilinear_fill (const cairo_path_fixed_t *path) +_cairo_path_fixed_fill_is_rectilinear (const cairo_path_fixed_t *path) { - if (! path->is_rectilinear) + if (! path->fill_is_rectilinear) return 0; - if (! path->has_current_point) + if (! path->has_current_point || path->needs_move_to) return 1; /* check whether the implicit close preserves the rectilinear property */ @@ -153,13 +161,25 @@ _cairo_path_fixed_is_rectilinear_fill (const cairo_path_fixed_t *path) } static inline cairo_bool_t -_cairo_path_fixed_maybe_fill_region (const cairo_path_fixed_t *path) +_cairo_path_fixed_stroke_is_rectilinear (const cairo_path_fixed_t *path) { -#if WATCH_PATH - fprintf (stderr, "_cairo_path_fixed_maybe_fill_region () = %s\n", - path->maybe_fill_region ? "true" : "false"); -#endif - return path->maybe_fill_region; + return path->stroke_is_rectilinear; +} + +static inline cairo_bool_t +_cairo_path_fixed_fill_maybe_region (const cairo_path_fixed_t *path) +{ + if (! path->fill_maybe_region) + return 0; + + if (! path->has_current_point || path->needs_move_to) + return 1; + + /* check whether the implicit close preserves the rectilinear property + * (the integer point property is automatically preserved) + */ + return path->current_point.x == path->last_move_point.x || + path->current_point.y == path->last_move_point.y; } #endif /* CAIRO_PATH_FIXED_PRIVATE_H */ |