From 1323675852c82c8dbc79b46d7bfd882e3282edc0 Mon Sep 17 00:00:00 2001 From: Tor Andersson Date: Tue, 31 May 2011 17:33:15 +0200 Subject: Use fz_atof in XPS interpreter. --- xps/xps_common.c | 10 +++--- xps/xps_glyphs.c | 8 ++--- xps/xps_gradient.c | 6 ++-- xps/xps_path.c | 94 +++++++++++++++++++++++++++--------------------------- 4 files changed, 59 insertions(+), 59 deletions(-) diff --git a/xps/xps_common.c b/xps/xps_common.c index 17716839..4e3c30b5 100644 --- a/xps/xps_common.c +++ b/xps/xps_common.c @@ -49,14 +49,14 @@ xps_begin_opacity(xps_context *ctx, fz_matrix ctm, fz_rect area, opacity = 1; if (opacity_att) - opacity = atof(opacity_att); + opacity = fz_atof(opacity_att); if (opacity_mask_tag && !strcmp(xml_tag(opacity_mask_tag), "SolidColorBrush")) { char *scb_opacity_att = xml_att(opacity_mask_tag, "Opacity"); char *scb_color_att = xml_att(opacity_mask_tag, "Color"); if (scb_opacity_att) - opacity = opacity * atof(scb_opacity_att); + opacity = opacity * fz_atof(scb_opacity_att); if (scb_color_att) { fz_colorspace *colorspace; @@ -111,7 +111,7 @@ xps_parse_render_transform(xps_context *ctx, char *transform, fz_matrix *matrix) for (i = 0; i < 6 && *s; i++) { - args[i] = atof(s); + args[i] = fz_atof(s); while (*s && *s != ',') s++; if (*s == ',') @@ -150,7 +150,7 @@ xps_parse_rectangle(xps_context *ctx, char *text, fz_rect *rect) for (i = 0; i < 4 && *s; i++) { - args[i] = atof(s); + args[i] = fz_atof(s); while (*s && *s != ',') s++; if (*s == ',') @@ -247,7 +247,7 @@ xps_parse_color(xps_context *ctx, char *base_uri, char *string, i = 0; while (i < n) { - samples[i++] = atof(p); + samples[i++] = fz_atof(p); p = strchr(p, ','); if (!p) break; diff --git a/xps/xps_glyphs.c b/xps/xps_glyphs.c index 71c0b2a8..4b7a8ceb 100644 --- a/xps/xps_glyphs.c +++ b/xps/xps_glyphs.c @@ -210,7 +210,7 @@ xps_parse_real_num(char *s, float *number) *p++ = *s++; *p = 0; if (buf[0]) - *number = atof(buf); + *number = fz_atof(buf); return s; } @@ -531,10 +531,10 @@ xps_parse_glyphs(xps_context *ctx, fz_matrix ctm, if (clip_att || clip_tag) xps_clip(ctx, ctm, dict, clip_att, clip_tag); - font_size = atof(font_size_att); + font_size = fz_atof(font_size_att); text = xps_parse_glyphs_imp(ctx, ctm, font, font_size, - atof(origin_x_att), atof(origin_y_att), + fz_atof(origin_x_att), fz_atof(origin_y_att), is_sideways, bidi_level, indices_att, unicode_att); area = fz_bound_text(text, ctm); @@ -557,7 +557,7 @@ xps_parse_glyphs(xps_context *ctx, fz_matrix ctm, xps_parse_color(ctx, base_uri, fill_att, &colorspace, samples); if (fill_opacity_att) - samples[0] = atof(fill_opacity_att); + samples[0] = fz_atof(fill_opacity_att); xps_set_color(ctx, colorspace, samples); fz_fill_text(ctx->dev, text, ctm, diff --git a/xps/xps_gradient.c b/xps/xps_gradient.c index 9f560b48..f73d33fe 100644 --- a/xps/xps_gradient.c +++ b/xps/xps_gradient.c @@ -57,7 +57,7 @@ xps_parse_gradient_stops(xps_context *ctx, char *base_uri, xml_element *node, char *color = xml_att(node, "Color"); if (offset && color) { - stops[count].offset = atof(offset); + stops[count].offset = fz_atof(offset); xps_parse_color(ctx, base_uri, color, &colorspace, sample); @@ -317,9 +317,9 @@ xps_draw_radial_gradient(xps_context *ctx, fz_matrix ctm, if (center_att) sscanf(center_att, "%g,%g", &x1, &y1); if (radius_x_att) - xrad = atof(radius_x_att); + xrad = fz_atof(radius_x_att); if (radius_y_att) - yrad = atof(radius_y_att); + yrad = fz_atof(radius_y_att); /* scale the ctm to make ellipses */ ctm = fz_concat(fz_scale(1, yrad / xrad), ctm); diff --git a/xps/xps_path.c b/xps/xps_path.c index c2444779..3cc98379 100644 --- a/xps/xps_path.c +++ b/xps/xps_path.c @@ -291,54 +291,54 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) break; case 'M': - fz_moveto(path, atof(args[i]), atof(args[i+1])); + fz_moveto(path, fz_atof(args[i]), fz_atof(args[i+1])); i += 2; break; case 'm': pt = fz_currentpoint(path); - fz_moveto(path, pt.x + atof(args[i]), pt.y + atof(args[i+1])); + fz_moveto(path, pt.x + fz_atof(args[i]), pt.y + fz_atof(args[i+1])); i += 2; break; case 'L': - fz_lineto(path, atof(args[i]), atof(args[i+1])); + fz_lineto(path, fz_atof(args[i]), fz_atof(args[i+1])); i += 2; break; case 'l': pt = fz_currentpoint(path); - fz_lineto(path, pt.x + atof(args[i]), pt.y + atof(args[i+1])); + fz_lineto(path, pt.x + fz_atof(args[i]), pt.y + fz_atof(args[i+1])); i += 2; break; case 'H': pt = fz_currentpoint(path); - fz_lineto(path, atof(args[i]), pt.y); + fz_lineto(path, fz_atof(args[i]), pt.y); i += 1; break; case 'h': pt = fz_currentpoint(path); - fz_lineto(path, pt.x + atof(args[i]), pt.y); + fz_lineto(path, pt.x + fz_atof(args[i]), pt.y); i += 1; break; case 'V': pt = fz_currentpoint(path); - fz_lineto(path, pt.x, atof(args[i])); + fz_lineto(path, pt.x, fz_atof(args[i])); i += 1; break; case 'v': pt = fz_currentpoint(path); - fz_lineto(path, pt.x, pt.y + atof(args[i])); + fz_lineto(path, pt.x, pt.y + fz_atof(args[i])); i += 1; break; case 'C': - x1 = atof(args[i+0]); - y1 = atof(args[i+1]); - x2 = atof(args[i+2]); - y2 = atof(args[i+3]); - x3 = atof(args[i+4]); - y3 = atof(args[i+5]); + x1 = fz_atof(args[i+0]); + y1 = fz_atof(args[i+1]); + x2 = fz_atof(args[i+2]); + y2 = fz_atof(args[i+3]); + x3 = fz_atof(args[i+4]); + y3 = fz_atof(args[i+5]); fz_curveto(path, x1, y1, x2, y2, x3, y3); i += 6; reset_smooth = 0; @@ -348,12 +348,12 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) case 'c': pt = fz_currentpoint(path); - x1 = atof(args[i+0]) + pt.x; - y1 = atof(args[i+1]) + pt.y; - x2 = atof(args[i+2]) + pt.x; - y2 = atof(args[i+3]) + pt.y; - x3 = atof(args[i+4]) + pt.x; - y3 = atof(args[i+5]) + pt.y; + x1 = fz_atof(args[i+0]) + pt.x; + y1 = fz_atof(args[i+1]) + pt.y; + x2 = fz_atof(args[i+2]) + pt.x; + y2 = fz_atof(args[i+3]) + pt.y; + x3 = fz_atof(args[i+4]) + pt.x; + y3 = fz_atof(args[i+5]) + pt.y; fz_curveto(path, x1, y1, x2, y2, x3, y3); i += 6; reset_smooth = 0; @@ -363,10 +363,10 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) case 'S': pt = fz_currentpoint(path); - x1 = atof(args[i+0]); - y1 = atof(args[i+1]); - x2 = atof(args[i+2]); - y2 = atof(args[i+3]); + x1 = fz_atof(args[i+0]); + y1 = fz_atof(args[i+1]); + x2 = fz_atof(args[i+2]); + y2 = fz_atof(args[i+3]); fz_curveto(path, pt.x + smooth_x, pt.y + smooth_y, x1, y1, x2, y2); i += 4; reset_smooth = 0; @@ -376,10 +376,10 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) case 's': pt = fz_currentpoint(path); - x1 = atof(args[i+0]) + pt.x; - y1 = atof(args[i+1]) + pt.y; - x2 = atof(args[i+2]) + pt.x; - y2 = atof(args[i+3]) + pt.y; + x1 = fz_atof(args[i+0]) + pt.x; + y1 = fz_atof(args[i+1]) + pt.y; + x2 = fz_atof(args[i+2]) + pt.x; + y2 = fz_atof(args[i+3]) + pt.y; fz_curveto(path, pt.x + smooth_x, pt.y + smooth_y, x1, y1, x2, y2); i += 4; reset_smooth = 0; @@ -389,10 +389,10 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) case 'Q': pt = fz_currentpoint(path); - x1 = atof(args[i+0]); - y1 = atof(args[i+1]); - x2 = atof(args[i+2]); - y2 = atof(args[i+3]); + x1 = fz_atof(args[i+0]); + y1 = fz_atof(args[i+1]); + x2 = fz_atof(args[i+2]); + y2 = fz_atof(args[i+3]); fz_curveto(path, (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3, (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3, @@ -401,10 +401,10 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) break; case 'q': pt = fz_currentpoint(path); - x1 = atof(args[i+0]) + pt.x; - y1 = atof(args[i+1]) + pt.y; - x2 = atof(args[i+2]) + pt.x; - y2 = atof(args[i+3]) + pt.y; + x1 = fz_atof(args[i+0]) + pt.x; + y1 = fz_atof(args[i+1]) + pt.y; + x2 = fz_atof(args[i+2]) + pt.x; + y2 = fz_atof(args[i+3]) + pt.y; fz_curveto(path, (pt.x + 2 * x1) / 3, (pt.y + 2 * y1) / 3, (x2 + 2 * x1) / 3, (y2 + 2 * y1) / 3, @@ -414,17 +414,17 @@ xps_parse_abbreviated_geometry(xps_context *ctx, char *geom, int *fill_rule) case 'A': xps_draw_arc(path, - atof(args[i+0]), atof(args[i+1]), atof(args[i+2]), + fz_atof(args[i+0]), fz_atof(args[i+1]), fz_atof(args[i+2]), atoi(args[i+3]), atoi(args[i+4]), - atof(args[i+5]), atof(args[i+6])); + fz_atof(args[i+5]), fz_atof(args[i+6])); i += 7; break; case 'a': pt = fz_currentpoint(path); xps_draw_arc(path, - atof(args[i+0]), atof(args[i+1]), atof(args[i+2]), + fz_atof(args[i+0]), fz_atof(args[i+1]), fz_atof(args[i+2]), atoi(args[i+3]), atoi(args[i+4]), - atof(args[i+5]) + pt.x, atof(args[i+6]) + pt.y); + fz_atof(args[i+5]) + pt.x, fz_atof(args[i+6]) + pt.y); i += 7; break; @@ -480,7 +480,7 @@ xps_parse_arc_segment(fz_path *path, xml_element *root, int stroking, int *skipp sscanf(point_att, "%g,%g", &point_x, &point_y); sscanf(size_att, "%g,%g", &size_x, &size_y); - rotation_angle = atof(rotation_angle_att); + rotation_angle = fz_atof(rotation_angle_att); is_large_arc = !strcmp(is_large_arc_att, "true"); is_clockwise = !strcmp(sweep_direction_att, "Clockwise"); @@ -894,11 +894,11 @@ xps_parse_path(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *di stroke.miterlimit = 10; if (stroke_miter_limit_att) - stroke.miterlimit = atof(stroke_miter_limit_att); + stroke.miterlimit = fz_atof(stroke_miter_limit_att); stroke.linewidth = 1; if (stroke_thickness_att) - stroke.linewidth = atof(stroke_thickness_att); + stroke.linewidth = fz_atof(stroke_thickness_att); stroke.dash_phase = 0; stroke.dash_len = 0; @@ -907,13 +907,13 @@ xps_parse_path(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *di char *s = stroke_dash_array_att; if (stroke_dash_offset_att) - stroke.dash_phase = atof(stroke_dash_offset_att) * stroke.linewidth; + stroke.dash_phase = fz_atof(stroke_dash_offset_att) * stroke.linewidth; while (*s && stroke.dash_len < nelem(stroke.dash_list)) { while (*s == ' ') s++; - stroke.dash_list[stroke.dash_len++] = atof(s) * stroke.linewidth; + stroke.dash_list[stroke.dash_len++] = fz_atof(s) * stroke.linewidth; while (*s && *s != ' ') s++; } @@ -946,7 +946,7 @@ xps_parse_path(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *di { xps_parse_color(ctx, base_uri, fill_att, &colorspace, samples); if (fill_opacity_att) - samples[0] = atof(fill_opacity_att); + samples[0] = fz_atof(fill_opacity_att); xps_set_color(ctx, colorspace, samples); fz_fill_path(ctx->dev, path, fill_rule == 0, ctm, @@ -966,7 +966,7 @@ xps_parse_path(xps_context *ctx, fz_matrix ctm, char *base_uri, xps_resource *di { xps_parse_color(ctx, base_uri, stroke_att, &colorspace, samples); if (stroke_opacity_att) - samples[0] = atof(stroke_opacity_att); + samples[0] = fz_atof(stroke_opacity_att); xps_set_color(ctx, colorspace, samples); fz_stroke_path(ctx->dev, path, &stroke, ctm, -- cgit v1.2.3