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 35... | Line 35... | ||
35 | */ |
35 | */ |
Line 36... | Line 36... | ||
36 | 36 | ||
Line 37... | Line 37... | ||
37 | #include "cairoint.h" |
37 | #include "cairoint.h" |
- | 38 | ||
38 | 39 | #include "cairo-private.h" |
|
39 | #include "cairo-private.h" |
40 | #include "cairo-backend-private.h" |
40 | #include "cairo-error-private.h" |
41 | #include "cairo-error-private.h" |
Line 41... | Line 42... | ||
41 | #include "cairo-path-private.h" |
42 | #include "cairo-path-private.h" |
Line 46... | Line 47... | ||
46 | * @Title: Paths |
47 | * @Title: Paths |
47 | * @Short_Description: Creating paths and manipulating path data |
48 | * @Short_Description: Creating paths and manipulating path data |
48 | * |
49 | * |
49 | * Paths are the most basic drawing tools and are primarily used to implicitly |
50 | * Paths are the most basic drawing tools and are primarily used to implicitly |
50 | * generate simple masks. |
51 | * generate simple masks. |
51 | */ |
52 | **/ |
Line 52... | Line 53... | ||
52 | 53 | ||
Line 53... | Line 54... | ||
53 | static const cairo_path_t _cairo_path_nil = { CAIRO_STATUS_NO_MEMORY, NULL, 0 }; |
54 | static const cairo_path_t _cairo_path_nil = { CAIRO_STATUS_NO_MEMORY, NULL, 0 }; |
54 | 55 | ||
55 | /* Closure for path interpretation. */ |
56 | /* Closure for path interpretation. */ |
56 | typedef struct cairo_path_count { |
- | |
57 | int count; |
57 | typedef struct cairo_path_count { |
Line 58... | Line 58... | ||
58 | cairo_point_t current_point; |
58 | int count; |
59 | } cpc_t; |
59 | } cpc_t; |
60 | 60 | ||
61 | static cairo_status_t |
61 | static cairo_status_t |
62 | _cpc_move_to (void *closure, |
62 | _cpc_move_to (void *closure, |
Line 63... | Line 63... | ||
63 | const cairo_point_t *point) |
63 | const cairo_point_t *point) |
Line 64... | Line -... | ||
64 | { |
- | |
65 | cpc_t *cpc = closure; |
- | |
66 | 64 | { |
|
67 | cpc->count += 2; |
65 | cpc_t *cpc = closure; |
Line 68... | Line 66... | ||
68 | 66 | ||
69 | cpc->current_point = *point; |
67 | cpc->count += 2; |
Line 77... | Line 75... | ||
77 | { |
75 | { |
78 | cpc_t *cpc = closure; |
76 | cpc_t *cpc = closure; |
Line 79... | Line 77... | ||
79 | 77 | ||
Line 80... | Line -... | ||
80 | cpc->count += 2; |
- | |
81 | - | ||
82 | cpc->current_point = *point; |
78 | cpc->count += 2; |
83 | 79 | ||
Line 84... | Line 80... | ||
84 | return CAIRO_STATUS_SUCCESS; |
80 | return CAIRO_STATUS_SUCCESS; |
85 | } |
81 | } |
Line 92... | Line 88... | ||
92 | { |
88 | { |
93 | cpc_t *cpc = closure; |
89 | cpc_t *cpc = closure; |
Line 94... | Line 90... | ||
94 | 90 | ||
Line 95... | Line -... | ||
95 | cpc->count += 4; |
- | |
96 | - | ||
97 | cpc->current_point = *p3; |
91 | cpc->count += 4; |
98 | 92 | ||
Line 99... | Line 93... | ||
99 | return CAIRO_STATUS_SUCCESS; |
93 | return CAIRO_STATUS_SUCCESS; |
100 | } |
94 | } |
Line 117... | Line 111... | ||
117 | { |
111 | { |
118 | cairo_status_t status; |
112 | cairo_status_t status; |
119 | cpc_t cpc; |
113 | cpc_t cpc; |
Line 120... | Line 114... | ||
120 | 114 | ||
121 | cpc.count = 0; |
- | |
122 | cpc.current_point.x = 0; |
- | |
Line 123... | Line 115... | ||
123 | cpc.current_point.y = 0; |
115 | cpc.count = 0; |
124 | 116 | ||
125 | if (flatten) { |
- | |
126 | status = _cairo_path_fixed_interpret_flat (path_fixed, |
117 | if (flatten) { |
127 | CAIRO_DIRECTION_FORWARD, |
118 | status = _cairo_path_fixed_interpret_flat (path_fixed, |
128 | _cpc_move_to, |
119 | _cpc_move_to, |
129 | _cpc_line_to, |
120 | _cpc_line_to, |
130 | _cpc_close_path, |
121 | _cpc_close_path, |
131 | &cpc, |
122 | &cpc, |
132 | tolerance); |
123 | tolerance); |
133 | } else { |
- | |
134 | status = _cairo_path_fixed_interpret (path_fixed, |
124 | } else { |
135 | CAIRO_DIRECTION_FORWARD, |
125 | status = _cairo_path_fixed_interpret (path_fixed, |
136 | _cpc_move_to, |
126 | _cpc_move_to, |
137 | _cpc_line_to, |
127 | _cpc_line_to, |
138 | _cpc_curve_to, |
128 | _cpc_curve_to, |
Line 147... | Line 137... | ||
147 | } |
137 | } |
Line 148... | Line 138... | ||
148 | 138 | ||
149 | /* Closure for path interpretation. */ |
139 | /* Closure for path interpretation. */ |
150 | typedef struct cairo_path_populate { |
140 | typedef struct cairo_path_populate { |
151 | cairo_path_data_t *data; |
141 | cairo_path_data_t *data; |
152 | cairo_gstate_t *gstate; |
- | |
153 | cairo_point_t current_point; |
142 | cairo_t *cr; |
Line 154... | Line 143... | ||
154 | } cpp_t; |
143 | } cpp_t; |
155 | 144 | ||
156 | static cairo_status_t |
145 | static cairo_status_t |
Line 162... | Line 151... | ||
162 | double x, y; |
151 | double x, y; |
Line 163... | Line 152... | ||
163 | 152 | ||
164 | x = _cairo_fixed_to_double (point->x); |
153 | x = _cairo_fixed_to_double (point->x); |
Line 165... | Line 154... | ||
165 | y = _cairo_fixed_to_double (point->y); |
154 | y = _cairo_fixed_to_double (point->y); |
Line 166... | Line 155... | ||
166 | 155 | ||
167 | _cairo_gstate_backend_to_user (cpp->gstate, &x, &y); |
156 | _cairo_backend_to_user (cpp->cr, &x, &y); |
Line 168... | Line 157... | ||
168 | 157 | ||
169 | data->header.type = CAIRO_PATH_MOVE_TO; |
158 | data->header.type = CAIRO_PATH_MOVE_TO; |
170 | data->header.length = 2; |
159 | data->header.length = 2; |
Line 171... | Line 160... | ||
171 | 160 | ||
Line 172... | Line -... | ||
172 | /* We index from 1 to leave room for data->header */ |
- | |
173 | data[1].point.x = x; |
- | |
174 | data[1].point.y = y; |
161 | /* We index from 1 to leave room for data->header */ |
175 | 162 | data[1].point.x = x; |
|
Line 176... | Line 163... | ||
176 | cpp->data += data->header.length; |
163 | data[1].point.y = y; |
177 | 164 | ||
Line 189... | Line 176... | ||
189 | double x, y; |
176 | double x, y; |
Line 190... | Line 177... | ||
190 | 177 | ||
191 | x = _cairo_fixed_to_double (point->x); |
178 | x = _cairo_fixed_to_double (point->x); |
Line 192... | Line 179... | ||
192 | y = _cairo_fixed_to_double (point->y); |
179 | y = _cairo_fixed_to_double (point->y); |
Line 193... | Line 180... | ||
193 | 180 | ||
194 | _cairo_gstate_backend_to_user (cpp->gstate, &x, &y); |
181 | _cairo_backend_to_user (cpp->cr, &x, &y); |
Line 195... | Line 182... | ||
195 | 182 | ||
196 | data->header.type = CAIRO_PATH_LINE_TO; |
183 | data->header.type = CAIRO_PATH_LINE_TO; |
197 | data->header.length = 2; |
184 | data->header.length = 2; |
Line 198... | Line 185... | ||
198 | 185 | ||
Line 199... | Line -... | ||
199 | /* We index from 1 to leave room for data->header */ |
- | |
200 | data[1].point.x = x; |
- | |
201 | data[1].point.y = y; |
186 | /* We index from 1 to leave room for data->header */ |
202 | 187 | data[1].point.x = x; |
|
Line 203... | Line 188... | ||
203 | cpp->data += data->header.length; |
188 | data[1].point.y = y; |
204 | 189 | ||
Line 219... | Line 204... | ||
219 | double x2, y2; |
204 | double x2, y2; |
220 | double x3, y3; |
205 | double x3, y3; |
Line 221... | Line 206... | ||
221 | 206 | ||
222 | x1 = _cairo_fixed_to_double (p1->x); |
207 | x1 = _cairo_fixed_to_double (p1->x); |
223 | y1 = _cairo_fixed_to_double (p1->y); |
208 | y1 = _cairo_fixed_to_double (p1->y); |
Line 224... | Line 209... | ||
224 | _cairo_gstate_backend_to_user (cpp->gstate, &x1, &y1); |
209 | _cairo_backend_to_user (cpp->cr, &x1, &y1); |
225 | 210 | ||
226 | x2 = _cairo_fixed_to_double (p2->x); |
211 | x2 = _cairo_fixed_to_double (p2->x); |
Line 227... | Line 212... | ||
227 | y2 = _cairo_fixed_to_double (p2->y); |
212 | y2 = _cairo_fixed_to_double (p2->y); |
228 | _cairo_gstate_backend_to_user (cpp->gstate, &x2, &y2); |
213 | _cairo_backend_to_user (cpp->cr, &x2, &y2); |
229 | 214 | ||
Line 230... | Line 215... | ||
230 | x3 = _cairo_fixed_to_double (p3->x); |
215 | x3 = _cairo_fixed_to_double (p3->x); |
231 | y3 = _cairo_fixed_to_double (p3->y); |
216 | y3 = _cairo_fixed_to_double (p3->y); |
Line 232... | Line 217... | ||
232 | _cairo_gstate_backend_to_user (cpp->gstate, &x3, &y3); |
217 | _cairo_backend_to_user (cpp->cr, &x3, &y3); |
Line 244... | Line 229... | ||
244 | data[3].point.x = x3; |
229 | data[3].point.x = x3; |
245 | data[3].point.y = y3; |
230 | data[3].point.y = y3; |
Line 246... | Line 231... | ||
246 | 231 | ||
Line 247... | Line -... | ||
247 | cpp->data += data->header.length; |
- | |
248 | - | ||
249 | cpp->current_point = *p3; |
232 | cpp->data += data->header.length; |
250 | 233 | ||
Line 251... | Line 234... | ||
251 | return CAIRO_STATUS_SUCCESS; |
234 | return CAIRO_STATUS_SUCCESS; |
252 | } |
235 | } |
Line 266... | Line 249... | ||
266 | } |
249 | } |
Line 267... | Line 250... | ||
267 | 250 | ||
268 | static cairo_status_t |
251 | static cairo_status_t |
269 | _cairo_path_populate (cairo_path_t *path, |
252 | _cairo_path_populate (cairo_path_t *path, |
270 | cairo_path_fixed_t *path_fixed, |
253 | cairo_path_fixed_t *path_fixed, |
271 | cairo_gstate_t *gstate, |
254 | cairo_t *cr, |
272 | cairo_bool_t flatten) |
255 | cairo_bool_t flatten) |
273 | { |
256 | { |
274 | cairo_status_t status; |
257 | cairo_status_t status; |
Line 275... | Line 258... | ||
275 | cpp_t cpp; |
258 | cpp_t cpp; |
276 | 259 | ||
277 | cpp.data = path->data; |
- | |
278 | cpp.gstate = gstate; |
- | |
Line 279... | Line 260... | ||
279 | cpp.current_point.x = 0; |
260 | cpp.data = path->data; |
280 | cpp.current_point.y = 0; |
- | |
281 | 261 | cpp.cr = cr; |
|
282 | if (flatten) { |
- | |
283 | double tolerance = _cairo_gstate_get_tolerance (gstate); |
262 | |
284 | status = _cairo_path_fixed_interpret_flat (path_fixed, |
263 | if (flatten) { |
285 | CAIRO_DIRECTION_FORWARD, |
264 | status = _cairo_path_fixed_interpret_flat (path_fixed, |
286 | _cpp_move_to, |
265 | _cpp_move_to, |
287 | _cpp_line_to, |
266 | _cpp_line_to, |
288 | _cpp_close_path, |
267 | _cpp_close_path, |
289 | &cpp, |
268 | &cpp, |
290 | tolerance); |
- | |
291 | } else { |
269 | cairo_get_tolerance (cr)); |
292 | status = _cairo_path_fixed_interpret (path_fixed, |
270 | } else { |
293 | CAIRO_DIRECTION_FORWARD, |
271 | status = _cairo_path_fixed_interpret (path_fixed, |
294 | _cpp_move_to, |
272 | _cpp_move_to, |
295 | _cpp_line_to, |
273 | _cpp_line_to, |
Line 329... | Line 307... | ||
329 | return path; |
307 | return path; |
330 | } |
308 | } |
Line 331... | Line 309... | ||
331 | 309 | ||
332 | static cairo_path_t * |
310 | static cairo_path_t * |
333 | _cairo_path_create_internal (cairo_path_fixed_t *path_fixed, |
311 | _cairo_path_create_internal (cairo_path_fixed_t *path_fixed, |
334 | cairo_gstate_t *gstate, |
312 | cairo_t *cr, |
335 | cairo_bool_t flatten) |
313 | cairo_bool_t flatten) |
336 | { |
314 | { |
Line 337... | Line 315... | ||
337 | cairo_path_t *path; |
315 | cairo_path_t *path; |
Line 341... | Line 319... | ||
341 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
319 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
342 | return (cairo_path_t*) &_cairo_path_nil; |
320 | return (cairo_path_t*) &_cairo_path_nil; |
343 | } |
321 | } |
Line 344... | Line 322... | ||
344 | 322 | ||
345 | path->num_data = _cairo_path_count (path, path_fixed, |
323 | path->num_data = _cairo_path_count (path, path_fixed, |
346 | _cairo_gstate_get_tolerance (gstate), |
324 | cairo_get_tolerance (cr), |
347 | flatten); |
325 | flatten); |
348 | if (path->num_data < 0) { |
326 | if (path->num_data < 0) { |
349 | free (path); |
327 | free (path); |
350 | return (cairo_path_t*) &_cairo_path_nil; |
328 | return (cairo_path_t*) &_cairo_path_nil; |
Line 357... | Line 335... | ||
357 | free (path); |
335 | free (path); |
358 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
336 | _cairo_error_throw (CAIRO_STATUS_NO_MEMORY); |
359 | return (cairo_path_t*) &_cairo_path_nil; |
337 | return (cairo_path_t*) &_cairo_path_nil; |
360 | } |
338 | } |
Line 361... | Line 339... | ||
361 | 339 | ||
362 | path->status = _cairo_path_populate (path, path_fixed, |
- | |
363 | gstate, flatten); |
340 | path->status = _cairo_path_populate (path, path_fixed, cr, flatten); |
364 | } else { |
341 | } else { |
365 | path->data = NULL; |
342 | path->data = NULL; |
366 | path->status = CAIRO_STATUS_SUCCESS; |
343 | path->status = CAIRO_STATUS_SUCCESS; |
Line 380... | Line 357... | ||
380 | * |
357 | * |
381 | * Note: cairo_path_destroy() should only be called with a |
358 | * Note: cairo_path_destroy() should only be called with a |
382 | * pointer to a #cairo_path_t returned by a cairo function. Any path |
359 | * pointer to a #cairo_path_t returned by a cairo function. Any path |
383 | * that is created manually (ie. outside of cairo) should be destroyed |
360 | * that is created manually (ie. outside of cairo) should be destroyed |
384 | * manually as well. |
361 | * manually as well. |
- | 362 | * |
|
- | 363 | * Since: 1.0 |
|
385 | **/ |
364 | **/ |
386 | void |
365 | void |
387 | cairo_path_destroy (cairo_path_t *path) |
366 | cairo_path_destroy (cairo_path_t *path) |
388 | { |
367 | { |
389 | if (path == NULL || path == &_cairo_path_nil) |
368 | if (path == NULL || path == &_cairo_path_nil) |
390 | return; |
369 | return; |
Line 391... | Line -... | ||
391 | - | ||
392 | if (path->data) |
370 | |
Line 393... | Line 371... | ||
393 | free (path->data); |
371 | free (path->data); |
394 | 372 | ||
- | 373 | free (path); |
|
Line 395... | Line 374... | ||
395 | free (path); |
374 | } |
396 | } |
375 | slim_hidden_def (cairo_path_destroy); |
397 | 376 | ||
398 | /** |
377 | /** |
399 | * _cairo_path_create: |
378 | * _cairo_path_create: |
400 | * @path: a fixed-point, device-space path to be converted and copied |
379 | * @path: a fixed-point, device-space path to be converted and copied |
401 | * @gstate: the current graphics state |
380 | * @cr: the current graphics context |
402 | * |
381 | * |
403 | * Creates a user-space #cairo_path_t copy of the given device-space |
382 | * Creates a user-space #cairo_path_t copy of the given device-space |
404 | * @path. The @gstate parameter provides the inverse CTM for the |
383 | * @path. The @cr parameter provides the inverse CTM for the |
405 | * conversion. |
384 | * conversion. |
406 | * |
385 | * |
407 | * Return value: the new copy of the path. If there is insufficient |
386 | * Return value: the new copy of the path. If there is insufficient |
408 | * memory a pointer to a special static nil #cairo_path_t will be |
387 | * memory a pointer to a special static nil #cairo_path_t will be |
409 | * returned instead with status==%CAIRO_STATUS_NO_MEMORY and |
388 | * returned instead with status==%CAIRO_STATUS_NO_MEMORY and |
410 | * data==%NULL. |
389 | * data==%NULL. |
411 | **/ |
390 | **/ |
412 | cairo_path_t * |
391 | cairo_path_t * |
413 | _cairo_path_create (cairo_path_fixed_t *path, |
392 | _cairo_path_create (cairo_path_fixed_t *path, |
414 | cairo_gstate_t *gstate) |
393 | cairo_t *cr) |
Line 415... | Line 394... | ||
415 | { |
394 | { |
416 | return _cairo_path_create_internal (path, gstate, FALSE); |
395 | return _cairo_path_create_internal (path, cr, FALSE); |
417 | } |
396 | } |
418 | 397 | ||
419 | /** |
398 | /** |
420 | * _cairo_path_create_flat: |
399 | * _cairo_path_create_flat: |
421 | * @path: a fixed-point, device-space path to be flattened, converted and copied |
400 | * @path: a fixed-point, device-space path to be flattened, converted and copied |
422 | * @gstate: the current graphics state |
401 | * @cr: the current graphics context |
423 | * |
402 | * |
424 | * Creates a flattened, user-space #cairo_path_t copy of the given |
403 | * Creates a flattened, user-space #cairo_path_t copy of the given |
425 | * device-space @path. The @gstate parameter provide the inverse CTM |
404 | * device-space @path. The @cr parameter provide the inverse CTM |
426 | * for the conversion, as well as the tolerance value to control the |
405 | * for the conversion, as well as the tolerance value to control the |
427 | * accuracy of the flattening. |
406 | * accuracy of the flattening. |
428 | * |
407 | * |
429 | * Return value: the flattened copy of the path. If there is insufficient |
408 | * Return value: the flattened copy of the path. If there is insufficient |
430 | * memory a pointer to a special static nil #cairo_path_t will be |
409 | * memory a pointer to a special static nil #cairo_path_t will be |
431 | * returned instead with status==%CAIRO_STATUS_NO_MEMORY and |
410 | * returned instead with status==%CAIRO_STATUS_NO_MEMORY and |
432 | * data==%NULL. |
411 | * data==%NULL. |
433 | **/ |
412 | **/ |
434 | cairo_path_t * |
413 | cairo_path_t * |
435 | _cairo_path_create_flat (cairo_path_fixed_t *path, |
414 | _cairo_path_create_flat (cairo_path_fixed_t *path, |
Line 436... | Line 415... | ||
436 | cairo_gstate_t *gstate) |
415 | cairo_t *cr) |
437 | { |
416 | { |
438 | return _cairo_path_create_internal (path, gstate, TRUE); |
417 | return _cairo_path_create_internal (path, cr, TRUE); |
Line 451... | Line 430... | ||
451 | cairo_status_t |
430 | cairo_status_t |
452 | _cairo_path_append_to_context (const cairo_path_t *path, |
431 | _cairo_path_append_to_context (const cairo_path_t *path, |
453 | cairo_t *cr) |
432 | cairo_t *cr) |
454 | { |
433 | { |
455 | const cairo_path_data_t *p, *end; |
434 | const cairo_path_data_t *p, *end; |
456 | cairo_fixed_t x1_fixed, y1_fixed; |
- | |
457 | cairo_fixed_t x2_fixed, y2_fixed; |
- | |
458 | cairo_fixed_t x3_fixed, y3_fixed; |
- | |
459 | cairo_matrix_t user_to_backend; |
- | |
460 | cairo_status_t status; |
- | |
461 | double x, y; |
- | |
462 | - | ||
463 | user_to_backend = cr->gstate->ctm; |
- | |
464 | cairo_matrix_multiply (&user_to_backend, |
- | |
465 | &user_to_backend, |
- | |
466 | &cr->gstate->target->device_transform); |
- | |
Line 467... | Line 435... | ||
467 | 435 | ||
468 | end = &path->data[path->num_data]; |
436 | end = &path->data[path->num_data]; |
469 | for (p = &path->data[0]; p < end; p += p->header.length) { |
437 | for (p = &path->data[0]; p < end; p += p->header.length) { |
470 | switch (p->header.type) { |
438 | switch (p->header.type) { |
471 | case CAIRO_PATH_MOVE_TO: |
439 | case CAIRO_PATH_MOVE_TO: |
472 | if (unlikely (p->header.length < 2)) |
440 | if (unlikely (p->header.length < 2)) |
Line 473... | Line 441... | ||
473 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
441 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
474 | - | ||
475 | x = p[1].point.x, y = p[1].point.y; |
- | |
476 | cairo_matrix_transform_point (&user_to_backend, &x, &y); |
- | |
477 | x1_fixed = _cairo_fixed_from_double (x); |
- | |
478 | y1_fixed = _cairo_fixed_from_double (y); |
- | |
479 | 442 | ||
Line 480... | Line 443... | ||
480 | status = _cairo_path_fixed_move_to (cr->path, x1_fixed, y1_fixed); |
443 | cairo_move_to (cr, p[1].point.x, p[1].point.y); |
481 | break; |
444 | break; |
482 | 445 | ||
Line 483... | Line 446... | ||
483 | case CAIRO_PATH_LINE_TO: |
446 | case CAIRO_PATH_LINE_TO: |
484 | if (unlikely (p->header.length < 2)) |
- | |
485 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
- | |
486 | - | ||
487 | x = p[1].point.x, y = p[1].point.y; |
- | |
488 | cairo_matrix_transform_point (&user_to_backend, &x, &y); |
- | |
489 | x1_fixed = _cairo_fixed_from_double (x); |
447 | if (unlikely (p->header.length < 2)) |
Line 490... | Line 448... | ||
490 | y1_fixed = _cairo_fixed_from_double (y); |
448 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
491 | 449 | ||
492 | status = _cairo_path_fixed_line_to (cr->path, x1_fixed, y1_fixed); |
450 | cairo_line_to (cr, p[1].point.x, p[1].point.y); |
Line 493... | Line -... | ||
493 | break; |
- | |
494 | - | ||
495 | case CAIRO_PATH_CURVE_TO: |
- | |
496 | if (unlikely (p->header.length < 4)) |
451 | break; |
497 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
- | |
498 | 452 | ||
499 | x = p[1].point.x, y = p[1].point.y; |
- | |
500 | cairo_matrix_transform_point (&user_to_backend, &x, &y); |
- | |
501 | x1_fixed = _cairo_fixed_from_double (x); |
- | |
502 | y1_fixed = _cairo_fixed_from_double (y); |
- | |
503 | 453 | case CAIRO_PATH_CURVE_TO: |
|
504 | x = p[2].point.x, y = p[2].point.y; |
- | |
505 | cairo_matrix_transform_point (&user_to_backend, &x, &y); |
- | |
506 | x2_fixed = _cairo_fixed_from_double (x); |
- | |
507 | y2_fixed = _cairo_fixed_from_double (y); |
- | |
508 | - | ||
509 | x = p[3].point.x, y = p[3].point.y; |
- | |
510 | cairo_matrix_transform_point (&user_to_backend, &x, &y); |
- | |
511 | x3_fixed = _cairo_fixed_from_double (x); |
454 | if (unlikely (p->header.length < 4)) |
512 | y3_fixed = _cairo_fixed_from_double (y); |
455 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
Line 513... | Line 456... | ||
513 | 456 | ||
514 | status = _cairo_path_fixed_curve_to (cr->path, |
457 | cairo_curve_to (cr, |
515 | x1_fixed, y1_fixed, |
458 | p[1].point.x, p[1].point.y, |
Line 516... | Line 459... | ||
516 | x2_fixed, y2_fixed, |
459 | p[2].point.x, p[2].point.y, |
517 | x3_fixed, y3_fixed); |
460 | p[3].point.x, p[3].point.y); |
Line 518... | Line 461... | ||
518 | break; |
461 | break; |
519 | 462 | ||
520 | case CAIRO_PATH_CLOSE_PATH: |
463 | case CAIRO_PATH_CLOSE_PATH: |
Line 521... | Line 464... | ||
521 | if (unlikely (p->header.length < 1)) |
464 | if (unlikely (p->header.length < 1)) |
522 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
465 | return _cairo_error (CAIRO_STATUS_INVALID_PATH_DATA); |
523 | 466 | ||
Line 524... | Line 467... | ||
524 | status = _cairo_path_fixed_close_path (cr->path); |
467 | cairo_close_path (cr); |
525 | break; |
468 | break; |