diff options
Diffstat (limited to 'source/svg')
-rw-r--r-- | source/svg/svg-doc.c | 10 | ||||
-rw-r--r-- | source/svg/svg-parse.c | 14 | ||||
-rw-r--r-- | source/svg/svg-run.c | 16 |
3 files changed, 18 insertions, 22 deletions
diff --git a/source/svg/svg-doc.c b/source/svg/svg-doc.c index a651c9ae..89ff148c 100644 --- a/source/svg/svg-doc.c +++ b/source/svg/svg-doc.c @@ -23,19 +23,15 @@ svg_count_pages(fz_context *ctx, fz_document *doc_) return 1; } -static fz_rect * -svg_bound_page(fz_context *ctx, fz_page *page_, fz_rect *rect) +static fz_rect +svg_bound_page(fz_context *ctx, fz_page *page_) { svg_page *page = (svg_page*)page_; svg_document *doc = page->doc; svg_parse_document_bounds(ctx, doc, fz_xml_root(doc->xml)); - rect->x0 = 0; - rect->y0 = 0; - rect->x1 = doc->width; - rect->y1 = doc->height; - return rect; + return fz_make_rect(0, 0, doc->width, doc->height); } static void diff --git a/source/svg/svg-parse.c b/source/svg/svg-parse.c index e5bf93a2..5c7fc33a 100644 --- a/source/svg/svg-parse.c +++ b/source/svg/svg-parse.c @@ -214,7 +214,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr m.e = args[4]; m.f = args[5]; - fz_concat(transform, transform, &m); + *transform = fz_concat(*transform, m); } else if (!strcmp(keyword, "translate")) @@ -222,15 +222,15 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr if (nargs != 2) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to translate(): %d", nargs); - fz_pre_translate(transform, args[0], args[1]); + *transform = fz_pre_translate(*transform, args[0], args[1]); } else if (!strcmp(keyword, "scale")) { if (nargs == 1) - fz_pre_scale(transform, args[0], args[0]); + *transform = fz_pre_scale(*transform, args[0], args[0]); else if (nargs == 2) - fz_pre_scale(transform, args[0], args[1]); + *transform = fz_pre_scale(*transform, args[0], args[1]); else fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to scale(): %d", nargs); } @@ -239,7 +239,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr { if (nargs != 1) fz_throw(ctx, FZ_ERROR_SYNTAX, "wrong number of arguments to rotate(): %d", nargs); - fz_pre_rotate(transform, args[0]); + *transform = fz_pre_rotate(*transform, args[0]); } else if (!strcmp(keyword, "skewX")) @@ -256,7 +256,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr m.e = 0; m.f = 0; - fz_concat(transform, transform, &m); + *transform = fz_concat(*transform, m); } else if (!strcmp(keyword, "skewY")) @@ -273,7 +273,7 @@ svg_parse_transform(fz_context *ctx, svg_document *doc, char *str, fz_matrix *tr m.e = 0; m.f = 0; - fz_concat(transform, transform, &m); + *transform = fz_concat(*transform, m); } else diff --git a/source/svg/svg-run.c b/source/svg/svg-run.c index 19e49836..a3e6193f 100644 --- a/source/svg/svg-run.c +++ b/source/svg/svg-run.c @@ -330,7 +330,7 @@ svg_add_arc_segment(fz_context *ctx, fz_path *path, const fz_matrix *mtx, float { for (t = th0 + d; t < th1 - d/2; t += d) { - fz_transform_point_xy(&p, mtx, cosf(t), sinf(t)); + p = fz_transform_point_xy(cosf(t), sinf(t), *mtx); fz_lineto(ctx, path, p.x, p.y); } } @@ -339,7 +339,7 @@ svg_add_arc_segment(fz_context *ctx, fz_path *path, const fz_matrix *mtx, float th0 += FZ_PI * 2; for (t = th0 - d; t > th1 + d/2; t -= d) { - fz_transform_point_xy(&p, mtx, cosf(t), sinf(t)); + p = fz_transform_point_xy(cosf(t), sinf(t), *mtx); fz_lineto(ctx, path, p.x, p.y); } } @@ -390,8 +390,8 @@ svg_add_arc(fz_context *ctx, fz_path *path, else sign = -1; - fz_rotate(&rotmat, rotation_angle); - fz_rotate(&revmat, -rotation_angle); + rotmat = fz_rotate(rotation_angle); + revmat = fz_rotate(-rotation_angle); /* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes */ /* Conversion from endpoint to center parameterization */ @@ -408,7 +408,7 @@ svg_add_arc(fz_context *ctx, fz_path *path, /* F.6.5.1 */ pt.x = (x1 - x2) / 2; pt.y = (y1 - y2) / 2; - fz_transform_vector(&pt, &revmat); + pt = fz_transform_vector(pt, revmat); x1t = pt.x; y1t = pt.y; @@ -434,7 +434,7 @@ svg_add_arc(fz_context *ctx, fz_path *path, /* F.6.5.3 */ pt.x = cxt; pt.y = cyt; - fz_transform_vector(&pt, &rotmat); + pt = fz_transform_vector(pt, rotmat); cx = pt.x + (x1 + x2) / 2; cy = pt.y + (y1 + y2) / 2; @@ -457,7 +457,7 @@ svg_add_arc(fz_context *ctx, fz_path *path, dth -= ((FZ_PI / 180) * 360); } - fz_pre_scale(fz_pre_rotate(fz_translate(&mtx, cx, cy), rotation_angle), rx, ry); + mtx = fz_pre_scale(fz_pre_rotate(fz_translate(cx, cy), rotation_angle), rx, ry); svg_add_arc_segment(ctx, path, &mtx, th1, th1 + dth, is_clockwise); fz_lineto(ctx, path, point_x, point_y); @@ -1037,7 +1037,7 @@ svg_run_use(fz_context *ctx, fz_device *dev, svg_document *doc, fz_xml *root, co if (x_att) x = svg_parse_length(x_att, local_state.viewbox_w, local_state.fontsize); if (y_att) y = svg_parse_length(y_att, local_state.viewbox_h, local_state.fontsize); - fz_pre_translate(&local_state.transform, x, y); + local_state.transform = fz_pre_translate(local_state.transform, x, y); if (xlink_href_att && xlink_href_att[0] == '#') { |