diff options
Diffstat (limited to 'source/fitz/svg-device.c')
-rw-r--r-- | source/fitz/svg-device.c | 55 |
1 files changed, 27 insertions, 28 deletions
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index c5905938..28f3a4d6 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -173,7 +173,7 @@ svg_dev_stroke_state(fz_context *ctx, svg_device *sdev, const fz_stroke_state *s fz_output *out = sdev->out; float exp; - exp = fz_matrix_expansion(ctm); + exp = fz_matrix_expansion(*ctm); if (exp == 0) exp = 1; exp = stroke_state->linewidth/exp; @@ -269,13 +269,13 @@ find_first_char(fz_context *ctx, const fz_text_span *span, int i) } static int -find_next_line_break(fz_context *ctx, const fz_text_span *span, const fz_matrix *inv_tm, int i) +find_next_line_break(fz_context *ctx, const fz_text_span *span, fz_matrix inv_tm, int i) { fz_point p, old_p; old_p.x = span->items[i].x; old_p.y = span->items[i].y; - fz_transform_point(&old_p, inv_tm); + old_p = fz_transform_point(old_p, inv_tm); for (++i; i < span->len; ++i) { @@ -283,7 +283,7 @@ find_next_line_break(fz_context *ctx, const fz_text_span *span, const fz_matrix { p.x = span->items[i].x; p.y = span->items[i].y; - fz_transform_point(&p, inv_tm); + p = fz_transform_point(p, inv_tm); if (span->wmode == 0) { if (p.y != old_p.y) @@ -332,15 +332,15 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const } tm = span->trm; - font_size = fz_matrix_expansion(&tm); + font_size = fz_matrix_expansion(tm); final_tm.a = tm.a / font_size; final_tm.b = tm.b / font_size; final_tm.c = -tm.c / font_size; final_tm.d = -tm.d / font_size; final_tm.e = 0; final_tm.f = 0; - fz_invert_matrix(&inv_tm, &final_tm); - fz_concat(&final_tm, &final_tm, ctm); + inv_tm = fz_invert_matrix(final_tm); + final_tm = fz_concat(final_tm, *ctm); tm.e = span->items[0].x; tm.f = span->items[0].y; @@ -362,11 +362,11 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const start = find_first_char(ctx, span, 0); while (start < span->len) { - end = find_next_line_break(ctx, span, &inv_tm, start); + end = find_next_line_break(ctx, span, inv_tm, start); p.x = span->items[start].x; p.y = span->items[start].y; - fz_transform_point(&p, &inv_tm); + p = fz_transform_point(p, inv_tm); if (span->items[start].gid >= 0) cluster_advance = svg_cluster_advance(ctx, span, start, end); if (span->wmode == 0) @@ -384,7 +384,7 @@ svg_dev_text_span(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm, const { p.x = it->x; p.y = it->y; - fz_transform_point(&p, &inv_tm); + p = fz_transform_point(p, inv_tm); } else { @@ -476,10 +476,10 @@ svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *s path = fz_outline_glyph(ctx, span->font, gid, &fz_identity); if (path) { - fz_bound_path(ctx, path, NULL, &fz_identity, &rect); + rect = fz_bound_path(ctx, path, NULL, fz_identity); shift.e = -rect.x0; shift.f = -rect.y0; - fz_transform_path(ctx, path, &shift); + fz_transform_path(ctx, path, shift); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<symbol id=\"font_%x_%x\">\n", fnt->id, gid); fz_write_printf(ctx, out, "<path"); @@ -489,7 +489,7 @@ svg_dev_text_span_as_paths_defs(fz_context *ctx, fz_device *dev, fz_text_span *s } else { - fz_bound_glyph(ctx, span->font, gid, &fz_identity, &rect); + rect = fz_bound_glyph(ctx, span->font, gid, fz_identity); shift.e = -rect.x0; shift.f = -rect.y0; out = start_def(ctx, sdev); @@ -536,8 +536,8 @@ svg_dev_text_span_as_paths_fill(fz_context *ctx, fz_device *dev, const fz_text_s shift.f = fnt->sentlist[gid].y_off; local_trm.e = it->x; local_trm.f = it->y; - fz_concat(&local_trm2, &local_trm, ctm); - fz_concat(&local_trm2, &shift, &local_trm2); + local_trm2 = fz_concat(local_trm, *ctm); + local_trm2 = fz_concat(shift, local_trm2); fz_write_printf(ctx, out, "<use xlink:href=\"#font_%x_%x\"", fnt->id, gid); svg_dev_ctm(ctx, sdev, &local_trm2); svg_dev_fill_color(ctx, sdev, colorspace, color, alpha, color_params); @@ -576,8 +576,8 @@ svg_dev_text_span_as_paths_stroke(fz_context *ctx, fz_device *dev, const fz_text shift.f = fnt->sentlist[gid].y_off; local_trm.e = it->x; local_trm.f = it->y; - fz_concat(&local_trm2, &local_trm, ctm); - fz_concat(&local_trm2, &shift, &local_trm2); + local_trm2 = fz_concat(local_trm, *ctm); + local_trm2 = fz_concat(shift, local_trm2); fz_write_printf(ctx, out, "<use xlink:href=\"#font_%x_%x\"", fnt->id, gid); svg_dev_stroke_state(ctx, sdev, stroke, &local_trm2); svg_dev_ctm(ctx, sdev, &local_trm2); @@ -649,7 +649,7 @@ svg_dev_clip_stroke_path(fz_context *ctx, fz_device *dev, const fz_path *path, c int num = sdev->id++; float white[3] = { 1, 1, 1 }; - fz_bound_path(ctx, path, stroke, ctm, &bounds); + bounds = fz_bound_path(ctx, path, stroke, *ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\" maskUnits=\"userSpaceOnUse\" maskContentUnits=\"userSpaceOnUse\">\n", @@ -732,7 +732,7 @@ svg_dev_clip_text(fz_context *ctx, fz_device *dev, const fz_text *text, const fz font *fnt; fz_text_span *span; - fz_bound_text(ctx, text, NULL, ctm, &bounds); + bounds = fz_bound_text(ctx, text, NULL, *ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"", @@ -772,7 +772,7 @@ svg_dev_clip_stroke_text(fz_context *ctx, fz_device *dev, const fz_text *text, c font *fnt; fz_text_span *span; - fz_bound_text(ctx, text, NULL, ctm, &bounds); + bounds = fz_bound_text(ctx, text, NULL, *ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\" x=\"%g\" y=\"%g\" width=\"%g\" height=\"%g\"", @@ -890,7 +890,7 @@ svg_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma scale.a = 1.0f / image->w; scale.d = 1.0f / image->h; - fz_concat(&local_ctm, &scale, ctm); + local_ctm = fz_concat(scale, *ctm); fz_write_printf(ctx, out, "<g"); if (alpha != 1.0f) fz_write_printf(ctx, out, " opacity=\"%g\"", alpha); @@ -905,7 +905,6 @@ svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma { svg_device *sdev = (svg_device*)dev; fz_output *out = sdev->out; - fz_rect rect; fz_irect bbox; fz_pixmap *pix; fz_buffer *buf = NULL; @@ -915,10 +914,10 @@ svg_dev_fill_shade(fz_context *ctx, fz_device *dev, fz_shade *shade, const fz_ma if (dev->container_len == 0) return; - fz_round_rect(&bbox, fz_intersect_rect(fz_bound_shade(ctx, shade, ctm, &rect), &dev->container[dev->container_len-1].scissor)); - if (fz_is_empty_irect(&bbox)) + bbox = fz_round_rect(fz_intersect_rect(fz_bound_shade(ctx, shade, *ctm), dev->container[dev->container_len-1].scissor)); + if (fz_is_empty_irect(bbox)) return; - pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), &bbox, NULL, 1); + pix = fz_new_pixmap_with_bbox(ctx, fz_device_rgb(ctx), bbox, NULL, 1); fz_clear_pixmap(ctx, pix); fz_try(ctx) @@ -957,7 +956,7 @@ svg_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const scale.a = 1.0f / image->w; scale.d = 1.0f / image->h; - fz_concat(&local_ctm, &scale, ctm); + local_ctm = fz_concat(scale, *ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\">\n", mask); svg_send_image(ctx, sdev, image, color_params); @@ -981,7 +980,7 @@ svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const scale.a = 1.0f / image->w; scale.d = 1.0f / image->h; - fz_concat(&local_ctm, &scale, ctm); + local_ctm = fz_concat(scale, *ctm); out = start_def(ctx, sdev); fz_write_printf(ctx, out, "<mask id=\"ma%d\">\n<g", mask); svg_dev_ctm(ctx, sdev, &local_ctm); @@ -1139,7 +1138,7 @@ svg_dev_end_tile(fz_context *ctx, fz_device *dev) /* All the pattern contents will have their own ctm applied. Let's * undo the current one to allow for this */ - fz_invert_matrix(&inverse, &t->ctm); + inverse = fz_invert_matrix(t->ctm); fz_write_printf(ctx, out, "<g"); svg_dev_ctm(ctx, sdev, &inverse); fz_write_printf(ctx, out, ">\n"); |