[librsvg/next: 26/31] Use cairo_append_path
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg/next: 26/31] Use cairo_append_path
- Date: Fri, 21 Oct 2011 21:23:02 +0000 (UTC)
commit d3aebab393ed655fb5a08a9ae8907d931dabf5c3
Author: Christian Persch <chpe gnome org>
Date: Fri Sep 16 22:00:58 2011 +0200
Use cairo_append_path
Just call cairo_append_path() instead of duplicating it (twice!).
rsvg-cairo-clip.c | 22 +---------------------
rsvg-cairo-draw.c | 22 +---------------------
2 files changed, 2 insertions(+), 42 deletions(-)
---
diff --git a/rsvg-cairo-clip.c b/rsvg-cairo-clip.c
index 3d66c59..5f078d9 100644
--- a/rsvg-cairo-clip.c
+++ b/rsvg-cairo-clip.c
@@ -67,7 +67,6 @@ rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const cairo_path_t *path)
RsvgCairoRender *cairo_render = &render->super;
RsvgState *state = rsvg_current_state (ctx);
cairo_t *cr;
- const cairo_path_data_t *data, *end;
cr = cairo_render->cr;
@@ -75,26 +74,7 @@ rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const cairo_path_t *path)
cairo_set_fill_rule (cr, rsvg_current_state (ctx)->clip_rule);
- end = &path->data[path->num_data];
- for (data = &path->data[0]; data < end; data += data->header.length) {
- switch (data[0].header.type) {
- case CAIRO_PATH_CLOSE_PATH:
- cairo_close_path (cr);
- break;
- case CAIRO_PATH_MOVE_TO:
- cairo_move_to (cr, data[1].point.x, data[1].point.y);
- break;
- case CAIRO_PATH_CURVE_TO:
- cairo_curve_to (cr,
- data[1].point.x, data[1].point.y,
- data[2].point.x, data[2].point.y,
- data[3].point.x, data[3].point.y);
- break;
- case CAIRO_PATH_LINE_TO:
- cairo_line_to (cr, data[1].point.x, data[1].point.y);
- break;
- }
- }
+ cairo_append_path (cr, path);
}
static void
diff --git a/rsvg-cairo-draw.c b/rsvg-cairo-draw.c
index 7062a7e..8bd39ec 100644
--- a/rsvg-cairo-draw.c
+++ b/rsvg-cairo-draw.c
@@ -444,7 +444,6 @@ rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const cairo_path_t *path)
int need_tmpbuf = 0;
RsvgBbox bbox;
double backup_tolerance;
- const cairo_path_data_t *data, *end;
if (state->fill == NULL && state->stroke == NULL)
return;
@@ -469,26 +468,7 @@ rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const cairo_path_t *path)
cairo_set_dash (cr, state->dash.dash, state->dash.n_dash,
_rsvg_css_normalize_length (&state->dash.offset, ctx, 'o'));
- end = &path->data[path->num_data];
- for (data = &path->data[0]; data < end; data += data->header.length) {
- switch (data[0].header.type) {
- case CAIRO_PATH_CLOSE_PATH:
- cairo_close_path (cr);
- break;
- case CAIRO_PATH_MOVE_TO:
- cairo_move_to (cr, data[1].point.x, data[1].point.y);
- break;
- case CAIRO_PATH_CURVE_TO:
- cairo_curve_to (cr,
- data[1].point.x, data[1].point.y,
- data[2].point.x, data[2].point.y,
- data[3].point.x, data[3].point.y);
- break;
- case CAIRO_PATH_LINE_TO:
- cairo_line_to (cr, data[1].point.x, data[1].point.y);
- break;
- }
- }
+ cairo_append_path (cr, path);
rsvg_bbox_init (&bbox, &state->affine);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]