summaryrefslogtreecommitdiff
path: root/source/fitz/draw-affine.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/fitz/draw-affine.c
parent73d7b296bd549a7e985ea9df9f13e6ad3701ef89 (diff)
downloadmupdf-2d68de96c62c1e6d6a2b615336d99b671fc672b7.tar.xz
Avoid double literals causing casts to float.
Diffstat (limited to 'source/fitz/draw-affine.c')
-rw-r--r--source/fitz/draw-affine.c50
1 files changed, 25 insertions, 25 deletions
diff --git a/source/fitz/draw-affine.c b/source/fitz/draw-affine.c
index 3b6e7ebd..866cd638 100644
--- a/source/fitz/draw-affine.c
+++ b/source/fitz/draw-affine.c
@@ -3011,7 +3011,7 @@ fz_paint_affine_color_near(int da, int sa, int fa, int fb, int n, int alpha)
* value we pick is still far smaller than would ever show up with
* antialiasing.
*/
-#define MY_EPSILON 0.001
+#define MY_EPSILON 0.001f
/* We have 2 possible ways of gridfitting images. The first way, considered
* 'safe' in all cases, is to expand an image out to fill a box that entirely
@@ -3031,11 +3031,11 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
{
float f;
/* Nearest boundary for left */
- f = (float)(int)(m->e + 0.5);
+ f = (float)(int)(m->e + 0.5f);
m->a += m->e - f; /* Adjust width for change */
m->e = f;
/* Nearest boundary for right (width really) */
- m->a = (float)(int)(m->a + 0.5);
+ m->a = (float)(int)(m->a + 0.5f);
}
else if (m->a > 0)
{
@@ -3043,13 +3043,13 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust left hand side onto pixel boundary */
f = (float)(int)(m->e);
if (f - m->e > MY_EPSILON)
- f -= 1.0; /* Ensure it moves left */
+ f -= 1.0f; /* Ensure it moves left */
m->a += m->e - f; /* width gets wider as f <= m.e */
m->e = f;
/* Adjust right hand side onto pixel boundary */
f = (float)(int)(m->a);
if (m->a - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves right */
+ f += 1.0f; /* Ensure it moves right */
m->a = f;
}
else if (m->a < 0)
@@ -3058,24 +3058,24 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust right hand side onto pixel boundary */
f = (float)(int)(m->e);
if (m->e - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves right */
+ f += 1.0f; /* Ensure it moves right */
m->a += m->e - f; /* width gets wider (more -ve) */
m->e = f;
/* Adjust left hand side onto pixel boundary */
f = (float)(int)(m->a);
if (f - m->a > MY_EPSILON)
- f -= 1.0; /* Ensure it moves left */
+ f -= 1.0f; /* Ensure it moves left */
m->a = f;
}
if (as_tiled)
{
float f;
/* Nearest boundary for top */
- f = (float)(int)(m->f + 0.5);
+ f = (float)(int)(m->f + 0.5f);
m->d += m->f - f; /* Adjust width for change */
m->f = f;
/* Nearest boundary for bottom (height really) */
- m->d = (float)(int)(m->d + 0.5);
+ m->d = (float)(int)(m->d + 0.5f);
}
else if (m->d > 0)
{
@@ -3083,13 +3083,13 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust top onto pixel boundary */
f = (float)(int)(m->f);
if (f - m->f > MY_EPSILON)
- f -= 1.0; /* Ensure it moves upwards */
+ f -= 1.0f; /* Ensure it moves upwards */
m->d += m->f - f; /* width gets wider as f <= m.f */
m->f = f;
/* Adjust bottom onto pixel boundary */
f = (float)(int)(m->d);
if (m->d - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves down */
+ f += 1.0f; /* Ensure it moves down */
m->d = f;
}
else if (m->d < 0)
@@ -3098,13 +3098,13 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust bottom onto pixel boundary */
f = (float)(int)(m->f);
if (m->f - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves down */
+ f += 1.0f; /* Ensure it moves down */
m->d += m->f - f; /* width gets wider (more -ve) */
m->f = f;
/* Adjust top onto pixel boundary */
f = (float)(int)(m->d);
if (f - m->d > MY_EPSILON)
- f -= 1.0; /* Ensure it moves up */
+ f -= 1.0f; /* Ensure it moves up */
m->d = f;
}
}
@@ -3114,11 +3114,11 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
{
float f;
/* Nearest boundary for left */
- f = (float)(int)(m->e + 0.5);
+ f = (float)(int)(m->e + 0.5f);
m->b += m->e - f; /* Adjust width for change */
m->e = f;
/* Nearest boundary for right (width really) */
- m->b = (float)(int)(m->b + 0.5);
+ m->b = (float)(int)(m->b + 0.5f);
}
else if (m->b > 0)
{
@@ -3126,13 +3126,13 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust left hand side onto pixel boundary */
f = (float)(int)(m->f);
if (f - m->f > MY_EPSILON)
- f -= 1.0; /* Ensure it moves left */
+ f -= 1.0f; /* Ensure it moves left */
m->b += m->f - f; /* width gets wider as f <= m.f */
m->f = f;
/* Adjust right hand side onto pixel boundary */
f = (float)(int)(m->b);
if (m->b - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves right */
+ f += 1.0f; /* Ensure it moves right */
m->b = f;
}
else if (m->b < 0)
@@ -3141,24 +3141,24 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust right hand side onto pixel boundary */
f = (float)(int)(m->f);
if (m->f - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves right */
+ f += 1.0f; /* Ensure it moves right */
m->b += m->f - f; /* width gets wider (more -ve) */
m->f = f;
/* Adjust left hand side onto pixel boundary */
f = (float)(int)(m->b);
if (f - m->b > MY_EPSILON)
- f -= 1.0; /* Ensure it moves left */
+ f -= 1.0f; /* Ensure it moves left */
m->b = f;
}
if (as_tiled)
{
float f;
/* Nearest boundary for left */
- f = (float)(int)(m->f + 0.5);
+ f = (float)(int)(m->f + 0.5f);
m->c += m->f - f; /* Adjust width for change */
m->f = f;
/* Nearest boundary for right (width really) */
- m->c = (float)(int)(m->c + 0.5);
+ m->c = (float)(int)(m->c + 0.5f);
}
else if (m->c > 0)
{
@@ -3166,13 +3166,13 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust top onto pixel boundary */
f = (float)(int)(m->e);
if (f - m->e > MY_EPSILON)
- f -= 1.0; /* Ensure it moves upwards */
+ f -= 1.0f; /* Ensure it moves upwards */
m->c += m->e - f; /* width gets wider as f <= m.e */
m->e = f;
/* Adjust bottom onto pixel boundary */
f = (float)(int)(m->c);
if (m->c - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves down */
+ f += 1.0f; /* Ensure it moves down */
m->c = f;
}
else if (m->c < 0)
@@ -3181,13 +3181,13 @@ fz_gridfit_matrix(int as_tiled, fz_matrix *m)
/* Adjust bottom onto pixel boundary */
f = (float)(int)(m->e);
if (m->e - f > MY_EPSILON)
- f += 1.0; /* Ensure it moves down */
+ f += 1.0f; /* Ensure it moves down */
m->c += m->e - f; /* width gets wider (more -ve) */
m->e = f;
/* Adjust top onto pixel boundary */
f = (float)(int)(m->c);
if (f - m->c > MY_EPSILON)
- f -= 1.0; /* Ensure it moves up */
+ f -= 1.0f; /* Ensure it moves up */
m->c = f;
}
}