summaryrefslogtreecommitdiff
path: root/src/cairo-path.c
diff options
context:
space:
mode:
authorCarl Worth <cworth@cworth.org>2005-04-26 12:38:06 +0000
committerCarl Worth <cworth@cworth.org>2005-04-26 12:38:06 +0000
commit1baa4d132903e21395dc66ca792164e2ef8885d2 (patch)
tree4b95e9a13ee0b7bcab4a9f22d919e493376d16eb /src/cairo-path.c
parent618792c8c041ee2004acf1ff411e0adbe94a3e63 (diff)
downloadcairo-1baa4d132903e21395dc66ca792164e2ef8885d2.tar.gz
Originally: 2005-04-19 Carl Worth <cworth@cworth.org>
Add cairo_stroke_preserve, cairo_fill_preserve, and cairo_clip_preserve. Rip the path out of cairo_gstate_t. Add path to cairo_t. Bring in most of the path code that used to live in cairo-gstate.c Move arc generation code into its own file. Accept path+ctm_inverse+tolerance instead of gstate. Absorb flattening and device space->user space conversion that used to be in _cairo_gstate_intepret_path. Prefer cairo_fixed_t parameters over ciaro_point_t for cross-file interfaces. Track changes in _cairo_path_fixed interfaces. Port to use cairo_fill_preserve rather than cairo_save/cairo_restore which no longer work for saving the path. Remove get and set of current point since it is no longer affected by cairo_save and cairo_restore. Add get and set testing for cairo_matrix_t.
Diffstat (limited to 'src/cairo-path.c')
-rw-r--r--src/cairo-path.c93
1 files changed, 56 insertions, 37 deletions
diff --git a/src/cairo-path.c b/src/cairo-path.c
index 21125e0fc..53c2375c2 100644
--- a/src/cairo-path.c
+++ b/src/cairo-path.c
@@ -156,16 +156,21 @@ _cairo_path_fixed_fini (cairo_path_fixed_t *path)
}
cairo_status_t
-_cairo_path_fixed_move_to (cairo_path_fixed_t *path,
- cairo_point_t *point)
+_cairo_path_fixed_move_to (cairo_path_fixed_t *path,
+ cairo_fixed_t x,
+ cairo_fixed_t y)
{
cairo_status_t status;
+ cairo_point_t point;
+
+ point.x = x;
+ point.y = y;
- status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_MOVE_TO, point, 1);
+ status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_MOVE_TO, &point, 1);
if (status)
return status;
- path->current_point = *point;
+ path->current_point = point;
path->has_current_point = 1;
path->last_move_point = path->current_point;
@@ -174,27 +179,33 @@ _cairo_path_fixed_move_to (cairo_path_fixed_t *path,
cairo_status_t
_cairo_path_fixed_rel_move_to (cairo_path_fixed_t *path,
- cairo_distance_t *distance)
+ cairo_fixed_t dx,
+ cairo_fixed_t dy)
{
- cairo_point_t point;
+ cairo_fixed_t x, y;
- point.x = path->current_point.x + distance->dx;
- point.y = path->current_point.y + distance->dy;
+ x = path->current_point.x + dx;
+ y = path->current_point.y + dy;
- return _cairo_path_fixed_move_to (path, &point);
+ return _cairo_path_fixed_move_to (path, x, y);
}
cairo_status_t
_cairo_path_fixed_line_to (cairo_path_fixed_t *path,
- cairo_point_t *point)
+ cairo_fixed_t x,
+ cairo_fixed_t y)
{
cairo_status_t status;
+ cairo_point_t point;
+
+ point.x = x;
+ point.y = y;
- status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_LINE_TO, point, 1);
+ status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_LINE_TO, &point, 1);
if (status)
return status;
- path->current_point = *point;
+ path->current_point = point;
path->has_current_point = 1;
return CAIRO_STATUS_SUCCESS;
@@ -202,34 +213,35 @@ _cairo_path_fixed_line_to (cairo_path_fixed_t *path,
cairo_status_t
_cairo_path_fixed_rel_line_to (cairo_path_fixed_t *path,
- cairo_distance_t *distance)
+ cairo_fixed_t dx,
+ cairo_fixed_t dy)
{
- cairo_point_t point;
+ cairo_fixed_t x, y;
- point.x = path->current_point.x + distance->dx;
- point.y = path->current_point.y + distance->dy;
+ x = path->current_point.x + dx;
+ y = path->current_point.y + dy;
- return _cairo_path_fixed_line_to (path, &point);
+ return _cairo_path_fixed_line_to (path, x, y);
}
cairo_status_t
_cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2)
+ cairo_fixed_t x0, cairo_fixed_t y0,
+ cairo_fixed_t x1, cairo_fixed_t y1,
+ cairo_fixed_t x2, cairo_fixed_t y2)
{
cairo_status_t status;
cairo_point_t point[3];
- point[0] = *p0;
- point[1] = *p1;
- point[2] = *p2;
+ point[0].x = x0; point[0].y = y0;
+ point[1].x = x1; point[1].y = y1;
+ point[2].x = x2; point[2].y = y2;
status = _cairo_path_fixed_add (path, CAIRO_PATH_OP_CURVE_TO, point, 3);
if (status)
return status;
- path->current_point = *p2;
+ path->current_point = point[2];
path->has_current_point = 1;
return CAIRO_STATUS_SUCCESS;
@@ -237,22 +249,27 @@ _cairo_path_fixed_curve_to (cairo_path_fixed_t *path,
cairo_status_t
_cairo_path_fixed_rel_curve_to (cairo_path_fixed_t *path,
- cairo_distance_t *d0,
- cairo_distance_t *d1,
- cairo_distance_t *d2)
+ cairo_fixed_t dx0, cairo_fixed_t dy0,
+ cairo_fixed_t dx1, cairo_fixed_t dy1,
+ cairo_fixed_t dx2, cairo_fixed_t dy2)
{
- cairo_point_t p0, p1, p2;
+ cairo_fixed_t x0, y0;
+ cairo_fixed_t x1, y1;
+ cairo_fixed_t x2, y2;
- p0.x = path->current_point.x + d0->dx;
- p0.y = path->current_point.y + d0->dy;
+ x0 = path->current_point.x + dx0;
+ y0 = path->current_point.y + dy0;
- p1.x = path->current_point.x + d1->dx;
- p1.y = path->current_point.y + d1->dy;
+ x1 = path->current_point.x + dx0;
+ y1 = path->current_point.y + dy0;
- p2.x = path->current_point.x + d2->dx;
- p2.y = path->current_point.y + d2->dy;
+ x2 = path->current_point.x + dx0;
+ y2 = path->current_point.y + dy0;
- return _cairo_path_fixed_curve_to (path, &p0, &p1, &p2);
+ return _cairo_path_fixed_curve_to (path,
+ x0, y0,
+ x1, y1,
+ x2, y2);
}
cairo_status_t
@@ -273,12 +290,14 @@ _cairo_path_fixed_close_path (cairo_path_fixed_t *path)
cairo_status_t
_cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
- cairo_point_t *point)
+ cairo_fixed_t *x,
+ cairo_fixed_t *y)
{
if (! path->has_current_point)
return CAIRO_STATUS_NO_CURRENT_POINT;
- *point = path->current_point;
+ *x = path->current_point.x;
+ *y = path->current_point.y;
return CAIRO_STATUS_SUCCESS;
}