Rev 1892 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1892 | Rev 3959 | ||
---|---|---|---|
Line 57... | Line 57... | ||
57 | 57 | ||
58 | /* make _cairo_path_fixed fit into ~512 bytes -- about 50 items */ |
58 | /* make _cairo_path_fixed fit into ~512 bytes -- about 50 items */ |
59 | #define CAIRO_PATH_BUF_SIZE ((512 - sizeof (cairo_path_buf_t)) \ |
59 | #define CAIRO_PATH_BUF_SIZE ((512 - sizeof (cairo_path_buf_t)) \ |
Line -... | Line 60... | ||
- | 60 | / (2 * sizeof (cairo_point_t) + sizeof (cairo_path_op_t))) |
|
- | 61 | ||
- | 62 | #define cairo_path_head(path__) (&(path__)->buf.base) |
|
- | 63 | #define cairo_path_tail(path__) cairo_path_buf_prev (cairo_path_head (path__)) |
|
- | 64 | ||
- | 65 | #define cairo_path_buf_next(pos__) \ |
|
- | 66 | cairo_list_entry ((pos__)->link.next, cairo_path_buf_t, link) |
|
- | 67 | #define cairo_path_buf_prev(pos__) \ |
|
- | 68 | cairo_list_entry ((pos__)->link.prev, cairo_path_buf_t, link) |
|
- | 69 | ||
- | 70 | #define cairo_path_foreach_buf_start(pos__, path__) \ |
|
- | 71 | pos__ = cairo_path_head (path__); do |
|
- | 72 | #define cairo_path_foreach_buf_end(pos__, path__) \ |
|
- | 73 | while ((pos__ = cairo_path_buf_next (pos__)) != cairo_path_head (path__)) |
|
60 | / (2 * sizeof (cairo_point_t) + sizeof (cairo_path_op_t))) |
74 | |
61 | 75 | ||
62 | typedef struct _cairo_path_buf { |
76 | typedef struct _cairo_path_buf { |
63 | cairo_list_t link; |
77 | cairo_list_t link; |
64 | unsigned int num_ops; |
78 | unsigned int num_ops; |
Line 75... | Line 89... | ||
75 | 89 | ||
76 | cairo_path_op_t op[CAIRO_PATH_BUF_SIZE]; |
90 | cairo_path_op_t op[CAIRO_PATH_BUF_SIZE]; |
77 | cairo_point_t points[2 * CAIRO_PATH_BUF_SIZE]; |
91 | cairo_point_t points[2 * CAIRO_PATH_BUF_SIZE]; |
Line -... | Line 92... | ||
- | 92 | } cairo_path_buf_fixed_t; |
|
- | 93 | ||
- | 94 | /* |
|
- | 95 | NOTES: |
|
- | 96 | has_curve_to => !stroke_is_rectilinear |
|
- | 97 | fill_is_rectilinear => stroke_is_rectilinear |
|
- | 98 | fill_is_empty => fill_is_rectilinear |
|
78 | } cairo_path_buf_fixed_t; |
99 | fill_maybe_region => fill_is_rectilinear |
79 | 100 | */ |
|
80 | struct _cairo_path_fixed { |
101 | struct _cairo_path_fixed { |
81 | cairo_point_t last_move_point; |
102 | cairo_point_t last_move_point; |
82 | cairo_point_t current_point; |
103 | cairo_point_t current_point; |
- | 104 | unsigned int has_current_point : 1; |
|
83 | unsigned int has_current_point : 1; |
105 | unsigned int needs_move_to : 1; |
- | 106 | unsigned int has_extents : 1; |
|
84 | unsigned int has_last_move_point : 1; |
107 | unsigned int has_curve_to : 1; |
85 | unsigned int has_curve_to : 1; |
108 | unsigned int stroke_is_rectilinear : 1; |
86 | unsigned int is_rectilinear : 1; |
109 | unsigned int fill_is_rectilinear : 1; |
Line 87... | Line 110... | ||
87 | unsigned int maybe_fill_region : 1; |
110 | unsigned int fill_maybe_region : 1; |
Line 88... | Line 111... | ||
88 | unsigned int is_empty_fill : 1; |
111 | unsigned int fill_is_empty : 1; |
89 | 112 | ||
Line 98... | Line 121... | ||
98 | cairo_fixed_t offy); |
121 | cairo_fixed_t offy); |
Line 99... | Line 122... | ||
99 | 122 | ||
100 | cairo_private cairo_status_t |
123 | cairo_private cairo_status_t |
101 | _cairo_path_fixed_append (cairo_path_fixed_t *path, |
124 | _cairo_path_fixed_append (cairo_path_fixed_t *path, |
102 | const cairo_path_fixed_t *other, |
- | |
103 | cairo_direction_t dir, |
125 | const cairo_path_fixed_t *other, |
104 | cairo_fixed_t tx, |
126 | cairo_fixed_t tx, |
Line 105... | Line 127... | ||
105 | cairo_fixed_t ty); |
127 | cairo_fixed_t ty); |
106 | 128 | ||
Line 133... | Line 155... | ||
133 | _cairo_path_fixed_iter_at_end (const cairo_path_fixed_iter_t *iter); |
155 | _cairo_path_fixed_iter_at_end (const cairo_path_fixed_iter_t *iter); |
Line 134... | Line 156... | ||
134 | 156 | ||
135 | static inline cairo_bool_t |
157 | static inline cairo_bool_t |
136 | _cairo_path_fixed_fill_is_empty (const cairo_path_fixed_t *path) |
158 | _cairo_path_fixed_fill_is_empty (const cairo_path_fixed_t *path) |
137 | { |
159 | { |
138 | return path->is_empty_fill; |
160 | return path->fill_is_empty; |
Line 139... | Line 161... | ||
139 | } |
161 | } |
140 | 162 | ||
141 | static inline cairo_bool_t |
163 | static inline cairo_bool_t |
142 | _cairo_path_fixed_is_rectilinear_fill (const cairo_path_fixed_t *path) |
164 | _cairo_path_fixed_fill_is_rectilinear (const cairo_path_fixed_t *path) |
143 | { |
165 | { |
Line 144... | Line 166... | ||
144 | if (! path->is_rectilinear) |
166 | if (! path->fill_is_rectilinear) |
145 | return 0; |
167 | return 0; |
Line 146... | Line 168... | ||
146 | 168 | ||
147 | if (! path->has_current_point) |
169 | if (! path->has_current_point || path->needs_move_to) |
148 | return 1; |
170 | return 1; |
149 | 171 | ||
Line 150... | Line 172... | ||
150 | /* check whether the implicit close preserves the rectilinear property */ |
172 | /* check whether the implicit close preserves the rectilinear property */ |
151 | return path->current_point.x == path->last_move_point.x || |
173 | return path->current_point.x == path->last_move_point.x || |
152 | path->current_point.y == path->last_move_point.y; |
174 | path->current_point.y == path->last_move_point.y; |
- | 175 | } |
|
- | 176 | ||
- | 177 | static inline cairo_bool_t |
|
153 | } |
178 | _cairo_path_fixed_stroke_is_rectilinear (const cairo_path_fixed_t *path) |
- | 179 | { |
|
- | 180 | return path->stroke_is_rectilinear; |
|
154 | 181 | } |
|
- | 182 | ||
- | 183 | static inline cairo_bool_t |
|
155 | static inline cairo_bool_t |
184 | _cairo_path_fixed_fill_maybe_region (const cairo_path_fixed_t *path) |
156 | _cairo_path_fixed_maybe_fill_region (const cairo_path_fixed_t *path) |
185 | { |
- | 186 | if (! path->fill_maybe_region) |
|
- | 187 | return 0; |
|
- | 188 | ||
- | 189 | if (! path->has_current_point || path->needs_move_to) |
|
157 | { |
190 | return 1; |
- | 191 | ||
158 | #if WATCH_PATH |
192 | /* check whether the implicit close preserves the rectilinear property |
Line -... | Line 193... | ||
- | 193 | * (the integer point property is automatically preserved) |
|
- | 194 | */ |
|
- | 195 | return path->current_point.x == path->last_move_point.x || |
|
- | 196 | path->current_point.y == path->last_move_point.y; |
|
- | 197 | } |
|
- | 198 | ||
- | 199 | cairo_private cairo_bool_t |
|
159 | fprintf (stderr, "_cairo_path_fixed_maybe_fill_region () = %s\n", |
200 | _cairo_path_fixed_is_stroke_box (const cairo_path_fixed_t *path, |