summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2008-12-09 20:44:25 +0000
committerChris Wilson <chris@chris-wilson.co.uk>2008-12-12 11:11:49 +0000
commitbcb2724920aa1bca1a9a82b5017d3180f5f9523e (patch)
tree4a7f2c3f3c96f2d91611e90e06472e856bf4bda3
parent68b29cafa597128e7cae86608e04ecae6070dad9 (diff)
[path] Mark points as const during _cairo_path_fixed_interpret()
Use const to document the read-only nature of the arguments passed to the callbacks.
-rw-r--r--src/cairo-path-bounds.c33
-rw-r--r--src/cairo-path-fill.c33
-rw-r--r--src/cairo-path-fixed.c86
-rw-r--r--src/cairo-path-in-fill.c12
-rw-r--r--src/cairo-path-stroke.c108
-rw-r--r--src/cairo-path.c26
-rw-r--r--src/cairo-pdf-operators.c12
-rw-r--r--src/cairo-pen.c4
-rw-r--r--src/cairo-quartz-surface.c11
-rw-r--r--src/cairo-rectangle.c6
-rw-r--r--src/cairo-scaled-font.c12
-rw-r--r--src/cairo-script-surface.c12
-rw-r--r--src/cairo-spans.c18
-rw-r--r--src/cairo-svg-surface.c15
-rw-r--r--src/cairo-type1-fallback.c16
-rw-r--r--src/cairo-types-private.h3
-rw-r--r--src/cairo-win32-printing-surface.c12
-rw-r--r--src/cairoint.h12
18 files changed, 186 insertions, 245 deletions
diff --git a/src/cairo-path-bounds.c b/src/cairo-path-bounds.c
index 6245cd26..b7411d29 100644
--- a/src/cairo-path-bounds.c
+++ b/src/cairo-path-bounds.c
@@ -48,24 +48,6 @@ typedef struct cairo_path_bounder {
} cairo_path_bounder_t;
static void
-_cairo_path_bounder_init (cairo_path_bounder_t *bounder);
-
-static void
-_cairo_path_bounder_fini (cairo_path_bounder_t *bounder);
-
-static void
-_cairo_path_bounder_add_point (cairo_path_bounder_t *bounder, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_path_bounder_move_to (void *closure, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_path_bounder_line_to (void *closure, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_path_bounder_close_path (void *closure);
-
-static void
_cairo_path_bounder_init (cairo_path_bounder_t *bounder)
{
bounder->has_move_to_point = FALSE;
@@ -80,7 +62,8 @@ _cairo_path_bounder_fini (cairo_path_bounder_t *bounder)
}
static void
-_cairo_path_bounder_add_point (cairo_path_bounder_t *bounder, cairo_point_t *point)
+_cairo_path_bounder_add_point (cairo_path_bounder_t *bounder,
+ const cairo_point_t *point)
{
if (bounder->has_point) {
if (point->x < bounder->min_x)
@@ -105,7 +88,8 @@ _cairo_path_bounder_add_point (cairo_path_bounder_t *bounder, cairo_point_t *poi
}
static cairo_status_t
-_cairo_path_bounder_move_to (void *closure, cairo_point_t *point)
+_cairo_path_bounder_move_to (void *closure,
+ const cairo_point_t *point)
{
cairo_path_bounder_t *bounder = closure;
@@ -116,7 +100,8 @@ _cairo_path_bounder_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_path_bounder_line_to (void *closure, cairo_point_t *point)
+_cairo_path_bounder_line_to (void *closure,
+ const cairo_point_t *point)
{
cairo_path_bounder_t *bounder = closure;
@@ -133,9 +118,9 @@ _cairo_path_bounder_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cairo_path_bounder_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
cairo_path_bounder_t *bounder = closure;
diff --git a/src/cairo-path-fill.c b/src/cairo-path-fill.c
index 089232d4..9569c9e9 100644
--- a/src/cairo-path-fill.c
+++ b/src/cairo-path-fill.c
@@ -47,27 +47,6 @@ typedef struct cairo_filler {
} cairo_filler_t;
static void
-_cairo_filler_init (cairo_filler_t *filler, double tolerance, cairo_traps_t *traps);
-
-static void
-_cairo_filler_fini (cairo_filler_t *filler);
-
-static cairo_status_t
-_cairo_filler_move_to (void *closure, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_filler_line_to (void *closure, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_filler_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d);
-
-static cairo_status_t
-_cairo_filler_close_path (void *closure);
-
-static void
_cairo_filler_init (cairo_filler_t *filler, double tolerance, cairo_traps_t *traps)
{
filler->tolerance = tolerance;
@@ -86,7 +65,8 @@ _cairo_filler_fini (cairo_filler_t *filler)
}
static cairo_status_t
-_cairo_filler_move_to (void *closure, cairo_point_t *point)
+_cairo_filler_move_to (void *closure,
+ const cairo_point_t *point)
{
cairo_filler_t *filler = closure;
cairo_polygon_t *polygon = &filler->polygon;
@@ -100,7 +80,8 @@ _cairo_filler_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_filler_line_to (void *closure, cairo_point_t *point)
+_cairo_filler_line_to (void *closure,
+ const cairo_point_t *point)
{
cairo_filler_t *filler = closure;
cairo_polygon_t *polygon = &filler->polygon;
@@ -114,9 +95,9 @@ _cairo_filler_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cairo_filler_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
cairo_filler_t *filler = closure;
cairo_spline_t spline;
diff --git a/src/cairo-path-fixed.c b/src/cairo-path-fixed.c
index d423a167..437c9b9e 100644
--- a/src/cairo-path-fixed.c
+++ b/src/cairo-path-fixed.c
@@ -707,7 +707,7 @@ _cairo_path_fixed_interpret (const cairo_path_fixed_t *path,
static cairo_status_t
_append_move_to (void *closure,
- cairo_point_t *point)
+ const cairo_point_t *point)
{
cairo_path_fixed_t *path = (cairo_path_fixed_t *) closure;
return _cairo_path_fixed_move_to (path, point->x, point->y);
@@ -715,7 +715,7 @@ _append_move_to (void *closure,
static cairo_status_t
_append_line_to (void *closure,
- cairo_point_t *point)
+ const cairo_point_t *point)
{
cairo_path_fixed_t *path = (cairo_path_fixed_t *) closure;
return _cairo_path_fixed_line_to (path, point->x, point->y);
@@ -723,9 +723,9 @@ _append_line_to (void *closure,
static cairo_status_t
_append_curve_to (void *closure,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2)
+ const cairo_point_t *p0,
+ const cairo_point_t *p1,
+ const cairo_point_t *p2)
{
cairo_path_fixed_t *path = (cairo_path_fixed_t *) closure;
return _cairo_path_fixed_curve_to (path, p0->x, p0->y, p1->x, p1->y, p2->x, p2->y);
@@ -738,7 +738,7 @@ _append_close_path (void *closure)
return _cairo_path_fixed_close_path (path);
}
-cairo_private cairo_status_t
+cairo_status_t
_cairo_path_fixed_append (cairo_path_fixed_t *path,
const cairo_path_fixed_t *other,
cairo_direction_t dir)
@@ -864,7 +864,8 @@ typedef struct cairo_path_flattener {
} cpf_t;
static cairo_status_t
-_cpf_move_to (void *closure, cairo_point_t *point)
+_cpf_move_to (void *closure,
+ const cairo_point_t *point)
{
cpf_t *cpf = closure;
@@ -874,7 +875,8 @@ _cpf_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cpf_line_to (void *closure, cairo_point_t *point)
+_cpf_line_to (void *closure,
+ const cairo_point_t *point)
{
cpf_t *cpf = closure;
@@ -885,9 +887,9 @@ _cpf_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cpf_curve_to (void *closure,
- cairo_point_t *p1,
- cairo_point_t *p2,
- cairo_point_t *p3)
+ const cairo_point_t *p1,
+ const cairo_point_t *p2,
+ const cairo_point_t *p3)
{
cpf_t *cpf = closure;
cairo_spline_t spline;
@@ -1191,22 +1193,23 @@ typedef struct cairo_path_region_tester {
static cairo_status_t
_cprt_line_to (void *closure,
- cairo_point_t *p2)
+ const cairo_point_t *p2)
{
cprt_t *self = closure;
cairo_point_t *p1 = &self->current_point;
+
if (p2->x == p1->x) {
- if (_cairo_fixed_is_integer(p2->y)) {
- *p1 = *p2;
+ if (_cairo_fixed_is_integer (p2->y)) {
+ p1->y = p2->y;
return CAIRO_STATUS_SUCCESS;
}
- }
- else if (p2->y == p1->y) {
- if (_cairo_fixed_is_integer(p2->x)) {
- *p1 = *p2;
+ } else if (p2->y == p1->y) {
+ if (_cairo_fixed_is_integer (p2->x)) {
+ p1->x = p2->x;
return CAIRO_STATUS_SUCCESS;
}
}
+
return CAIRO_INT_STATUS_UNSUPPORTED;
}
@@ -1218,32 +1221,22 @@ _cprt_close_path (void *closure)
}
static cairo_status_t
-_cprt_move_to (void *closure,
- cairo_point_t *p)
+_cprt_move_to (void *closure,
+ const cairo_point_t *p)
{
cprt_t *self = closure;
- cairo_status_t status = _cprt_close_path (closure);
- if (status) return status;
- if (_cairo_fixed_is_integer(p->x) &&
- _cairo_fixed_is_integer(p->y))
- {
+ cairo_status_t status;
+
+ status = _cprt_close_path (closure);
+ if (status)
+ return status;
+
+ if (_cairo_fixed_is_integer (p->x) && _cairo_fixed_is_integer (p->y)) {
self->current_point = *p;
self->last_move_point = *p;
return CAIRO_STATUS_SUCCESS;
}
- return CAIRO_INT_STATUS_UNSUPPORTED;
-}
-static cairo_status_t
-_cprt_curve_to (void *closure,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2)
-{
- (void)closure;
- (void)p0;
- (void)p1;
- (void)p2;
return CAIRO_INT_STATUS_UNSUPPORTED;
}
@@ -1256,19 +1249,20 @@ cairo_bool_t
_cairo_path_fixed_is_region (cairo_path_fixed_t *path)
{
cprt_t cprt;
- cairo_status_t status;
+
if (path->has_curve_to)
return FALSE;
+
cprt.current_point.x = 0;
cprt.current_point.y = 0;
cprt.last_move_point.x = 0;
cprt.last_move_point.y = 0;
- status = _cairo_path_fixed_interpret (path,
- CAIRO_DIRECTION_FORWARD,
- _cprt_move_to,
- _cprt_line_to,
- _cprt_curve_to,
- _cprt_close_path,
- &cprt);
- return status == CAIRO_STATUS_SUCCESS;
+
+ return _cairo_path_fixed_interpret (path,
+ CAIRO_DIRECTION_FORWARD,
+ _cprt_move_to,
+ _cprt_line_to,
+ NULL,
+ _cprt_close_path,
+ &cprt) == CAIRO_STATUS_SUCCESS;
}
diff --git a/src/cairo-path-in-fill.c b/src/cairo-path-in-fill.c
index f7785e85..431f005b 100644
--- a/src/cairo-path-in-fill.c
+++ b/src/cairo-path-in-fill.c
@@ -132,7 +132,8 @@ _cairo_in_fill_add_edge (cairo_in_fill_t *in_fill,
}
static cairo_status_t
-_cairo_in_fill_move_to (void *closure, cairo_point_t *point)
+_cairo_in_fill_move_to (void *closure,
+ const cairo_point_t *point)
{
cairo_in_fill_t *in_fill = closure;
@@ -151,7 +152,8 @@ _cairo_in_fill_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_in_fill_line_to (void *closure, cairo_point_t *point)
+_cairo_in_fill_line_to (void *closure,
+ const cairo_point_t *point)
{
cairo_in_fill_t *in_fill = closure;
@@ -166,9 +168,9 @@ _cairo_in_fill_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cairo_in_fill_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
cairo_in_fill_t *in_fill = closure;
cairo_spline_t spline;
diff --git a/src/cairo-path-stroke.c b/src/cairo-path-stroke.c
index 8d3a1a93..2fba174d 100644
--- a/src/cairo-path-stroke.c
+++ b/src/cairo-path-stroke.c
@@ -72,51 +72,6 @@ typedef struct cairo_stroker {
cairo_box_t bounds;
} cairo_stroker_t;
-/* private functions */
-static cairo_status_t
-_cairo_stroker_init (cairo_stroker_t *stroker,
- cairo_stroke_style_t *stroke_style,
- cairo_matrix_t *ctm,
- cairo_matrix_t *ctm_inverse,
- double tolerance,
- cairo_traps_t *traps);
-
-static void
-_cairo_stroker_fini (cairo_stroker_t *stroker);
-
-static cairo_status_t
-_cairo_stroker_move_to (void *closure, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_stroker_line_to (void *closure, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point);
-
-static cairo_status_t
-_cairo_stroker_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d);
-
-static cairo_status_t
-_cairo_stroker_curve_to_dashed (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d);
-
-static cairo_status_t
-_cairo_stroker_close_path (void *closure);
-
-static void
-_translate_point (cairo_point_t *point, cairo_point_t *offset);
-
-static int
-_cairo_stroker_face_clockwise (cairo_stroke_face_t *in, cairo_stroke_face_t *out);
-
-static cairo_status_t
-_cairo_stroker_join (cairo_stroker_t *stroker, cairo_stroke_face_t *in, cairo_stroke_face_t *out);
-
static void
_cairo_stroker_start_dash (cairo_stroker_t *stroker)
{
@@ -632,7 +587,7 @@ _compute_normalized_device_slope (double *dx, double *dy, cairo_matrix_t *ctm_in
}
static void
-_compute_face (cairo_point_t *point, cairo_slope_t *dev_slope,
+_compute_face (const cairo_point_t *point, cairo_slope_t *dev_slope,
double slope_dx, double slope_dy,
cairo_stroker_t *stroker, cairo_stroke_face_t *face);
@@ -681,7 +636,7 @@ _cairo_stroker_add_caps (cairo_stroker_t *stroker)
}
static void
-_compute_face (cairo_point_t *point, cairo_slope_t *dev_slope,
+_compute_face (const cairo_point_t *point, cairo_slope_t *dev_slope,
double slope_dx, double slope_dy,
cairo_stroker_t *stroker, cairo_stroke_face_t *face)
{
@@ -729,9 +684,13 @@ _compute_face (cairo_point_t *point, cairo_slope_t *dev_slope,
}
static cairo_status_t
-_cairo_stroker_add_sub_edge (cairo_stroker_t *stroker, cairo_point_t *p1, cairo_point_t *p2,
- cairo_slope_t *dev_slope, double slope_dx, double slope_dy,
- cairo_stroke_face_t *start, cairo_stroke_face_t *end)
+_cairo_stroker_add_sub_edge (cairo_stroker_t *stroker,
+ const cairo_point_t *p1,
+ const cairo_point_t *p2,
+ cairo_slope_t *dev_slope,
+ double slope_dx, double slope_dy,
+ cairo_stroke_face_t *start,
+ cairo_stroke_face_t *end)
{
cairo_point_t rectangle[4];
@@ -754,7 +713,8 @@ _cairo_stroker_add_sub_edge (cairo_stroker_t *stroker, cairo_point_t *p1, cairo_
}
static cairo_status_t
-_cairo_stroker_move_to (void *closure, cairo_point_t *point)
+_cairo_stroker_move_to (void *closure,
+ const cairo_point_t *point)
{
cairo_status_t status;
cairo_stroker_t *stroker = closure;
@@ -775,7 +735,8 @@ _cairo_stroker_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_stroker_move_to_dashed (void *closure, cairo_point_t *point)
+_cairo_stroker_move_to_dashed (void *closure,
+ const cairo_point_t *point)
{
/* reset the dash pattern for new sub paths */
cairo_stroker_t *stroker = closure;
@@ -785,13 +746,13 @@ _cairo_stroker_move_to_dashed (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_stroker_line_to (void *closure, cairo_point_t *point)
+_cairo_stroker_line_to (void *closure,
+ const cairo_point_t *p2)
{
cairo_status_t status;
cairo_stroker_t *stroker = closure;
cairo_stroke_face_t start, end;
cairo_point_t *p1 = &stroker->current_point;
- cairo_point_t *p2 = point;
cairo_slope_t dev_slope;
double slope_dx, slope_dy;
@@ -805,7 +766,11 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point)
slope_dy = _cairo_fixed_to_double (p2->y - p1->y);
_compute_normalized_device_slope (&slope_dx, &slope_dy, stroker->ctm_inverse, NULL);
- status = _cairo_stroker_add_sub_edge (stroker, p1, p2, &dev_slope, slope_dx, slope_dy, &start, &end);
+ status = _cairo_stroker_add_sub_edge (stroker,
+ p1, p2,
+ &dev_slope,
+ slope_dx, slope_dy,
+ &start, &end);
if (unlikely (status))
return status;
@@ -822,7 +787,7 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point)
stroker->current_face = end;
stroker->has_current_face = TRUE;
- stroker->current_point = *point;
+ stroker->current_point = *p2;
return CAIRO_STATUS_SUCCESS;
}
@@ -831,7 +796,8 @@ _cairo_stroker_line_to (void *closure, cairo_point_t *point)
* Dashed lines. Cap each dash end, join around turns when on
*/
static cairo_status_t
-_cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
+_cairo_stroker_line_to_dashed (void *closure,
+ const cairo_point_t *p2)
{
cairo_stroker_t *stroker = closure;
double mag, remain, step_length = 0;
@@ -839,7 +805,6 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
double dx2, dy2;
cairo_stroke_face_t sub_start, sub_end;
cairo_point_t *p1 = &stroker->current_point;
- cairo_point_t *p2 = point;
cairo_slope_t dev_slope;
cairo_line_t segment;
cairo_bool_t fully_in_bounds;
@@ -948,7 +913,7 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
* path stroking.
* On the other hand, Acroread 7 also produces the degenerate caps.
*/
- _compute_face (point, &dev_slope,
+ _compute_face (p2, &dev_slope,
slope_dx, slope_dy,
stroker,
&stroker->current_face);
@@ -961,16 +926,16 @@ _cairo_stroker_line_to_dashed (void *closure, cairo_point_t *point)
stroker->has_current_face = TRUE;
}
- stroker->current_point = *point;
+ stroker->current_point = *p2;
return CAIRO_STATUS_SUCCESS;
}
static cairo_status_t
_cairo_stroker_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
cairo_stroker_t *stroker = closure;
cairo_pen_stroke_spline_t spline_pen;
@@ -1072,9 +1037,9 @@ _cairo_stroker_curve_to (void *closure,
*/
static cairo_status_t
_cairo_stroker_curve_to_dashed (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
cairo_stroker_t *stroker = closure;
cairo_spline_t spline;
@@ -1242,8 +1207,8 @@ _cairo_rectilinear_stroker_fini (cairo_rectilinear_stroker_t *stroker)
static cairo_status_t
_cairo_rectilinear_stroker_add_segment (cairo_rectilinear_stroker_t *stroker,
- cairo_point_t *p1,
- cairo_point_t *p2)
+ const cairo_point_t *p1,
+ const cairo_point_t *p2)
{
if (stroker->num_segments == stroker->segments_size) {
@@ -1395,7 +1360,7 @@ _cairo_rectilinear_stroker_emit_segments (cairo_rectilinear_stroker_t *stroker)
static cairo_status_t
_cairo_rectilinear_stroker_move_to (void *closure,
- cairo_point_t *point)
+ const cairo_point_t *point)
{
cairo_rectilinear_stroker_t *stroker = closure;
cairo_status_t status;
@@ -1412,11 +1377,10 @@ _cairo_rectilinear_stroker_move_to (void *closure,
static cairo_status_t
_cairo_rectilinear_stroker_line_to (void *closure,
- cairo_point_t *point)
+ const cairo_point_t *b)
{
cairo_rectilinear_stroker_t *stroker = closure;
cairo_point_t *a = &stroker->current_point;
- cairo_point_t *b = point;
cairo_status_t status;
/* We only support horizontal or vertical elements. */
@@ -1429,7 +1393,7 @@ _cairo_rectilinear_stroker_line_to (void *closure,
status = _cairo_rectilinear_stroker_add_segment (stroker, a, b);
- stroker->current_point = *point;
+ stroker->current_point = *b;
stroker->open_sub_path = TRUE;
return status;
diff --git a/src/cairo-path.c b/src/cairo-path.c
index 84dfc0c4..6572da9c 100644
--- a/src/cairo-path.c
+++ b/src/cairo-path.c
@@ -48,7 +48,8 @@ typedef struct cairo_path_count {
} cpc_t;
static cairo_status_t
-_cpc_move_to (void *closure, cairo_point_t *point)
+_cpc_move_to (void *closure,
+ const cairo_point_t *point)
{
cpc_t *cpc = closure;
@@ -60,7 +61,8 @@ _cpc_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cpc_line_to (void *closure, cairo_point_t *point)
+_cpc_line_to (void *closure,
+ const cairo_point_t *point)
{
cpc_t *cpc = closure;
@@ -73,9 +75,9 @@ _cpc_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cpc_curve_to (void *closure,
- cairo_point_t *p1,
- cairo_point_t *p2,
- cairo_point_t *p3)
+ const cairo_point_t *p1,
+ const cairo_point_t *p2,
+ const cairo_point_t *p3)
{
cpc_t *cpc = closure;
@@ -141,7 +143,8 @@ typedef struct cairo_path_populate {
} cpp_t;
static cairo_status_t
-_cpp_move_to (void *closure, cairo_point_t *point)
+_cpp_move_to (void *closure,
+ const cairo_point_t *point)
{
cpp_t *cpp = closure;
cairo_path_data_t *data = cpp->data;
@@ -167,7 +170,8 @@ _cpp_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cpp_line_to (void *closure, cairo_point_t *point)
+_cpp_line_to (void *closure,
+ const cairo_point_t *point)
{
cpp_t *cpp = closure;
cairo_path_data_t *data = cpp->data;
@@ -193,10 +197,10 @@ _cpp_line_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cpp_curve_to (void *closure,
- cairo_point_t *p1,
- cairo_point_t *p2,
- cairo_point_t *p3)
+_cpp_curve_to (void *closure,
+ const cairo_point_t *p1,
+ const cairo_point_t *p2,
+ const cairo_point_t *p3)
{
cpp_t *cpp = closure;
cairo_path_data_t *data = cpp->data;
diff --git a/src/cairo-pdf-operators.c b/src/cairo-pdf-operators.c
index ea5c5148..256b08e0 100644
--- a/src/cairo-pdf-operators.c
+++ b/src/cairo-pdf-operators.c
@@ -329,7 +329,8 @@ typedef struct _pdf_path_info {
} pdf_path_info_t;
static cairo_status_t
-_cairo_pdf_path_move_to (void *closure, cairo_point_t *point)
+_cairo_pdf_path_move_to (void *closure,
+ const cairo_point_t *point)
{
pdf_path_info_t *info = closure;
double x = _cairo_fixed_to_double (point->x);
@@ -345,7 +346,8 @@ _cairo_pdf_path_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_pdf_path_line_to (void *closure, cairo_point_t *point)
+_cairo_pdf_path_line_to (void *closure,
+ const cairo_point_t *point)
{
pdf_path_info_t *info = closure;
double x = _cairo_fixed_to_double (point->x);
@@ -369,9 +371,9 @@ _cairo_pdf_path_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cairo_pdf_path_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
pdf_path_info_t *info = closure;
double bx = _cairo_fixed_to_double (b->x);
diff --git a/src/cairo-pen.c b/src/cairo-pen.c
index a7576e1a..d543765b 100644
--- a/src/cairo-pen.c
+++ b/src/cairo-pen.c
@@ -504,8 +504,8 @@ _cairo_pen_stroke_spline (cairo_pen_stroke_spline_t *stroker,
}
static cairo_status_t
-_cairo_pen_stroke_spline_add_point (void *closure,
- cairo_point_t *point)
+_cairo_pen_stroke_spline_add_point (void *closure,
+ const cairo_point_t *point)
{
cairo_pen_stroke_spline_t *stroker = closure;
cairo_slope_t slope;
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 34661853..7ced686e 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -289,7 +289,8 @@ typedef struct _quartz_stroke {
/* cairo path -> execute in context */
static cairo_status_t
-_cairo_path_to_quartz_context_move_to (void *closure, cairo_point_t *point)
+_cairo_path_to_quartz_context_move_to (void *closure,
+ const cairo_point_t *point)
{
//ND((stderr, "moveto: %f %f\n", _cairo_fixed_to_double(point->x), _cairo_fixed_to_double(point->y)));
quartz_stroke_t *stroke = (quartz_stroke_t *)closure;
@@ -304,7 +305,8 @@ _cairo_path_to_quartz_context_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_path_to_quartz_context_line_to (void *closure, cairo_point_t *point)
+_cairo_path_to_quartz_context_line_to (void *closure,
+ const cairo_point_t *point)
{
//ND((stderr, "lineto: %f %f\n", _cairo_fixed_to_double(point->x), _cairo_fixed_to_double(point->y)));
quartz_stroke_t *stroke = (quartz_stroke_t *)closure;
@@ -322,7 +324,10 @@ _cairo_path_to_quartz_context_line_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_path_to_quartz_context_curve_to (void *closure, cairo_point_t *p0, cairo_point_t *p1, cairo_point_t *p2)
+_cairo_path_to_quartz_context_curve_to (void *closure,
+ const cairo_point_t *p0,
+ const cairo_point_t *p1,
+ const cairo_point_t *p2)
{
//ND( (stderr, "curveto: %f,%f %f,%f %f,%f\n",
// _cairo_fixed_to_double(p0->x), _cairo_fixed_to_double(p0->y),
diff --git a/src/cairo-rectangle.c b/src/cairo-rectangle.c
index 9a68409c..b1396248 100644
--- a/src/cairo-rectangle.c
+++ b/src/cairo-rectangle.c
@@ -153,8 +153,8 @@ _cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line)
cairo_fixed_t xlen, ylen;
- if (_cairo_box_contains_point(box, &line->p1) ||
- _cairo_box_contains_point(box, &line->p2))
+ if (_cairo_box_contains_point (box, &line->p1) ||
+ _cairo_box_contains_point (box, &line->p2))
return TRUE;
xlen = P2x - P1x;
@@ -216,7 +216,7 @@ _cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line)
}
cairo_bool_t
-_cairo_box_contains_point (cairo_box_t *box, cairo_point_t *point)
+_cairo_box_contains_point (cairo_box_t *box, const cairo_point_t *point)
{
if (point->x < box->p1.x || point->x > box->p2.x ||
point->y < box->p1.y || point->y > box->p2.y)
diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c
index ca86f512..570fd381 100644
--- a/src/cairo-scaled-font.c
+++ b/src/cairo-scaled-font.c
@@ -1973,7 +1973,8 @@ typedef struct _cairo_scaled_glyph_path_closure {
} cairo_scaled_glyph_path_closure_t;
static cairo_status_t
-_scaled_glyph_path_move_to (void *abstract_closure, cairo_point_t *point)
+_scaled_glyph_path_move_to (void *abstract_closure,
+ const cairo_point_t *point)
{
cairo_scaled_glyph_path_closure_t *closure = abstract_closure;
@@ -1983,7 +1984,8 @@ _scaled_glyph_path_move_to (void *abstract_closure, cairo_point_t *point)
}
static cairo_status_t
-_scaled_glyph_path_line_to (void *abstract_closure, cairo_point_t *point)
+_scaled_glyph_path_line_to (void *abstract_closure,
+ const cairo_point_t *point)
{
cairo_scaled_glyph_path_closure_t *closure = abstract_closure;
@@ -1994,9 +1996,9 @@ _scaled_glyph_path_line_to (void *abstract_closure, cairo_point_t *point)
static cairo_status_t
_scaled_glyph_path_curve_to (void *abstract_closure,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2)
+ const cairo_point_t *p0,
+ const cairo_point_t *p1,
+ const cairo_point_t *p2)
{
cairo_scaled_glyph_path_closure_t *closure = abstract_closure;
diff --git a/src/cairo-script-surface.c b/src/cairo-script-surface.c
index cf2809f5..ea2a7cc4 100644
--- a/src/cairo-script-surface.c
+++ b/src/cairo-script-surface.c
@@ -1168,7 +1168,8 @@ _emit_source (cairo_script_surface_t *surface,
}
static cairo_status_t
-_path_move_to (void *closure, cairo_point_t *point)
+_path_move_to (void *closure,
+ const cairo_point_t *point)
{
_cairo_output_stream_printf (closure,
" %f %f m",
@@ -1179,7 +1180,8 @@ _path_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_path_line_to (void *closure, cairo_point_t *point)
+_path_line_to (void *closure,
+ const cairo_point_t *point)
{
_cairo_output_stream_printf (closure,
" %f %f l",
@@ -1191,9 +1193,9 @@ _path_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_path_curve_to (void *closure,
- cairo_point_t *p1,
- cairo_point_t *p2,
- cairo_point_t *p3)
+ const cairo_point_t *p1,
+ const cairo_point_t *p2,
+ const cairo_point_t *p3)
{
_cairo_output_stream_printf (closure,
" %f %f %f %f %f %f c",
diff --git a/src/cairo-spans.c b/src/cairo-spans.c
index e441143b..807eea96 100644
--- a/src/cairo-spans.c
+++ b/src/cairo-spans.c
@@ -33,9 +33,8 @@ typedef struct {
} scan_converter_filler_t;
static void
-scan_converter_filler_init (
- scan_converter_filler_t *filler,
- cairo_scan_converter_t *converter)
+scan_converter_filler_init (scan_converter_filler_t *filler,
+ cairo_scan_converter_t *converter)
{
filler->converter = converter;
filler->current_point.x = 0;
@@ -44,9 +43,8 @@ scan_converter_filler_init (
}
static cairo_status_t
-scan_converter_filler_move_to (
- void *closure,
- cairo_point_t *p)
+scan_converter_filler_move_to (void *closure,
+ const cairo_point_t *p)
{
scan_converter_filler_t *filler = closure;
filler->current_point.x = p->x;
@@ -56,9 +54,8 @@ scan_converter_filler_move_to (
}
static cairo_status_t
-scan_converter_filler_line_to (
- void *closure,
- cairo_point_t *p)
+scan_converter_filler_line_to (void *closure,
+ const cairo_point_t *p)
{
scan_converter_filler_t *filler = closure;
cairo_status_t status;
@@ -78,8 +75,7 @@ scan_converter_filler_line_to (
}
static cairo_status_t
-scan_converter_filler_close_path (
- void *closure)
+scan_converter_filler_close_path (void *closure)
{
scan_converter_filler_t *filler = closure;
cairo_status_t status;
diff --git a/src/cairo-svg-surface.c b/src/cairo-svg-surface.c
index cfd9a2d5..e81ccd8b 100644
--- a/src/cairo-svg-surface.c
+++ b/src/cairo-svg-surface.c
@@ -522,14 +522,14 @@ _cairo_svg_surface_emit_transform (cairo_output_stream_t *output,
matrix.x0, matrix.y0);
}
-typedef struct
-{
+typedef struct {
cairo_output_stream_t *output;
cairo_matrix_t *ctm_inverse;
} svg_path_info_t;
static cairo_status_t
-_cairo_svg_path_move_to (void *closure, cairo_point_t *point)
+_cairo_svg_path_move_to (void *closure,
+ const cairo_point_t *point)
{
svg_path_info_t *info = closure;
double x = _cairo_fixed_to_double (point->x);
@@ -544,7 +544,8 @@ _cairo_svg_path_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_svg_path_line_to (void *closure, cairo_point_t *point)
+_cairo_svg_path_line_to (void *closure,
+ const cairo_point_t *point)
{
svg_path_info_t *info = closure;
double x = _cairo_fixed_to_double (point->x);
@@ -560,9 +561,9 @@ _cairo_svg_path_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cairo_svg_path_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
svg_path_info_t *info = closure;
double bx = _cairo_fixed_to_double (b->x);
diff --git a/src/cairo-type1-fallback.c b/src/cairo-type1-fallback.c
index 91c00542..2b6768dc 100644
--- a/src/cairo-type1-fallback.c
+++ b/src/cairo-type1-fallback.c
@@ -218,8 +218,8 @@ typedef struct _ps_path_info {
} t1_path_info_t;
static cairo_status_t
-_charstring_move_to (void *closure,
- cairo_point_t *point)
+_charstring_move_to (void *closure,
+ const cairo_point_t *point)
{
t1_path_info_t *path_info = (t1_path_info_t *) closure;
int dx, dy;
@@ -242,8 +242,8 @@ _charstring_move_to (void *closure,
}
static cairo_status_t
-_charstring_line_to (void *closure,
- cairo_point_t *point)
+_charstring_line_to (void *closure,
+ const cairo_point_t *point)
{
t1_path_info_t *path_info = (t1_path_info_t *) closure;
int dx, dy;
@@ -266,10 +266,10 @@ _charstring_line_to (void *closure,
}
static cairo_status_t
-_charstring_curve_to (void *closure,
- cairo_point_t *point1,
- cairo_point_t *point2,
- cairo_point_t *point3)
+_charstring_curve_to (void *closure,
+ const cairo_point_t *point1,
+ const cairo_point_t *point2,
+ const cairo_point_t *point3)
{
t1_path_info_t *path_info = (t1_path_info_t *) closure;
int dx1, dy1, dx2, dy2, dx3, dy3;
diff --git a/src/cairo-types-private.h b/src/cairo-types-private.h
index f4d726d6..2fdb196d 100644
--- a/src/cairo-types-private.h
+++ b/src/cairo-types-private.h
@@ -306,7 +306,8 @@ typedef struct _cairo_polygon {
} cairo_polygon_t;
typedef cairo_status_t
-(*cairo_spline_add_point_func_t) (void *closure, cairo_point_t *point);
+(*cairo_spline_add_point_func_t) (void *closure,
+ const cairo_point_t *point);
typedef struct _cairo_spline_knots {
cairo_point_t a, b, c, d;
diff --git a/src/cairo-win32-printing-surface.c b/src/cairo-win32-printing-surface.c
index 94927aeb..989f0186 100644
--- a/src/cairo-win32-printing-surface.c
+++ b/src/cairo-win32-printing-surface.c
@@ -982,7 +982,8 @@ typedef struct _win32_print_path_info {
} win32_path_info_t;
static cairo_status_t
-_cairo_win32_printing_surface_path_move_to (void *closure, cairo_point_t *point)
+_cairo_win32_printing_surface_path_move_to (void *closure,
+ const cairo_point_t *point)
{
win32_path_info_t *path_info = closure;
@@ -1004,7 +1005,8 @@ _cairo_win32_printing_surface_path_move_to (void *closure, cairo_point_t *point)
}
static cairo_status_t
-_cairo_win32_printing_surface_path_line_to (void *closure, cairo_point_t *point)
+_cairo_win32_printing_surface_path_line_to (void *closure,
+ const cairo_point_t *point)
{
win32_path_info_t *path_info = closure;
@@ -1027,9 +1029,9 @@ _cairo_win32_printing_surface_path_line_to (void *closure, cairo_point_t *point)
static cairo_status_t
_cairo_win32_printing_surface_path_curve_to (void *closure,
- cairo_point_t *b,
- cairo_point_t *c,
- cairo_point_t *d)
+ const cairo_point_t *b,
+ const cairo_point_t *c,
+ const cairo_point_t *d)
{
win32_path_info_t *path_info = closure;
POINT points[3];
diff --git a/src/cairoint.h b/src/cairoint.h
index 2c0e8662..7f900377 100644
--- a/src/cairoint.h
+++ b/src/cairoint.h
@@ -262,7 +262,7 @@ cairo_private cairo_bool_t
_cairo_box_intersects_line_segment (cairo_box_t *box, cairo_line_t *line);
cairo_private cairo_bool_t
-_cairo_box_contains_point (cairo_box_t *box, cairo_point_t *point);
+_cairo_box_contains_point (cairo_box_t *box, const cairo_point_t *point);
cairo_private void
_cairo_composite_rectangles_init (cairo_composite_rectangles_t *rects,
@@ -1502,17 +1502,17 @@ _cairo_path_fixed_get_current_point (cairo_path_fixed_t *path,
typedef cairo_status_t
(cairo_path_fixed_move_to_func_t) (void *closure,
- cairo_point_t *point);
+ const cairo_point_t *point);
typedef cairo_status_t
(cairo_path_fixed_line_to_func_t) (void *closure,
- cairo_point_t *point);
+ const cairo_point_t *point);
typedef cairo_status_t
(cairo_path_fixed_curve_to_func_t) (void *closure,
- cairo_point_t *p0,
- cairo_point_t *p1,
- cairo_point_t *p2);
+ const cairo_point_t *p0,
+ const cairo_point_t *p1,
+ const cairo_point_t *p2);
typedef cairo_status_t
(cairo_path_fixed_close_path_func_t) (void *closure);