Use cairo_path_t

Parse the path into a cairo_path_t structure instead of inventing
an own one.
parent e773e772
......@@ -33,8 +33,6 @@ enum_sources = \
librsvg_@RSVG_API_MAJOR_VERSION@_la_SOURCES = \
librsvg-features.c \
rsvg-bpath-util.c \
rsvg-bpath-util.h \
rsvg-css.c \
rsvg-css.h \
rsvg-defs.c \
......
......@@ -54,7 +54,6 @@
#include <gsf/gsf-utils.h>
#endif
#include "rsvg-bpath-util.h"
#include "rsvg-path.h"
#include "rsvg-paint-server.h"
#include "rsvg-xml.h"
......@@ -2063,15 +2062,14 @@ rsvg_push_discrete_layer (RsvgDrawingCtx * ctx)
void
rsvg_render_path (RsvgDrawingCtx * ctx, const char *d)
{
/* todo: store and use the bpath higher up */
RsvgBpathDef *bpath_def;
/* todo: store and use the path higher up */
cairo_path_t *path;
bpath_def = rsvg_parse_path (d);
path = rsvg_parse_path (d);
ctx->render->render_path (ctx, bpath_def);
rsvg_render_markers (bpath_def, ctx);
rsvg_bpath_def_free (bpath_def);
ctx->render->render_path (ctx, path);
rsvg_render_markers (ctx, path);
rsvg_cairo_path_destroy (path);
}
void
......
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 sts=4 ts=4 expandtab: */
/*
rsvg-bpath-util.c: Data structure and convenience functions for creating bezier paths.
Copyright (C) 2000 Eazel, Inc.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Raph Levien <raph@artofcode.com>
*/
#include "config.h"
#include "rsvg-bpath-util.h"
#include <stdio.h>
#include <math.h>
#include <string.h>
#include <glib.h>
/* This is adapted from gnome-canvas-bpath-util in libgnomeprint
(originally developed as part of Gill). */
RsvgBpathDef *
rsvg_bpath_def_new (void)
{
RsvgBpathDef *bpd;
bpd = g_new (RsvgBpathDef, 1);
bpd->n_bpath = 0;
bpd->n_bpath_max = 16;
bpd->moveto_idx = -1;
bpd->bpath = g_new (RsvgBpath, bpd->n_bpath_max);
return bpd;
}
void
rsvg_bpath_def_free (RsvgBpathDef * bpd)
{
g_return_if_fail (bpd != NULL);
g_free (bpd->bpath);
g_free (bpd);
}
void
rsvg_bpath_def_moveto (RsvgBpathDef * bpd, double x, double y)
{
RsvgBpath *bpath;
int n_bpath;
g_return_if_fail (bpd != NULL);
/* if the last command was a moveto then change that last moveto instead of
creating a new one */
bpath = bpd->bpath;
n_bpath = bpd->n_bpath;
if (n_bpath > 0)
if (bpath[n_bpath - 1].code == CAIRO_PATH_MOVE_TO) {
bpath[n_bpath - 1].x3 = x;
bpath[n_bpath - 1].y3 = y;
bpd->moveto_idx = n_bpath - 1;
return;
}
n_bpath = bpd->n_bpath++;
if (n_bpath == bpd->n_bpath_max)
bpd->bpath = g_realloc (bpd->bpath, (bpd->n_bpath_max <<= 1) * sizeof (RsvgBpath));
bpath = bpd->bpath;
bpath[n_bpath].code = CAIRO_PATH_MOVE_TO;
bpath[n_bpath].x3 = x;
bpath[n_bpath].y3 = y;
bpd->moveto_idx = n_bpath;
}
void
rsvg_bpath_def_lineto (RsvgBpathDef * bpd, double x, double y)
{
RsvgBpath *bpath;
int n_bpath;
g_return_if_fail (bpd != NULL);
g_return_if_fail (bpd->moveto_idx >= 0);
n_bpath = bpd->n_bpath++;
if (n_bpath == bpd->n_bpath_max)
bpd->bpath = g_realloc (bpd->bpath, (bpd->n_bpath_max <<= 1) * sizeof (RsvgBpath));
bpath = bpd->bpath;
bpath[n_bpath].code = CAIRO_PATH_LINE_TO;
bpath[n_bpath].x3 = x;
bpath[n_bpath].y3 = y;
}
void
rsvg_bpath_def_curveto (RsvgBpathDef * bpd, double x1, double y1, double x2, double y2, double x3,
double y3)
{
RsvgBpath *bpath;
int n_bpath;
g_return_if_fail (bpd != NULL);
g_return_if_fail (bpd->moveto_idx >= 0);
n_bpath = bpd->n_bpath++;
if (n_bpath == bpd->n_bpath_max)
bpd->bpath = g_realloc (bpd->bpath, (bpd->n_bpath_max <<= 1) * sizeof (RsvgBpath));
bpath = bpd->bpath;
bpath[n_bpath].code = CAIRO_PATH_CURVE_TO;
bpath[n_bpath].x1 = x1;
bpath[n_bpath].y1 = y1;
bpath[n_bpath].x2 = x2;
bpath[n_bpath].y2 = y2;
bpath[n_bpath].x3 = x3;
bpath[n_bpath].y3 = y3;
}
static void
rsvg_bpath_def_replicate (RsvgBpathDef * bpd, int index)
{
RsvgBpath *bpath;
int n_bpath;
n_bpath = bpd->n_bpath++;
if (n_bpath == bpd->n_bpath_max)
bpd->bpath = g_realloc (bpd->bpath, (bpd->n_bpath_max <<= 1) * sizeof (RsvgBpath));
bpath = bpd->bpath;
bpath[n_bpath] = bpath[index];
}
void
rsvg_bpath_def_closepath (RsvgBpathDef * bpd)
{
RsvgBpath *bpath;
g_return_if_fail (bpd != NULL);
g_return_if_fail (bpd->moveto_idx >= 0);
g_return_if_fail (bpd->n_bpath > 0);
rsvg_bpath_def_replicate (bpd, bpd->moveto_idx);
bpath = bpd->bpath;
bpath[bpd->n_bpath - 1].code = CAIRO_PATH_CLOSE_PATH;
bpd->moveto_idx = bpd->n_bpath - 1;
}
void
rsvg_bpath_def_finish (RsvgBpathDef *bpd)
{
}
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/* vim: set sw=4 sts=4 ts=4 expandtab: */
/*
rsvg-bpath-util.h: Path utility functions
Copyright (C) 2000 Eazel, Inc.
Copyright (C) 2002 Dom Lachowicz <cinamod@hotmail.com>
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public
License along with this program; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Author: Raph Levien <raph@artofcode.com>
*/
#ifndef RSVG_BPATH_UTIL_H
#define RSVG_BPATH_UTIL_H
#include <glib.h>
#include <cairo.h>
G_BEGIN_DECLS
typedef struct _RsvgBpath RsvgBpath;
struct _RsvgBpath {
/*< public > */
cairo_path_data_type_t code;
double x1;
double y1;
double x2;
double y2;
double x3;
double y3;
};
typedef struct _RsvgBpathDef RsvgBpathDef;
struct _RsvgBpathDef {
RsvgBpath *bpath;
int n_bpath;
int n_bpath_max;
int moveto_idx;
};
RsvgBpathDef *rsvg_bpath_def_new (void);
void rsvg_bpath_def_free (RsvgBpathDef * bpd);
void rsvg_bpath_def_moveto (RsvgBpathDef * bpd, double x, double y);
void rsvg_bpath_def_lineto (RsvgBpathDef * bpd, double x, double y);
void rsvg_bpath_def_curveto (RsvgBpathDef * bpd,
double x1, double y1, double x2, double y2, double x3, double y3);
void rsvg_bpath_def_closepath (RsvgBpathDef * bpd);
void rsvg_bpath_def_finish (RsvgBpathDef * bpd);
G_END_DECLS
#endif
......@@ -31,7 +31,6 @@
#include "rsvg-cairo-clip.h"
#include "rsvg-cairo-render.h"
#include "rsvg-styles.h"
#include "rsvg-bpath-util.h"
#include "rsvg-path.h"
#include <math.h>
......@@ -62,14 +61,13 @@ rsvg_cairo_clip_apply_affine (RsvgCairoClipRender *render, cairo_matrix_t *affin
}
static void
rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const cairo_path_t *path)
{
RsvgCairoClipRender *render = RSVG_CAIRO_CLIP_RENDER (ctx->render);
RsvgCairoRender *cairo_render = &render->super;
RsvgState *state = rsvg_current_state (ctx);
cairo_t *cr;
RsvgBpath *bpath;
int i;
const cairo_path_data_t *data, *end;
cr = cairo_render->cr;
......@@ -77,21 +75,23 @@ rsvg_cairo_clip_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_de
cairo_set_fill_rule (cr, rsvg_current_state (ctx)->clip_rule);
for (i = 0; i < bpath_def->n_bpath; i++) {
bpath = &bpath_def->bpath[i];
switch (bpath->code) {
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);
/* fall-through */
break;
case CAIRO_PATH_MOVE_TO:
cairo_move_to (cr, bpath->x3, bpath->y3);
cairo_move_to (cr, data[1].point.x, data[1].point.y);
break;
case CAIRO_PATH_CURVE_TO:
cairo_curve_to (cr, bpath->x1, bpath->y1, bpath->x2, bpath->y2, bpath->x3, bpath->y3);
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, bpath->x3, bpath->y3);
cairo_line_to (cr, data[1].point.x, data[1].point.y);
break;
}
}
......
......@@ -31,7 +31,6 @@
#include "rsvg-cairo-render.h"
#include "rsvg-cairo-clip.h"
#include "rsvg-styles.h"
#include "rsvg-bpath-util.h"
#include "rsvg-path.h"
#include "rsvg-filter.h"
#include "rsvg-structure.h"
......@@ -437,16 +436,15 @@ rsvg_cairo_render_pango_layout (RsvgDrawingCtx * ctx, PangoLayout * layout, doub
}
void
rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const cairo_path_t *path)
{
RsvgCairoRender *render = RSVG_CAIRO_RENDER (ctx->render);
RsvgState *state = rsvg_current_state (ctx);
cairo_t *cr;
RsvgBpath *bpath;
int i;
int need_tmpbuf = 0;
RsvgBbox bbox;
double backup_tolerance;
const cairo_path_data_t *data, *end;
if (state->fill == NULL && state->stroke == NULL)
return;
......@@ -471,21 +469,23 @@ rsvg_cairo_render_path (RsvgDrawingCtx * ctx, const RsvgBpathDef * bpath_def)
cairo_set_dash (cr, state->dash.dash, state->dash.n_dash,
_rsvg_css_normalize_length (&state->dash.offset, ctx, 'o'));
for (i = 0; i < bpath_def->n_bpath; i++) {
bpath = &bpath_def->bpath[i];
switch (bpath->code) {
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);
/* fall-through */
break;
case CAIRO_PATH_MOVE_TO:
cairo_move_to (cr, bpath->x3, bpath->y3);
cairo_move_to (cr, data[1].point.x, data[1].point.y);
break;
case CAIRO_PATH_CURVE_TO:
cairo_curve_to (cr, bpath->x1, bpath->y1, bpath->x2, bpath->y2, bpath->x3, bpath->y3);
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, bpath->x3, bpath->y3);
cairo_line_to (cr, data[1].point.x, data[1].point.y);
break;
}
}
......
......@@ -36,7 +36,7 @@ PangoContext *rsvg_cairo_create_pango_context (RsvgDrawingCtx *ctx);
void rsvg_cairo_render_pango_layout (RsvgDrawingCtx *ctx, PangoLayout *layout,
double x, double y);
void rsvg_cairo_render_path (RsvgDrawingCtx *ctx,
const RsvgBpathDef * path);
const cairo_path_t *path);
void rsvg_cairo_render_image (RsvgDrawingCtx *ctx, const GdkPixbuf * img,
double x, double y, double w, double h);
void rsvg_cairo_push_discrete_layer (RsvgDrawingCtx *ctx);
......
......@@ -23,6 +23,8 @@
Authors: Caleb Moore <c.moore@student.unsw.edu.au>
*/
#include "config.h"
#include "rsvg-marker.h"
#include "rsvg-private.h"
#include "rsvg-styles.h"
......@@ -32,6 +34,7 @@
#include "rsvg-filter.h"
#include "rsvg-mask.h"
#include "rsvg-image.h"
#include "rsvg-path.h"
#include <string.h>
#include <math.h>
......@@ -208,14 +211,11 @@ rsvg_marker_parse (const RsvgDefs * defs, const char *str)
}
void
rsvg_render_markers (const RsvgBpathDef * bpath_def, RsvgDrawingCtx * ctx)
rsvg_render_markers (RsvgDrawingCtx * ctx,
const cairo_path_t *path)
{
int i;
int n_bpath, n_bpath_minus_1;
double x, y;
double lastx, lasty;
double nextx, nexty;
double linewidth;
cairo_path_data_type_t code, nextcode;
......@@ -223,6 +223,8 @@ rsvg_render_markers (const RsvgBpathDef * bpath_def, RsvgDrawingCtx * ctx)
RsvgMarker *startmarker;
RsvgMarker *middlemarker;
RsvgMarker *endmarker;
cairo_path_data_t *data, *nextdata, *end;
cairo_path_data_t nextp;
state = rsvg_current_state (ctx);
......@@ -239,35 +241,44 @@ rsvg_render_markers (const RsvgBpathDef * bpath_def, RsvgDrawingCtx * ctx)
x = 0;
y = 0;
nextx = bpath_def->bpath[0].x3;
nexty = bpath_def->bpath[0].y3;
nextcode = bpath_def->bpath[0].code;
n_bpath = bpath_def->n_bpath;
n_bpath_minus_1 = n_bpath - 1;
if (path->num_data <= 0)
return;
end = &path->data[path->num_data];
data = &path->data[0];
nextcode = data[0].header.type;
if (data[0].header.length > 1)
nextp = data[data[0].header.length - 1];
else
nextp.point.x = nextp.point.y = 0.;
for (i = 0; i < n_bpath; i++) {
for ( ; data < end; data = nextdata) {
lastx = x;
lasty = y;
x = nextx;
y = nexty;
x = nextp.point.x;
y = nextp.point.y;
code = nextcode;
if (i == n_bpath_minus_1) {
nextcode = CAIRO_PATH_MOVE_TO;
nextdata = data + data->header.length;
if (nextdata < end) {
nextcode = nextdata->header.type;
if (nextdata->header.length > 1) {
nextp = nextdata[nextdata->header.length - 1];
} else {
/* keep nextp unchanged */
}
} else {
nextx = bpath_def->bpath[i + 1].x3;
nexty = bpath_def->bpath[i + 1].y3;
nextcode = bpath_def->bpath[i + 1].code;
nextcode = CAIRO_PATH_MOVE_TO;
}
if (nextcode == CAIRO_PATH_CLOSE_PATH ||
nextcode == CAIRO_PATH_MOVE_TO) {
if (nextcode == CAIRO_PATH_MOVE_TO ||
code == CAIRO_PATH_CLOSE_PATH) {
if (endmarker) {
if (code == CAIRO_PATH_CURVE_TO) {
rsvg_marker_render (endmarker, x, y,
atan2 (y - bpath_def->bpath[i].y2,
x - bpath_def->bpath[i].x2),
atan2 (y - data[2].point.y,
x - data[2].point.x),
linewidth, ctx);
} else {
rsvg_marker_render (endmarker, x, y,
......@@ -275,20 +286,20 @@ rsvg_render_markers (const RsvgBpathDef * bpath_def, RsvgDrawingCtx * ctx)
linewidth, ctx);
}
}
} else if (code == CAIRO_PATH_CLOSE_PATH ||
code == CAIRO_PATH_MOVE_TO) {
} else if (code == CAIRO_PATH_MOVE_TO ||
code == CAIRO_PATH_CLOSE_PATH) {
if (startmarker) {
if (nextcode == CAIRO_PATH_CURVE_TO) {
rsvg_marker_render (startmarker, x, y,
atan2 (bpath_def->bpath[i + 1].y1 - y,
bpath_def->bpath[i + 1].x1 - x),
atan2 (nextdata[1].point.y - y,
nextdata[1].point.x - x),
linewidth,
ctx);
} else {
rsvg_marker_render (startmarker, x, y,
atan2 (nexty - y, nextx - x),
atan2 (nextp.point.y - y, nextp.point.x - x),
linewidth,
ctx);
ctx);
}
}
} else {
......@@ -296,18 +307,18 @@ rsvg_render_markers (const RsvgBpathDef * bpath_def, RsvgDrawingCtx * ctx)
double xdifin, ydifin, xdifout, ydifout, intot, outtot, angle;
if (code == CAIRO_PATH_CURVE_TO) {
xdifin = x - bpath_def->bpath[i].x2;
ydifin = y - bpath_def->bpath[i].y2;
xdifin = x - data[2].point.x;
ydifin = y - data[2].point.y;
} else {
xdifin = x - lastx;
ydifin = y - lasty;
}
if (nextcode == CAIRO_PATH_CURVE_TO) {
xdifout = bpath_def->bpath[i+1].x1 - x;
ydifout = bpath_def->bpath[i+1].y1 - y;
xdifout = nextdata[1].point.x - x;
ydifout = nextdata[1].point.y - y;
} else {
xdifout = nextx - x;
ydifout = nexty - y;
xdifout = nextp.point.x - x;
ydifout = nextp.point.y - y;
}
intot = sqrt (xdifin * xdifin + ydifin * ydifin);
......
......@@ -46,7 +46,7 @@ RsvgNode *rsvg_new_marker (void);
void rsvg_marker_render (RsvgMarker * self, gdouble x, gdouble y,
gdouble orient, gdouble linewidth, RsvgDrawingCtx * ctx);
RsvgNode *rsvg_marker_parse (const RsvgDefs * defs, const char *str);
void rsvg_render_markers (const RsvgBpathDef * bpath_def, RsvgDrawingCtx * ctx);
void rsvg_render_markers (RsvgDrawingCtx *ctx, const cairo_path_t *path);
G_END_DECLS
......
......@@ -4,6 +4,7 @@
rsvg-path.c: Parse SVG path element data into bezier path.
Copyright (C) 2000 Eazel, Inc.
Copyright © 2011 Christian Persch
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public License as
......@@ -36,7 +37,7 @@
#include "rsvg-private.h"
/* This module parses an SVG path element into an RsvgBpathDef.
/* This module parses an SVG path element into an cairo_path_t.
At present, there is no support for <marker> or any other contextual
information from the SVG file. The API will need to change rather
......@@ -48,15 +49,112 @@
typedef struct _RSVGParsePathCtx RSVGParsePathCtx;
struct _RSVGParsePathCtx {
RsvgBpathDef *bpath;
double cpx, cpy; /* current point */
double rpx, rpy; /* reflection point (for 's' and 't' commands) */
GArray *path_data;
int last_move_to_index;
cairo_path_data_t cp; /* current point */
cairo_path_data_t rp; /* reflection point (for 's' and 't' commands) */
char cmd; /* current command (lowercase) */
int param; /* parameter number */
gboolean rel; /* true if relative coords */
double params[7]; /* parameters that have been parsed */
};
static inline void
rsvg_path_ensure_capacity (RSVGParsePathCtx *ctx,
int additional_capacity)
{
}
static inline void
rsvg_path_add_element (RSVGParsePathCtx *ctx,
cairo_path_data_t *data)
{
g_array_append_val (ctx->path_data, *data);
}
static void
rsvg_path_moveto (RSVGParsePathCtx *ctx,
double x,
double y)
{
cairo_path_data_t data;
rsvg_path_ensure_capacity (ctx, 2);
data.header.type = CAIRO_PATH_MOVE_TO;
data.header.length = 2;
rsvg_path_add_element (ctx, &data);
ctx->last_move_to_index = ctx->path_data->len - 1;
data.point.x = x;
data.point.y = y;
rsvg_path_add_element (ctx, &data);
}
static void
rsvg_path_lineto (RSVGParsePathCtx *ctx,
double x,
double y)
{
cairo_path_data_t data;
rsvg_path_ensure_capacity (ctx, 2);
data.header.type = CAIRO_PATH_LINE_TO;
data.header.length = 2;
rsvg_path_add_element (ctx, &data);
data.point.x = x;
data.point.y = y;
rsvg_path_add_element (ctx, &data);
}
static void
rsvg_path_curveto (RSVGParsePathCtx *ctx,
double x1,
double y1,
double x2,
double y2,
double x3,
double y3)
{
cairo_path_data_t data;
rsvg_path_ensure_capacity (ctx, 4);
data.header.type = CAIRO_PATH_CURVE_TO;
data.header.length = 4;
rsvg_path_add_element (ctx, &data);
data.point.x = x1;
data.point.y = y1;
rsvg_path_add_element (ctx, &data);
data.point.x = x2;
data.point.y = y2;
rsvg_path_add_element (ctx, &data);
data.point.x = x3;
data.point.y = y3;
rsvg_path_add_element (ctx, &data);
}
static void
rsvg_path_close_path (RSVGParsePathCtx *ctx)
{
cairo_path_data_t data;
rsvg_path_ensure_capacity (ctx, 1);
data.header.type = CAIRO_PATH_CLOSE_PATH;
data.header.length = 1;
rsvg_path_add_element (ctx, &data);
/* Add a 'move-to' element */
if (ctx->last_move_to_index >= 0) {
cairo_path_data_t *moveto = &g_array_index (ctx->path_data, cairo_path_data_t, ctx->last_move_to_index);
rsvg_path_moveto (ctx, moveto[1].point.x, moveto[1].point.y);
}
}
static void
rsvg_path_arc_segment (RSVGParsePathCtx * ctx,
double xc, double yc,
......@@ -81,7 +179,7 @@ rsvg_path_arc_segment (RSVGParsePathCtx * ctx,
x2 = x3 + rx*(t * sin (th1));
y2 = y3 + ry*(-t * cos (th1));
rsvg_bpath_def_curveto (ctx->bpath,
rsvg_path_curveto (ctx,
xc + cosf*x1 - sinf*y1,
yc + sinf*x1 + cosf*y1,
xc + cosf*x2 - sinf*y2,
......@@ -122,8 +220,8 @@ rsvg_path_arc (RSVGParsePathCtx * ctx,
int i, n_segs;
/* Start and end of path segment */
x1 = ctx->cpx;
y1 = ctx->cpy;
x1 = ctx->cp.point.x;
y1 = ctx->cp.point.y;
x2 = x;
y2 = y;
......@@ -139,7 +237,7 @@ rsvg_path_arc (RSVGParsePathCtx * ctx,
/* Check the radius against floading point underflow.
See http://bugs.debian.org/508443 */
if ((fabs(rx) < DBL_EPSILON) || (fabs(ry) < DBL_EPSILON)) {
rsvg_bpath_def_lineto (ctx->bpath, x, y);
rsvg_path_lineto (ctx, x, y);
return;
}
......@@ -216,8 +314,8 @@ rsvg_path_arc (RSVGParsePathCtx * ctx,
theta1 + (i + 1) * delta_theta / n_segs,
rx, ry, x_axis_rotation);
ctx->cpx = x;
ctx->cpy = y;
ctx->cp.point.x = x;
ctx->cp.point.y = y;
}