summaryrefslogtreecommitdiff
path: root/source/svg/svg-color.c
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/svg-color.c
parent73d7b296bd549a7e985ea9df9f13e6ad3701ef89 (diff)
downloadmupdf-2d68de96c62c1e6d6a2b615336d99b671fc672b7.tar.xz
Avoid double literals causing casts to float.
Diffstat (limited to 'source/svg/svg-color.c')
-rw-r--r--source/svg/svg-color.c22
1 files changed, 11 insertions, 11 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;
}
}
}