summaryrefslogtreecommitdiff
path: root/source/svg
diff options
context:
space:
mode:
authorSebastian Rasmussen <sebras@gmail.com>2017-05-29 00:10:28 +0800
committerSebastian Rasmussen <sebras@gmail.com>2017-05-31 20:29:30 +0800
commit2d68de96c62c1e6d6a2b615336d99b671fc672b7 (patch)
treec309b8fdf623a0fd56aebc38c863b596e23c379f /source/svg
parent73d7b296bd549a7e985ea9df9f13e6ad3701ef89 (diff)
downloadmupdf-2d68de96c62c1e6d6a2b615336d99b671fc672b7.tar.xz
Avoid double literals causing casts to float.
Diffstat (limited to 'source/svg')
-rw-r--r--source/svg/svg-color.c22
-rw-r--r--source/svg/svg-parse.c16
-rw-r--r--source/svg/svg-run.c20
3 files changed, 29 insertions, 29 deletions
diff --git a/source/svg/svg-color.c b/source/svg/svg-color.c
index 4b3f872c..35e9392f 100644
--- a/source/svg/svg-color.c
+++ b/source/svg/svg-color.c
@@ -180,9 +180,9 @@ svg_parse_color(fz_context *ctx, svg_document *doc, char *str, float *rgb)
{
int i, l, m, r, cmp;
- rgb[0] = 0.0;
- rgb[1] = 0.0;
- rgb[2] = 0.0;
+ rgb[0] = 0.0f;
+ rgb[1] = 0.0f;
+ rgb[2] = 0.0f;
/* Crack hex-coded RGB */
@@ -192,17 +192,17 @@ svg_parse_color(fz_context *ctx, svg_document *doc, char *str, float *rgb)
if (strlen(str) == 3)
{
- rgb[0] = (unhex(str[0]) * 16 + unhex(str[0])) / 255.0;
- rgb[1] = (unhex(str[1]) * 16 + unhex(str[1])) / 255.0;
- rgb[2] = (unhex(str[2]) * 16 + unhex(str[2])) / 255.0;
+ rgb[0] = (unhex(str[0]) * 16 + unhex(str[0])) / 255.0f;
+ rgb[1] = (unhex(str[1]) * 16 + unhex(str[1])) / 255.0f;
+ rgb[2] = (unhex(str[2]) * 16 + unhex(str[2])) / 255.0f;
return;
}
if (strlen(str) == 6)
{
- rgb[0] = (unhex(str[0]) * 16 + unhex(str[1])) / 255.0;
- rgb[1] = (unhex(str[2]) * 16 + unhex(str[3])) / 255.0;
- rgb[2] = (unhex(str[4]) * 16 + unhex(str[5])) / 255.0;
+ rgb[0] = (unhex(str[0]) * 16 + unhex(str[1])) / 255.0f;
+ rgb[1] = (unhex(str[2]) * 16 + unhex(str[3])) / 255.0f;
+ rgb[2] = (unhex(str[4]) * 16 + unhex(str[5])) / 255.0f;
return;
}
@@ -233,11 +233,11 @@ svg_parse_color(fz_context *ctx, svg_document *doc, char *str, float *rgb)
if (*str == '%')
{
str ++;
- rgb[i] = fz_atof(numberbuf) / 100.0;
+ rgb[i] = fz_atof(numberbuf) / 100.0f;
}
else
{
- rgb[i] = fz_atof(numberbuf) / 255.0;
+ rgb[i] = fz_atof(numberbuf) / 255.0f;
}
}
}
diff --git a/source/svg/svg-parse.c b/source/svg/svg-parse.c
index 51746e6c..e5bf93a2 100644
--- a/source/svg/svg-parse.c
+++ b/source/svg/svg-parse.c
@@ -75,17 +75,17 @@ svg_parse_length(const char *str, float percent, float font_size)
if (!strcmp(end, "px")) return val;
- if (!strcmp(end, "pt")) return val * 1.0;
- if (!strcmp(end, "pc")) return val * 12.0;
- if (!strcmp(end, "mm")) return val * 2.83464567;
- if (!strcmp(end, "cm")) return val * 28.3464567;
- if (!strcmp(end, "in")) return val * 72.0;
+ if (!strcmp(end, "pt")) return val * 1.0f;
+ if (!strcmp(end, "pc")) return val * 12.0f;
+ if (!strcmp(end, "mm")) return val * 2.83464567f;
+ if (!strcmp(end, "cm")) return val * 28.3464567f;
+ if (!strcmp(end, "in")) return val * 72.0f;
if (!strcmp(end, "em")) return val * font_size;
- if (!strcmp(end, "ex")) return val * font_size * 0.5;
+ if (!strcmp(end, "ex")) return val * font_size * 0.5f;
if (!strcmp(end, "%"))
- return val * percent * 0.01;
+ return val * percent * 0.01f;
if (end[0] == 0)
return val;
@@ -108,7 +108,7 @@ svg_parse_angle(const char *str)
return val;
if (!strcmp(end, "grad"))
- return val * 0.9;
+ return val * 0.9f;
if (!strcmp(end, "rad"))
return val * FZ_RADIAN;
diff --git a/source/svg/svg-run.c b/source/svg/svg-run.c
index eead3b12..f02a8aca 100644
--- a/source/svg/svg-run.c
+++ b/source/svg/svg-run.c
@@ -109,10 +109,10 @@ svg_run_rect(fz_context *ctx, fz_device *dev, svg_document *doc, fz_xml *node, c
ry = rx;
if (ry_att && !rx_att)
rx = ry;
- if (rx > w * 0.5)
- rx = w * 0.5;
- if (ry > h * 0.5)
- ry = h * 0.5;
+ if (rx > w * 0.5f)
+ rx = w * 0.5f;
+ if (ry > h * 0.5f)
+ ry = h * 0.5f;
if (w <= 0 || h <= 0)
return;
@@ -478,15 +478,15 @@ svg_parse_path_data(fz_context *ctx, svg_document *doc, const char *str)
/* saved control point for smooth curves */
int reset_smooth = 1;
- float smooth_x = 0.0;
- float smooth_y = 0.0;
+ float smooth_x = 0.0f;
+ float smooth_y = 0.0f;
cmd = 0;
nargs = 0;
fz_try(ctx)
{
- fz_moveto(ctx, path, 0.0, 0.0); /* for the case of opening 'm' */
+ fz_moveto(ctx, path, 0.0f, 0.0f); /* for the case of opening 'm' */
while (*str)
{
@@ -517,8 +517,8 @@ svg_parse_path_data(fz_context *ctx, svg_document *doc, const char *str)
if (reset_smooth)
{
- smooth_x = 0.0;
- smooth_y = 0.0;
+ smooth_x = 0.0f;
+ smooth_y = 0.0f;
}
reset_smooth = 1;
@@ -977,7 +977,7 @@ svg_parse_common(fz_context *ctx, svg_document *doc, fz_xml *node, svg_state *st
}
else
{
- stroke->miterlimit = 4.0;
+ stroke->miterlimit = 4.0f;
}
}