summaryrefslogtreecommitdiff
path: root/source/fitz
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
parent73d7b296bd549a7e985ea9df9f13e6ad3701ef89 (diff)
downloadmupdf-2d68de96c62c1e6d6a2b615336d99b671fc672b7.tar.xz
Avoid double literals causing casts to float.
Diffstat (limited to 'source/fitz')
-rw-r--r--source/fitz/colorspace.c108
-rw-r--r--source/fitz/draw-affine.c50
-rw-r--r--source/fitz/draw-blend.c2
-rw-r--r--source/fitz/draw-device.c4
-rw-r--r--source/fitz/draw-scale-simple.c8
-rw-r--r--source/fitz/font.c10
-rw-r--r--source/fitz/geometry.c9
-rw-r--r--source/fitz/image.c12
-rw-r--r--source/fitz/list-device.c4
-rw-r--r--source/fitz/load-jpx.c6
-rw-r--r--source/fitz/load-tiff.c6
-rw-r--r--source/fitz/memory.c4
-rw-r--r--source/fitz/output-ps.c4
-rw-r--r--source/fitz/stext-device.c10
-rw-r--r--source/fitz/stext-paragraph.c10
-rw-r--r--source/fitz/stream-prog.c2
-rw-r--r--source/fitz/svg-device.c2
17 files changed, 125 insertions, 126 deletions
diff --git a/source/fitz/colorspace.c b/source/fitz/colorspace.c
index eb24fb04..6113e496 100644
--- a/source/fitz/colorspace.c
+++ b/source/fitz/colorspace.c
@@ -105,54 +105,54 @@ static void cmyk_to_rgb(fz_context *ctx, fz_colorspace *cs, const float *cmyk, f
/* this is a matrix multiplication, unrolled for performance */
x = c1m1y1 * k; /* 0 0 0 1 */
r = g = b = c1m1y1 - x; /* 0 0 0 0 */
- r += 0.1373 * x;
- g += 0.1216 * x;
- b += 0.1255 * x;
+ r += 0.1373f * x;
+ g += 0.1216f * x;
+ b += 0.1255f * x;
x = c1m1y * k; /* 0 0 1 1 */
- r += 0.1098 * x;
- g += 0.1020 * x;
+ r += 0.1098f * x;
+ g += 0.1020f * x;
x = c1m1y - x; /* 0 0 1 0 */
r += x;
- g += 0.9490 * x;
+ g += 0.9490f * x;
x = c1my1 * k; /* 0 1 0 1 */
- r += 0.1412 * x;
+ r += 0.1412f * x;
x = c1my1 - x; /* 0 1 0 0 */
- r += 0.9255 * x;
- b += 0.5490 * x;
+ r += 0.9255f * x;
+ b += 0.5490f * x;
x = c1my * k; /* 0 1 1 1 */
- r += 0.1333 * x;
+ r += 0.1333f * x;
x = c1my - x; /* 0 1 1 0 */
- r += 0.9294 * x;
- g += 0.1098 * x;
- b += 0.1412 * x;
+ r += 0.9294f * x;
+ g += 0.1098f * x;
+ b += 0.1412f * x;
x = cm1y1 * k; /* 1 0 0 1 */
- g += 0.0588 * x;
- b += 0.1412 * x;
+ g += 0.0588f * x;
+ b += 0.1412f * x;
x = cm1y1 - x; /* 1 0 0 0 */
- g += 0.6784 * x;
- b += 0.9373 * x;
+ g += 0.6784f * x;
+ b += 0.9373f * x;
x = cm1y * k; /* 1 0 1 1 */
- g += 0.0745 * x;
+ g += 0.0745f * x;
x = cm1y - x; /* 1 0 1 0 */
- g += 0.6510 * x;
- b += 0.3137 * x;
+ g += 0.6510f * x;
+ b += 0.3137f * x;
x = cmy1 * k; /* 1 1 0 1 */
- b += 0.0078 * x;
+ b += 0.0078f * x;
x = cmy1 - x; /* 1 1 0 0 */
- r += 0.1804 * x;
- g += 0.1922 * x;
- b += 0.5725 * x;
+ r += 0.1804f * x;
+ g += 0.1922f * x;
+ b += 0.5725f * x;
x = cmy * (1-k); /* 1 1 1 0 */
- r += 0.2118 * x;
- g += 0.2119 * x;
- b += 0.2235 * x;
+ r += 0.2118f * x;
+ g += 0.2119f * x;
+ b += 0.2235f * x;
rgb[0] = fz_clamp(r, 0, 1);
rgb[1] = fz_clamp(g, 0, 1);
rgb[2] = fz_clamp(b, 0, 1);
@@ -1171,67 +1171,67 @@ static inline void cached_cmyk_conv(unsigned char *restrict const pr, unsigned c
x0 = (c1m1y1<<8) - x1; /* 0 0 0 0 */
x1 = x1>>8; /* From 23 fractional bits to 15 */
r = g = b = x0;
- r += 35 * x1; /* 0.1373 */
- g += 31 * x1; /* 0.1216 */
- b += 32 * x1; /* 0.1255 */
+ r += 35 * x1; /* 0.1373f */
+ g += 31 * x1; /* 0.1216f */
+ b += 32 * x1; /* 0.1255f */
x1 = c1m1y * k; /* 0 0 1 1 */
x0 = (c1m1y<<8) - x1; /* 0 0 1 0 */
x1 >>= 8; /* From 23 fractional bits to 15 */
- r += 28 * x1; /* 0.1098 */
- g += 26 * x1; /* 0.1020 */
+ r += 28 * x1; /* 0.1098f */
+ g += 26 * x1; /* 0.1020f */
r += x0;
x0 >>= 8; /* From 23 fractional bits to 15 */
- g += 243 * x0; /* 0.9490 */
+ g += 243 * x0; /* 0.9490f */
x1 = c1my1 * k; /* 0 1 0 1 */
x0 = (c1my1<<8) - x1; /* 0 1 0 0 */
x1 >>= 8; /* From 23 fractional bits to 15 */
x0 >>= 8; /* From 23 fractional bits to 15 */
- r += 36 * x1; /* 0.1412 */
- r += 237 * x0; /* 0.9255 */
- b += 141 * x0; /* 0.5490 */
+ r += 36 * x1; /* 0.1412f */
+ r += 237 * x0; /* 0.9255f */
+ b += 141 * x0; /* 0.5490f */
x1 = c1my * k; /* 0 1 1 1 */
x0 = (c1my<<8) - x1; /* 0 1 1 0 */
x1 >>= 8; /* From 23 fractional bits to 15 */
x0 >>= 8; /* From 23 fractional bits to 15 */
- r += 34 * x1; /* 0.1333 */
- r += 238 * x0; /* 0.9294 */
- g += 28 * x0; /* 0.1098 */
- b += 36 * x0; /* 0.1412 */
+ r += 34 * x1; /* 0.1333f */
+ r += 238 * x0; /* 0.9294f */
+ g += 28 * x0; /* 0.1098f */
+ b += 36 * x0; /* 0.1412f */
x1 = cm1y1 * k; /* 1 0 0 1 */
x0 = (cm1y1<<8) - x1; /* 1 0 0 0 */
x1 >>= 8; /* From 23 fractional bits to 15 */
x0 >>= 8; /* From 23 fractional bits to 15 */
- g += 15 * x1; /* 0.0588 */
- b += 36 * x1; /* 0.1412 */
- g += 174 * x0; /* 0.6784 */
- b += 240 * x0; /* 0.9373 */
+ g += 15 * x1; /* 0.0588f */
+ b += 36 * x1; /* 0.1412f */
+ g += 174 * x0; /* 0.6784f */
+ b += 240 * x0; /* 0.9373f */
x1 = cm1y * k; /* 1 0 1 1 */
x0 = (cm1y<<8) - x1; /* 1 0 1 0 */
x1 >>= 8; /* From 23 fractional bits to 15 */
x0 >>= 8; /* From 23 fractional bits to 15 */
- g += 19 * x1; /* 0.0745 */
- g += 167 * x0; /* 0.6510 */
- b += 80 * x0; /* 0.3137 */
+ g += 19 * x1; /* 0.0745f */
+ g += 167 * x0; /* 0.6510f */
+ b += 80 * x0; /* 0.3137f */
x1 = cmy1 * k; /* 1 1 0 1 */
x0 = (cmy1<<8) - x1; /* 1 1 0 0 */
x1 >>= 8; /* From 23 fractional bits to 15 */
x0 >>= 8; /* From 23 fractional bits to 15 */
- b += 2 * x1; /* 0.0078 */
- r += 46 * x0; /* 0.1804 */
- g += 49 * x0; /* 0.1922 */
- b += 147 * x0; /* 0.5725 */
+ b += 2 * x1; /* 0.0078f */
+ r += 46 * x0; /* 0.1804f */
+ g += 49 * x0; /* 0.1922f */
+ b += 147 * x0; /* 0.5725f */
x0 = cmy * (256-k); /* 1 1 1 0 */
x0 >>= 8; /* From 23 fractional bits to 15 */
- r += 54 * x0; /* 0.2118 */
- g += 54 * x0; /* 0.2119 */
- b += 57 * x0; /* 0.2235 */
+ r += 54 * x0; /* 0.2118f */
+ g += 54 * x0; /* 0.2119f */
+ b += 57 * x0; /* 0.2235f */
r -= (r>>8);
g -= (g>>8);
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;
}
}
diff --git a/source/fitz/draw-blend.c b/source/fitz/draw-blend.c
index f4a9fe96..8694408d 100644
--- a/source/fitz/draw-blend.c
+++ b/source/fitz/draw-blend.c
@@ -132,7 +132,7 @@ fz_luminosity_rgb(unsigned char *rd, unsigned char *gd, unsigned char *bd, int r
int delta, scale;
int r, g, b, y;
- /* 0.3, 0.59, 0.11 in fixed point */
+ /* 0.3f, 0.59f, 0.11f in fixed point */
delta = ((rs - rb) * 77 + (gs - gb) * 151 + (bs - bb) * 28 + 0x80) >> 8;
r = rb + delta;
g = gb + delta;
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 4e10829f..7c811f5e 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -1202,7 +1202,7 @@ fz_transform_pixmap(fz_context *ctx, fz_draw_device *dev, const fz_pixmap *image
/* Downscale, non rectilinear case */
if (dx > 0 && dy > 0)
{
- scaled = fz_scale_pixmap_cached(ctx, image, 0, 0, (float)dx, (float)dy, NULL, dev->cache_x, dev->cache_y);
+ scaled = fz_scale_pixmap_cached(ctx, image, 0, 0, dx, dy, NULL, dev->cache_x, dev->cache_y);
return scaled;
}
@@ -1792,7 +1792,7 @@ fz_draw_begin_group(fz_context *ctx, fz_device *devp, const fz_rect *rect, int i
fz_copy_pixmap_rect(ctx, dest, state[0].dest, &bbox);
}
- if (blendmode == 0 && alpha == 1.0 && isolated)
+ if (blendmode == 0 && alpha == 1.0f && isolated)
{
/* We can render direct to any existing shape plane.
* If there isn't one, we don't need to make one. */
diff --git a/source/fitz/draw-scale-simple.c b/source/fitz/draw-scale-simple.c
index 16605079..725f6b1a 100644
--- a/source/fitz/draw-scale-simple.c
+++ b/source/fitz/draw-scale-simple.c
@@ -414,11 +414,11 @@ check_weights(fz_weights *weights, int j, int w, float x, float wf)
weights->index[maxidx-1] += 256-sum;
/* Otherwise, if we are the first pixel, and it's fully covered, then
* adjust it. */
- else if ((j == 0) && (x < 0.0001F) && (sum != 256))
+ else if ((j == 0) && (x < 0.0001f) && (sum != 256))
weights->index[maxidx-1] += 256-sum;
/* Finally, if we are the last pixel, and it's fully covered, then
* adjust it. */
- else if ((j == w-1) && ((float)w-wf < 0.0001F) && (sum != 256))
+ else if ((j == w-1) && (w - wf < 0.0001f) && (sum != 256))
weights->index[maxidx-1] += 256-sum;
}
@@ -1616,7 +1616,7 @@ fz_scale_pixmap_cached(fz_context *ctx, const fz_pixmap *src, float x, float y,
else
{
dst_x_int = floorf(x);
- x -= (float)dst_x_int;
+ x -= dst_x_int;
dst_w_int = (int)ceilf(x + w);
}
/* dst_y_int is calculated to be the top of the scaled image, and
@@ -1637,7 +1637,7 @@ fz_scale_pixmap_cached(fz_context *ctx, const fz_pixmap *src, float x, float y,
else
{
dst_y_int = floorf(y);
- y -= (float)dst_y_int;
+ y -= dst_y_int;
dst_h_int = (int)ceilf(y + h);
}
diff --git a/source/fitz/font.c b/source/fitz/font.c
index 65e06f43..a1483916 100644
--- a/source/fitz/font.c
+++ b/source/fitz/font.c
@@ -557,7 +557,7 @@ fz_adjust_ft_glyph_width(fz_context *ctx, fz_font *font, int gid, fz_matrix *trm
FT_Get_Advance(font->ft_face, gid, FT_LOAD_NO_SCALE | FT_LOAD_NO_HINTING | FT_LOAD_IGNORE_TRANSFORM, &adv);
fz_unlock(ctx, FZ_LOCK_FREETYPE);
- realw = (float)adv * 1000 / ((FT_Face)font->ft_face)->units_per_EM;
+ realw = adv * 1000.0f / ((FT_Face)font->ft_face)->units_per_EM;
if (gid < font->width_count)
subw = font->width_table[gid];
else
@@ -916,7 +916,7 @@ fz_bound_ft_glyph(fz_context *ctx, fz_font *font, int gid)
// TODO: cache results
const int scale = face->units_per_EM;
- const float recip = 1 / (float)scale;
+ const float recip = 1.0f / scale;
const float strength = 0.02f;
fz_matrix local_trm = fz_identity;
@@ -963,7 +963,7 @@ fz_bound_ft_glyph(fz_context *ctx, fz_font *font, int gid)
if (font->flags.fake_bold)
{
FT_Outline_Embolden(&face->glyph->outline, strength * scale);
- FT_Outline_Translate(&face->glyph->outline, -strength * 0.5 * scale, -strength * 0.5 * scale);
+ FT_Outline_Translate(&face->glyph->outline, -strength * 0.5f * scale, -strength * 0.5f * scale);
}
FT_Outline_Get_CBox(&face->glyph->outline, &cbox);
@@ -1057,7 +1057,7 @@ fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *tr
int ft_flags;
const int scale = face->units_per_EM;
- const float recip = 1 / (float)scale;
+ const float recip = 1.0f / scale;
const float strength = 0.02f;
fz_adjust_ft_glyph_width(ctx, font, gid, &local_trm);
@@ -1090,7 +1090,7 @@ fz_outline_ft_glyph(fz_context *ctx, fz_font *font, int gid, const fz_matrix *tr
if (font->flags.fake_bold)
{
FT_Outline_Embolden(&face->glyph->outline, strength * scale);
- FT_Outline_Translate(&face->glyph->outline, -strength * 0.5 * scale, -strength * 0.5 * scale);
+ FT_Outline_Translate(&face->glyph->outline, -strength * 0.5f * scale, -strength * 0.5f * scale);
}
cc.path = NULL;
diff --git a/source/fitz/geometry.c b/source/fitz/geometry.c
index 64abd5c4..8bed26a1 100644
--- a/source/fitz/geometry.c
+++ b/source/fitz/geometry.c
@@ -232,7 +232,6 @@ fz_invert_matrix(fz_matrix *dst, const fz_matrix *src)
int
fz_try_invert_matrix(fz_matrix *dst, const fz_matrix *src)
{
- /* Be careful to cope with dst == src */
double sa = (double)src->a;
double sb = (double)src->b;
double sc = (double)src->c;
@@ -372,13 +371,13 @@ fz_round_rect(fz_irect * restrict b, const fz_rect *restrict r)
{
int i;
- i = floorf(r->x0 + 0.001);
+ i = floorf(r->x0 + 0.001f);
b->x0 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
- i = floorf(r->y0 + 0.001);
+ i = floorf(r->y0 + 0.001f);
b->y0 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
- i = ceilf(r->x1 - 0.001);
+ i = ceilf(r->x1 - 0.001f);
b->x1 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
- i = ceilf(r->y1 - 0.001);
+ i = ceilf(r->y1 - 0.001f);
b->y1 = fz_clamp(i, MIN_SAFE_INT, MAX_SAFE_INT);
return b;
diff --git a/source/fitz/image.c b/source/fitz/image.c
index 5c4147f4..d530b6e3 100644
--- a/source/fitz/image.c
+++ b/source/fitz/image.c
@@ -510,12 +510,12 @@ update_ctm_for_subarea(fz_matrix *ctm, const fz_irect *subarea, int w, int h)
if (subarea->x0 == 0 && subarea->y0 == 0 && subarea->x1 == w && subarea->y1 == h)
return;
- m.a = (subarea->x1 - subarea->x0) / (float)w;
+ m.a = (float) (subarea->x1 - subarea->x0) / w;
m.b = 0;
m.c = 0;
- m.d = (subarea->y1 - subarea->y0) / (float)h;
- m.e = subarea->x0 / (float)w;
- m.f = subarea->y0 / (float)h;
+ m.d = (float) (subarea->y1 - subarea->y0) / h;
+ m.e = (float) subarea->x0 / w;
+ m.f = (float) subarea->y0 / h;
fz_concat(ctm, &m, ctm);
}
@@ -625,8 +625,8 @@ fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, const fz_irect *subar
/* Based on that subarea, recalculate the extents */
if (ctm)
{
- float frac_w = (key.rect.x1 - key.rect.x0) / (float)image->w;
- float frac_h = (key.rect.y1 - key.rect.y0) / (float)image->h;
+ float frac_w = (float) (key.rect.x1 - key.rect.x0) / image->w;
+ float frac_h = (float) (key.rect.y1 - key.rect.y0) / image->h;
float a = ctm->a * frac_w;
float b = ctm->b * frac_h;
float c = ctm->c * frac_w;
diff --git a/source/fitz/list-device.c b/source/fitz/list-device.c
index 6580b93c..fdd5ea18 100644
--- a/source/fitz/list-device.c
+++ b/source/fitz/list-device.c
@@ -415,9 +415,9 @@ fz_append_display_node(
}
if (alpha && (*alpha != writer->alpha))
{
- if (*alpha >= 1.0)
+ if (*alpha >= 1.0f)
node.alpha = ALPHA_1;
- else if (*alpha <= 0.0)
+ else if (*alpha <= 0.0f)
node.alpha = ALPHA_0;
else
{
diff --git a/source/fitz/load-jpx.c b/source/fitz/load-jpx.c
index ae63f291..e661ba2e 100644
--- a/source/fitz/load-jpx.c
+++ b/source/fitz/load-jpx.c
@@ -32,9 +32,9 @@ jpx_ycc_to_rgb(fz_context *ctx, fz_pixmap *pix, int cbsign, int crsign)
if (crsign)
ycc[2] -= 128;
- row[x * 3 + 0] = fz_clampi((double)ycc[0] + 1.402 * ycc[2], 0, 255);
- row[x * 3 + 1] = fz_clampi((double)ycc[0] - 0.34413 * ycc[1] - 0.71414 * ycc[2], 0, 255);
- row[x * 3 + 2] = fz_clampi((double)ycc[0] + 1.772 * ycc[1], 0, 255);
+ row[x * 3 + 0] = fz_clampi(ycc[0] + 1.402f * ycc[2], 0, 255);
+ row[x * 3 + 1] = fz_clampi(ycc[0] - 0.34413f * ycc[1] - 0.71414f * ycc[2], 0, 255);
+ row[x * 3 + 2] = fz_clampi(ycc[0] + 1.772f * ycc[1], 0, 255);
}
}
}
diff --git a/source/fitz/load-tiff.c b/source/fitz/load-tiff.c
index 26fc9b22..4587b345 100644
--- a/source/fitz/load-tiff.c
+++ b/source/fitz/load-tiff.c
@@ -1071,9 +1071,9 @@ tiff_ycc_to_rgb(fz_context *ctx, struct tiff *tiff)
ycc[1] = row[x * 3 + 1] - 128;
ycc[2] = row[x * 3 + 2] - 128;
- row[x * 3 + 0] = fz_clampi((double)ycc[0] + 1.402 * ycc[2], 0, 255);
- row[x * 3 + 1] = fz_clampi((double)ycc[0] - 0.34413 * ycc[1] - 0.71414 * ycc[2], 0, 255);
- row[x * 3 + 2] = fz_clampi((double)ycc[0] + 1.772 * ycc[1], 0, 255);
+ row[x * 3 + 0] = fz_clampi(ycc[0] + 1.402f * ycc[2], 0, 255);
+ row[x * 3 + 1] = fz_clampi(ycc[0] - 0.34413f * ycc[1] - 0.71414f * ycc[2], 0, 255);
+ row[x * 3 + 2] = fz_clampi(ycc[0] + 1.772f * ycc[1], 0, 255);
}
}
}
diff --git a/source/fitz/memory.c b/source/fitz/memory.c
index 42ac1d50..d5ea7750 100644
--- a/source/fitz/memory.c
+++ b/source/fitz/memory.c
@@ -294,9 +294,9 @@ static void dump_lock_times(void)
{
total += fz_lock_time[i][j];
}
- printf("Lock %d held for %g seconds (%g%%)\n", j, ((double)total)/1000, 100.0*total/prog_time);
+ printf("Lock %d held for %g seconds (%g%%)\n", j, total / 1000.0f, 100.0f*total/prog_time);
}
- printf("Total program time %g seconds\n", ((double)prog_time)/1000);
+ printf("Total program time %g seconds\n", prog_time / 1000.0f);
}
#endif
diff --git a/source/fitz/output-ps.c b/source/fitz/output-ps.c
index ef90dadc..90be4367 100644
--- a/source/fitz/output-ps.c
+++ b/source/fitz/output-ps.c
@@ -54,8 +54,8 @@ ps_write_header(fz_context *ctx, fz_band_writer *writer_)
int pagenum = writer->super.pagenum;
int w_points = (w * 72 + (xres>>1)) / xres;
int h_points = (h * 72 + (yres>>1)) / yres;
- float sx = w/(float)w_points;
- float sy = h/(float)h_points;
+ float sx = (float) w / w_points;
+ float sy = (float) h / h_points;
int err;
if (alpha != 0)
diff --git a/source/fitz/stext-device.c b/source/fitz/stext-device.c
index 78755595..0213a945 100644
--- a/source/fitz/stext-device.c
+++ b/source/fitz/stext-device.c
@@ -203,7 +203,7 @@ push_span(fz_context *ctx, fz_stext_device *tdev, fz_stext_span *span, int new_l
{
float size = fz_matrix_expansion(&span->transform);
/* So, a new line. Part of the same block or not? */
- if (distance == 0 || distance > size * 1.5 || distance < -size * PARAGRAPH_DIST || page->len == 0 || prev_not_text)
+ if (distance == 0 || distance > size * 1.5f || distance < -size * PARAGRAPH_DIST || page->len == 0 || prev_not_text)
{
/* New block */
if (page->len == page->cap)
@@ -340,7 +340,7 @@ strain_soup(fz_context *ctx, fz_stext_device *tdev)
/* Check if p and q are parallel. If so, then this
* line is parallel with the last one. */
dot = p.x * q.x + p.y * q.y;
- if (fabsf(dot) > 0.9995)
+ if (fabsf(dot) > 0.9995f)
{
/* If we take the dot product of normalised(p) and
* perp(r), we get the perpendicular distance from
@@ -676,10 +676,10 @@ fz_add_stext_char_imp(fz_context *ctx, fz_stext_device *dev, fz_stext_style *sty
base_offset = -ndir.y * delta.x + ndir.x * delta.y;
spacing /= size * SPACE_DIST;
- if (fabsf(base_offset) < size * 0.1)
+ if (fabsf(base_offset) < size * 0.1f)
{
/* Only a small amount off the baseline - we'll take this */
- if (fabsf(spacing) < 1.0)
+ if (fabsf(spacing) < 1.0f)
{
/* Motion is in line, and small. */
}
@@ -942,7 +942,7 @@ fz_stext_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *img, const f
/* If the alpha is less than 50% then it's probably a watermark or
* effect or something. Skip it */
- if (alpha < 0.5)
+ if (alpha < 0.5f)
return;
/* New block */
diff --git a/source/fitz/stext-paragraph.c b/source/fitz/stext-paragraph.c
index b28cb200..e275ecae 100644
--- a/source/fitz/stext-paragraph.c
+++ b/source/fitz/stext-paragraph.c
@@ -148,7 +148,7 @@ line_height_for_style(line_heights *lh, fz_stext_style *style)
if (lh->lh[i].style == style)
return lh->lh[i].height;
}
- return 0.0; /* Never reached */
+ return 0.0f; /* Never reached */
}
static void
@@ -1161,7 +1161,7 @@ list_entry:
if (chr->style != style)
{
float proper_step = line_height_for_style(lh, chr->style);
- if (proper_step * 0.95 <= line->distance && line->distance <= proper_step * 1.05)
+ if (proper_step * 0.95f <= line->distance && line->distance <= proper_step * 1.05f)
{
ok = 1;
break;
@@ -1225,7 +1225,7 @@ force_paragraph:
fz_point *region_max = &span->max;
/* Treat adjacent spans as one big region */
- while (span->next && span->next->spacing < 1.5)
+ while (span->next && span->next->spacing < 1.5f)
{
span = span->next;
region_max = &span->max;
@@ -1310,7 +1310,7 @@ force_paragraph:
fz_point *region_max = &span->max;
/* Treat adjacent spans as one big region */
- while (span->next && span->next->spacing < 1.5)
+ while (span->next && span->next->spacing < 1.5f)
{
span = span->next;
region_max = &span->max;
@@ -1342,7 +1342,7 @@ force_paragraph:
#ifdef DEBUG_ALIGN
dump_span(span);
#endif
- for (sn = span->next; sn && sn->spacing < 1.5; sn = sn->next)
+ for (sn = span->next; sn && sn->spacing < 1.5f; sn = sn->next)
{
region_max = &sn->max;
#ifdef DEBUG_ALIGN
diff --git a/source/fitz/stream-prog.c b/source/fitz/stream-prog.c
index dab746e0..eeb33242 100644
--- a/source/fitz/stream-prog.c
+++ b/source/fitz/stream-prog.c
@@ -29,7 +29,7 @@ static int next_prog(fz_context *ctx, fz_stream *stm, size_t len)
/* Simulate more data having arrived */
if (ps->available < ps->length)
{
- fz_off_t av = (fz_off_t)((double)(clock() - ps->start_time) * ps->bps / (CLOCKS_PER_SEC*8));
+ fz_off_t av = (fz_off_t)((float)(clock() - ps->start_time) * ps->bps / (CLOCKS_PER_SEC*8));
if (av > ps->length)
av = ps->length;
ps->available = av;
diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c
index 0ac96105..7c6c8826 100644
--- a/source/fitz/svg-device.c
+++ b/source/fitz/svg-device.c
@@ -158,7 +158,7 @@ svg_dev_ctm(fz_context *ctx, svg_device *sdev, const fz_matrix *ctm)
{
fz_output *out = sdev->out;
- if (ctm->a != 1.0 || ctm->b != 0 || ctm->c != 0 || ctm->d != 1.0 || ctm->e != 0 || ctm->f != 0)
+ if (ctm->a != 1.0f || ctm->b != 0 || ctm->c != 0 || ctm->d != 1.0f || ctm->e != 0 || ctm->f != 0)
{
fz_write_printf(ctx, out, " transform=\"matrix(%g,%g,%g,%g,%g,%g)\"",
ctm->a, ctm->b, ctm->c, ctm->d, ctm->e, ctm->f);