diff options
Diffstat (limited to 'source')
39 files changed, 309 insertions, 310 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); diff --git a/source/gprf/gprf-doc.c b/source/gprf/gprf-doc.c index 23731867..b0111fd4 100644 --- a/source/gprf/gprf-doc.c +++ b/source/gprf/gprf-doc.c @@ -162,8 +162,8 @@ gprf_bound_page(fz_context *ctx, fz_page *page_, fz_rect *bbox) /* BBox is in points, not pixels */ bbox->x0 = 0; bbox->y0 = 0; - bbox->x1 = 72.0 * page->width / doc->res; - bbox->y1 = 72.0 * page->height / doc->res; + bbox->x1 = 72.0f * page->width / doc->res; + bbox->y1 = 72.0f * page->height / doc->res; return bbox; } @@ -215,61 +215,61 @@ static inline unsigned char *cmyk_to_rgba(unsigned char *out, uint32_t c, uint32 cmy = (cm * y)>>16; cmy1 = cm - cmy; -#define CONST16(x) ((int)(x * 65536.0 + 0.5)) +#define CONST16(x) ((int)(x * 65536.0f + 0.5f)) k += (k>>15); /* Move k to be 0..65536 */ /* this is a matrix multiplication, unrolled for performance */ x = (c1m1y1 * k)>>16; /* 0 0 0 1 */ r = g = b = c1m1y1 - x; /* 0 0 0 0 */ - r += (CONST16(0.1373) * x)>>16; - g += (CONST16(0.1216) * x)>>16; - b += (CONST16(0.1255) * x)>>16; + r += (CONST16(0.1373f) * x)>>16; + g += (CONST16(0.1216f) * x)>>16; + b += (CONST16(0.1255f) * x)>>16; x = (c1m1y * k)>>16; /* 0 0 1 1 */ - r += (CONST16(0.1098) * x)>>16; - g += (CONST16(0.1020) * x)>>16; + r += (CONST16(0.1098f) * x)>>16; + g += (CONST16(0.1020f) * x)>>16; x = c1m1y - x; /* 0 0 1 0 */ r += x; - g += (CONST16(0.9490) * x)>>16; + g += (CONST16(0.9490f) * x)>>16; x = (c1my1 * k)>>16; /* 0 1 0 1 */ - r += (CONST16(0.1412) * x)>>16; + r += (CONST16(0.1412f) * x)>>16; x = c1my1 - x; /* 0 1 0 0 */ - r += (CONST16(0.9255) * x)>>16; - b += (CONST16(0.5490) * x)>>16; + r += (CONST16(0.9255f) * x)>>16; + b += (CONST16(0.5490f) * x)>>16; x = (c1my * k)>>16; /* 0 1 1 1 */ - r += (CONST16(0.1333) * x)>>16; + r += (CONST16(0.1333f) * x)>>16; x = c1my - x; /* 0 1 1 0 */ - r += (CONST16(0.9294) * x)>>16; - g += (CONST16(0.1098) * x)>>16; - b += (CONST16(0.1412) * x)>>16; + r += (CONST16(0.9294f) * x)>>16; + g += (CONST16(0.1098f) * x)>>16; + b += (CONST16(0.1412f) * x)>>16; x = (cm1y1 * k)>>16; /* 1 0 0 1 */ - g += (CONST16(0.0588) * x)>>16; - b += (CONST16(0.1412) * x)>>16; + g += (CONST16(0.0588f) * x)>>16; + b += (CONST16(0.1412f) * x)>>16; x = cm1y1 - x; /* 1 0 0 0 */ - g += (CONST16(0.6784) * x)>>16; - b += (CONST16(0.9373) * x)>>16; + g += (CONST16(0.6784f) * x)>>16; + b += (CONST16(0.9373f) * x)>>16; x = (cm1y * k)>>16; /* 1 0 1 1 */ - g += (CONST16(0.0745) * x)>>16; + g += (CONST16(0.0745f) * x)>>16; x = cm1y - x; /* 1 0 1 0 */ - g += (CONST16(0.6510) * x)>>16; - b += (CONST16(0.3137) * x)>>16; + g += (CONST16(0.6510f) * x)>>16; + b += (CONST16(0.3137f) * x)>>16; x = (cmy1 * k)>>16; /* 1 1 0 1 */ - b += (CONST16(0.0078) * x)>>16; + b += (CONST16(0.0078f) * x)>>16; x = cmy1 - x; /* 1 1 0 0 */ - r += (CONST16(0.1804) * x)>>16; - g += (CONST16(0.1922) * x)>>16; - b += (CONST16(0.5725) * x)>>16; + r += (CONST16(0.1804f) * x)>>16; + g += (CONST16(0.1922f) * x)>>16; + b += (CONST16(0.5725f) * x)>>16; x = (cmy * (65536-k))>>16; /* 1 1 1 0 */ - r += (CONST16(0.2118) * x)>>16; - g += (CONST16(0.2119) * x)>>16; - b += (CONST16(0.2235) * x)>>16; + r += (CONST16(0.2118f) * x)>>16; + g += (CONST16(0.2119f) * x)>>16; + b += (CONST16(0.2235f) * x)>>16; /* I have convinced myself that r, g, b cannot have underflowed at * thus point. I have not convinced myself that they won't have * overflowed though. */ @@ -814,12 +814,12 @@ gprf_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix * i = 0; for (y = 0; y < page->tile_height; y++) { - double scale = GPRF_TILESIZE * 72.0 / doc->res; + float scale = GPRF_TILESIZE * 72.0f / doc->res; for (x = 0; x < page->tile_width; x++) { fz_matrix local; - double scale_x = page->tiles[i]->w * 72.0 / doc->res; - double scale_y = page->tiles[i]->h * 72.0 / doc->res; + float scale_x = page->tiles[i]->w * 72.0f / doc->res; + float scale_y = page->tiles[i]->h * 72.0f / doc->res; local.a = scale_x; local.b = 0; local.c = 0; @@ -827,7 +827,7 @@ gprf_run_page(fz_context *ctx, fz_page *page_, fz_device *dev, const fz_matrix * local.e = x * scale; local.f = y * scale; fz_concat(&local, &local, ctm); - fz_fill_image(ctx, dev, page->tiles[i++], &local, 1.0); + fz_fill_image(ctx, dev, page->tiles[i++], &local, 1.0f); } } fz_render_flags(ctx, dev, 0, FZ_DEVFLAG_GRIDFIT_AS_TILED); diff --git a/source/gprf/gprf-skeleton.c b/source/gprf/gprf-skeleton.c index e990e55a..1c9ec146 100644 --- a/source/gprf/gprf-skeleton.c +++ b/source/gprf/gprf-skeleton.c @@ -42,8 +42,8 @@ fz_save_gproof(fz_context *ctx, const char *pdf_file, fz_document *doc, const ch page = NULL; /* Same lack of rounding as gs uses */ - w = (int)((rect.x1 - rect.x0) * res / 72.0); - h = (int)((rect.y1 - rect.y0) * res / 72.0); + w = (int)((rect.x1 - rect.x0) * res / 72.0f); + h = (int)((rect.y1 - rect.y0) * res / 72.0f); fz_write_int32_le(ctx, out, w); fz_write_int32_le(ctx, out, h); } diff --git a/source/helpers/mu-office-lib/mu-office-lib.c b/source/helpers/mu-office-lib/mu-office-lib.c index 65eae1a2..3e56369a 100644 --- a/source/helpers/mu-office-lib/mu-office-lib.c +++ b/source/helpers/mu-office-lib/mu-office-lib.c @@ -899,9 +899,9 @@ MuError MuOfficePage_getSizeForZoom( MuOfficePage *page, h = 90 * (rect.y1 - rect.y0) / 72; if (pWidth) - *pWidth = (int)(w * zoom + 0.5); + *pWidth = (int)(w * zoom + 0.5f); if (pHeight) - *pHeight = (int)(h * zoom + 0.5); + *pHeight = (int)(h * zoom + 0.5f); return MuError_OK; } @@ -1010,8 +1010,8 @@ static void render_worker(void *arg) * integer width/heights. First calculate the target * width/height. */ fz_bound_page(ctx, render->page->page, &page_bounds); - scalex = (int)(90 * render->zoom * (page_bounds.x1 - page_bounds.x0) / 72 + 0.5); - scaley = (int)(90 * render->zoom * (page_bounds.y1 - page_bounds.y0) / 72 + 0.5); + scalex = (int)(90 * render->zoom * (page_bounds.x1 - page_bounds.x0) / 72 + 0.5f); + scaley = (int)(90 * render->zoom * (page_bounds.y1 - page_bounds.y0) / 72 + 0.5f); /* Now calculate the actual scale factors required */ scalex /= (page_bounds.x1 - page_bounds.x0); scaley /= (page_bounds.y1 - page_bounds.y0); diff --git a/source/html/css-apply.c b/source/html/css-apply.c index 58b7772a..de554908 100644 --- a/source/html/css-apply.c +++ b/source/html/css-apply.c @@ -980,7 +980,7 @@ fz_from_css_number(fz_css_number number, float em, float percent_value, float au case N_NUMBER: return number.value; case N_LENGTH: return number.value; case N_SCALE: return number.value * em; - case N_PERCENT: return number.value * 0.01 * percent_value; + case N_PERCENT: return number.value * 0.01f * percent_value; case N_AUTO: return auto_value; } } @@ -993,7 +993,7 @@ fz_from_css_number_scale(fz_css_number number, float scale) case N_NUMBER: return number.value * scale; case N_LENGTH: return number.value; case N_SCALE: return number.value * scale; - case N_PERCENT: return number.value * 0.01 * scale; + case N_PERCENT: return number.value * 0.01f * scale; case N_AUTO: return scale; } } diff --git a/source/html/html-layout.c b/source/html/html-layout.c index fcb8eb8e..6c3600ca 100644 --- a/source/html/html-layout.c +++ b/source/html/html-layout.c @@ -1044,8 +1044,8 @@ static float measure_line(fz_html_flow *node, fz_html_flow *end, float *baseline } else { - float a = node->box->em * 0.8; - float d = node->box->em * 0.2; + float a = node->box->em * 0.8f; + float d = node->box->em * 0.2f; if (a > max_a) max_a = a; if (d > max_d) max_d = d; } @@ -1171,11 +1171,11 @@ static void layout_line(fz_context *ctx, float indent, float page_w, float line_ break; case VA_TOP: case VA_TEXT_TOP: - va = -baseline + node->box->em * 0.8; + va = -baseline + node->box->em * 0.8f; break; case VA_BOTTOM: case VA_TEXT_BOTTOM: - va = -baseline + line_h - node->box->em * 0.2; + va = -baseline + line_h - node->box->em * 0.2f; break; } @@ -1781,8 +1781,8 @@ static void draw_list_mark(fz_context *ctx, fz_html_box *box, float page_top, fl else { float h = fz_from_css_number_scale(box->style.line_height, box->em); - float a = box->em * 0.8; - float d = box->em * 0.2; + float a = box->em * 0.8f; + float d = box->em * 0.2f; if (a + d > h) h = a + d; y = box->y + a + (h - a - d) / 2; @@ -1981,8 +1981,8 @@ static fz_link *load_link_flow(fz_context *ctx, fz_html_flow *flow, fz_link *hea if (flow->type != FLOW_IMAGE) { /* flow->y is the baseline, adjust bbox appropriately */ - bbox.y0 -= 0.8 * flow->h; - bbox.y1 -= 0.8 * flow->h; + bbox.y0 -= 0.8f * flow->h; + bbox.y1 -= 0.8f * flow->h; } if (is_internal_uri(href)) diff --git a/source/pdf/pdf-annot-edit.c b/source/pdf/pdf-annot-edit.c index 0dada7f2..e557edd4 100644 --- a/source/pdf/pdf-annot-edit.c +++ b/source/pdf/pdf-annot-edit.c @@ -3,7 +3,7 @@ #include <string.h> -#define TEXT_ANNOT_SIZE (25.0) +#define TEXT_ANNOT_SIZE (25.0f) const char * pdf_string_from_annot_type(fz_context *ctx, fz_annot_type type) @@ -95,7 +95,7 @@ pdf_create_annot(fz_context *ctx, pdf_page *page, fz_annot_type type) fz_try(ctx) { int ind_obj_num; - fz_rect rect = {0.0, 0.0, 0.0, 0.0}; + fz_rect rect = {0.0f, 0.0f, 0.0f, 0.0f}; const char *type_str; pdf_obj *annot_arr; diff --git a/source/pdf/pdf-appearance.c b/source/pdf/pdf-appearance.c index a6445d0d..fbd50434 100644 --- a/source/pdf/pdf-appearance.c +++ b/source/pdf/pdf-appearance.c @@ -12,10 +12,10 @@ #define STRIKE_HEIGHT (0.375f) #define UNDERLINE_HEIGHT (0.075f) #define LINE_THICKNESS (0.07f) -#define SMALL_FLOAT (0.00001) -#define LIST_SEL_COLOR_R (0.6) -#define LIST_SEL_COLOR_G (0.75) -#define LIST_SEL_COLOR_B (0.85) +#define SMALL_FLOAT (0.00001f) +#define LIST_SEL_COLOR_R (0.6f) +#define LIST_SEL_COLOR_G (0.75f) +#define LIST_SEL_COLOR_B (0.85f) enum { @@ -172,9 +172,9 @@ static void get_font_info(fz_context *ctx, pdf_document *doc, pdf_obj *dr, char fz_throw(ctx, FZ_ERROR_GENERIC, "No font name in default appearance"); font_rec->font = font = pdf_load_font(ctx, doc, dr, pdf_dict_gets(ctx, pdf_dict_get(ctx, dr, PDF_NAME_Font), font_rec->da_rec.font_name), 0); - font_rec->lineheight = 1.0; + font_rec->lineheight = 1.0f; if (font && font->ascent != 0.0f && font->descent != 0.0f) - font_rec->lineheight = (font->ascent - font->descent) / 1000.0; + font_rec->lineheight = (font->ascent - font->descent) / 1000.0f; } static void font_info_fin(fz_context *ctx, font_info *font_rec) @@ -306,7 +306,7 @@ static void fzbuf_print_text(fz_context *ctx, fz_buffer *fzbuf, const fz_rect *c fz_append_printf(ctx, fzbuf, fmt_W); if (col) { - fzbuf_print_color(ctx, fzbuf, col, 0, 0.0); + fzbuf_print_color(ctx, fzbuf, col, 0, 0.0f); fz_append_printf(ctx, fzbuf, fmt_f); } else @@ -424,7 +424,7 @@ static void text_splitter_init(text_splitter *splitter, font_info *info, const c splitter->unscaled_width = width; splitter->height = height; splitter->fontsize = fontsize; - splitter->scale = 1.0; + splitter->scale = 1.0f; splitter->lineheight = fontsize * info->lineheight ; /* RJW: The cast in the following line is important, as otherwise * under MSVC in the variable = 0 case, splitter->max_lines becomes @@ -482,7 +482,7 @@ static int text_splitter_layout(fz_context *ctx, text_splitter *splitter) stride = pdf_text_stride(ctx, splitter->info->font, fontsize, (unsigned char *)text, len, room, &count); /* If not a single char fits although the line is empty, then force one char */ - if (count == 0 && splitter->x == 0.0) + if (count == 0 && splitter->x == 0.0f) stride = pdf_text_stride(ctx, splitter->info->font, fontsize, (unsigned char *)text, 1, FLT_MAX, &count); if (count < len && splitter->retry) @@ -500,8 +500,8 @@ static int text_splitter_layout(fz_context *ctx, text_splitter *splitter) fitwidth *= 1.001f; /* Stretching by 10% is worth trying only if processing the first word on the line */ - hstretchwidth = splitter->x == 0.0 - ? splitter->width * 1.1 / splitter->scale + hstretchwidth = splitter->x == 0.0f + ? splitter->width * 1.1f / splitter->scale : FLT_MAX; vstretchwidth = splitter->width * (splitter->max_lines + 1) * splitter->lineheight @@ -524,7 +524,7 @@ static int text_splitter_layout(fz_context *ctx, text_splitter *splitter) /* This is not the first word on the line. Best to give up on this line and push * the word onto the next */ - if (count < len && splitter->x > 0.0) + if (count < len && splitter->x > 0.0f) return 0; splitter->text_end = splitter->text_start + count; @@ -571,7 +571,7 @@ static void fzbuf_print_text_start1(fz_context *ctx, fz_buffer *fzbuf, const fz_ fz_append_printf(ctx, fzbuf, fmt_W); if (col) { - fzbuf_print_color(ctx, fzbuf, col, 0, 0.0); + fzbuf_print_color(ctx, fzbuf, col, 0, 0.0f); fz_append_printf(ctx, fzbuf, fmt_f); } else @@ -622,12 +622,12 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con fz_rect tbox; rect = *bbox; - if (rect.x1 - rect.x0 > 3.0 && rect.y1 - rect.y0 > 3.0) + if (rect.x1 - rect.x0 > 3.0f && rect.y1 - rect.y0 > 3.0f) { - rect.x0 += 1.0; - rect.x1 -= 1.0; - rect.y0 += 1.0; - rect.y1 -= 1.0; + rect.x0 += 1.0f; + rect.x1 -= 1.0f; + rect.y0 += 1.0f; + rect.y1 -= 1.0f; } height = rect.y1 - rect.y0; @@ -643,7 +643,7 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con variable = (info->font_rec.da_rec.font_size == 0); fontsize = variable - ? (info->multiline ? 14.0 : height / info->font_rec.lineheight) + ? (info->multiline ? 14.0f : height / info->font_rec.lineheight) : info->font_rec.da_rec.font_size; info->font_rec.da_rec.font_size = fontsize; @@ -698,11 +698,11 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con fzbuf = fz_new_buffer(ctx, 0); tm.a = splitter.scale; - tm.b = 0.0; - tm.c = 0.0; + tm.b = 0.0f; + tm.c = 0.0f; tm.d = splitter.scale; tm.e = rect.x0; - tm.f = rect.y1 - (1.0+ascent-descent)*fontsize*splitter.scale/2.0; + tm.f = rect.y1 - (1.0f+ascent-descent)*fontsize*splitter.scale/2.0f; fzbuf_print_text_start1(ctx, fzbuf, &rect, info->col); fzbuf_print_text_start2(ctx, fzbuf, &info->font_rec, &tm); @@ -716,9 +716,9 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con int i, n = fz_mini((int)strlen(text), info->max_len); float comb_width = full_width/info->max_len; float char_width = pdf_text_stride(ctx, info->font_rec.font, fontsize, (unsigned char *)"M", 1, FLT_MAX, NULL); - float init_skip = (comb_width - char_width)/2.0; + float init_skip = (comb_width - char_width)/2.0f; - fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0); + fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0f); fzbuf = fz_new_buffer(ctx, 0); @@ -726,7 +726,7 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con fzbuf_print_text_start2(ctx, fzbuf, &info->font_rec, &tm); for (i = 0; i < n; i++) - fzbuf_print_text_word(ctx, fzbuf, i == 0 ? init_skip : comb_width, 0.0, text+i, 1); + fzbuf_print_text_word(ctx, fzbuf, i == 0 ? init_skip : comb_width, 0.0f, text+i, 1); fzbuf_print_text_end(ctx, fzbuf); } @@ -738,7 +738,7 @@ static fz_buffer *create_text_appearance(fz_context *ctx, pdf_document *doc, con } else { - fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0); + fz_translate(&tm, rect.x0, rect.y1 - (height+(ascent-descent)*fontsize)/2.0f); switch (info->q) { @@ -1130,7 +1130,7 @@ static int get_border_style(fz_context *ctx, pdf_obj *obj) static float get_border_width(fz_context *ctx, pdf_obj *obj) { float w = pdf_to_real(ctx, pdf_dict_getl(ctx, obj, PDF_NAME_BS, PDF_NAME_W, NULL)); - return w == 0.0 ? 1.0 : w; + return w == 0.0f ? 1.0f : w; } void pdf_update_text_appearance(fz_context *ctx, pdf_document *doc, pdf_obj *obj, char *eventValue) @@ -1297,18 +1297,18 @@ void pdf_update_listbox_appearance(fz_context *ctx, pdf_document *doc, pdf_obj * } } - if (clip_rect.x1 - clip_rect.x0 > 3.0 && clip_rect.y1 - clip_rect.y0 > 3.0) + if (clip_rect.x1 - clip_rect.x0 > 3.0f && clip_rect.y1 - clip_rect.y0 > 3.0f) { - clip_rect.x0 += 1.0; - clip_rect.x1 -= 1.0; - clip_rect.y0 += 1.0; - clip_rect.y1 -= 1.0; + clip_rect.x0 += 1.0f; + clip_rect.x1 -= 1.0f; + clip_rect.y0 += 1.0f; + clip_rect.y1 -= 1.0f; } height = clip_rect.y1 - clip_rect.y0; width = clip_rect.x1 - clip_rect.x0; variable = (info.font_rec.da_rec.font_size == 0); fontsize = variable - ? (info.multiline ? 14.0 : height / info.font_rec.lineheight) + ? (info.multiline ? 14.0f : height / info.font_rec.lineheight) : info.font_rec.da_rec.font_size; /* Get the ascent, descent across the items list. */ @@ -1337,10 +1337,10 @@ void pdf_update_listbox_appearance(fz_context *ctx, pdf_document *doc, pdf_obj * /* Add the selection rects */ if (num_sel > 0) { - color[0] = (float)LIST_SEL_COLOR_R; - color[1] = (float)LIST_SEL_COLOR_G; - color[2] = (float)LIST_SEL_COLOR_B; - fill_rect.x0 = 0.0; + color[0] = LIST_SEL_COLOR_R; + color[1] = LIST_SEL_COLOR_G; + color[2] = LIST_SEL_COLOR_B; + fill_rect.x0 = 0.0f; fill_rect.x1 = width; for (i = 0; i < num_sel; i++) { @@ -1354,7 +1354,7 @@ void pdf_update_listbox_appearance(fz_context *ctx, pdf_document *doc, pdf_obj * /* And now finish with the text content */ for (i = 0; i < n; i++) { - fzbuf_print_text_word(ctx, fzbuf, 0.0, i == 0 ? 0 : -fontsize * + fzbuf_print_text_word(ctx, fzbuf, 0.0f, i == 0 ? 0 : -fontsize * lineheight, opts[i], (int)strlen(opts[i])); } fzbuf_print_text_end(ctx, fzbuf); @@ -1448,7 +1448,7 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob tobj = pdf_dict_getl(ctx, obj, PDF_NAME_MK, PDF_NAME_BG, NULL); if (pdf_is_array(ctx, tobj)) { - fzbuf_print_color(ctx, fzbuf, tobj, 0, 0.0); + fzbuf_print_color(ctx, fzbuf, tobj, 0, 0.0f); fz_append_printf(ctx, fzbuf, fmt_re, rect.x0, rect.y0, rect.x1, rect.y1); fz_append_printf(ctx, fzbuf, fmt_f); @@ -1461,9 +1461,9 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob btotal += bwidth; if (bstyle == BS_Beveled) - fz_append_printf(ctx, fzbuf, fmt_g, 1.0); + fz_append_printf(ctx, fzbuf, fmt_g, 1.0f); else - fz_append_printf(ctx, fzbuf, fmt_g, 0.33); + fz_append_printf(ctx, fzbuf, fmt_g, 0.33f); fz_append_printf(ctx, fzbuf, fmt_m, bwidth, bwidth); fz_append_printf(ctx, fzbuf, fmt_l, bwidth, rect.y1 - bwidth); fz_append_printf(ctx, fzbuf, fmt_l, rect.x1 - bwidth, rect.y1 - bwidth); @@ -1472,9 +1472,9 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob fz_append_printf(ctx, fzbuf, fmt_l, 2 * bwidth, 2 * bwidth); fz_append_printf(ctx, fzbuf, fmt_f); if (bstyle == BS_Beveled) - fzbuf_print_color(ctx, fzbuf, tobj, 0, -0.25); + fzbuf_print_color(ctx, fzbuf, tobj, 0, -0.25f); else - fz_append_printf(ctx, fzbuf, fmt_g, 0.66); + fz_append_printf(ctx, fzbuf, fmt_g, 0.66f); fz_append_printf(ctx, fzbuf, fmt_m, rect.x1 - bwidth, rect.y1 - bwidth); fz_append_printf(ctx, fzbuf, fmt_l, rect.x1 - bwidth, bwidth); fz_append_printf(ctx, fzbuf, fmt_l, bwidth, bwidth); @@ -1487,7 +1487,7 @@ void pdf_update_pushbutton_appearance(fz_context *ctx, pdf_document *doc, pdf_ob tobj = pdf_dict_getl(ctx, obj, PDF_NAME_MK, PDF_NAME_BC, NULL); if (tobj) { - fzbuf_print_color(ctx, fzbuf, tobj, 1, 0.0); + fzbuf_print_color(ctx, fzbuf, tobj, 1, 0.0f); fz_append_printf(ctx, fzbuf, fmt_w, bwidth); fz_append_printf(ctx, fzbuf, fmt_re, bwidth/2, bwidth/2, @@ -1539,26 +1539,26 @@ void pdf_update_text_markup_appearance(fz_context *ctx, pdf_document *doc, pdf_a switch (type) { case PDF_ANNOT_HIGHLIGHT: - color[0] = 1.0; - color[1] = 1.0; - color[2] = 0.0; - alpha = 0.5; - line_thickness = 1.0; - line_height = 0.5; + color[0] = 1.0f; + color[1] = 1.0f; + color[2] = 0.0f; + alpha = 0.5f; + line_thickness = 1.0f; + line_height = 0.5f; break; case PDF_ANNOT_UNDERLINE: - color[0] = 0.0; - color[1] = 0.0; - color[2] = 1.0; - alpha = 1.0; + color[0] = 0.0f; + color[1] = 0.0f; + color[2] = 1.0f; + alpha = 1.0f; line_thickness = LINE_THICKNESS; line_height = UNDERLINE_HEIGHT; break; case PDF_ANNOT_STRIKE_OUT: - color[0] = 1.0; - color[1] = 0.0; - color[2] = 0.0; - alpha = 1.0; + color[0] = 1.0f; + color[1] = 0.0f; + color[2] = 0.0f; + alpha = 1.0f; line_thickness = LINE_THICKNESS; line_height = STRIKE_HEIGHT; break; @@ -2054,14 +2054,14 @@ static const float outline_thickness = 15.0f; static void draw_rounded_rect(fz_context *ctx, fz_path *path) { - fz_moveto(ctx, path, 20.0, 60.0); - fz_curveto(ctx, path, 20.0, 30.0, 30.0, 20.0, 60.0, 20.0); - fz_lineto(ctx, path, 340.0, 20.0); - fz_curveto(ctx, path, 370.0, 20.0, 380.0, 30.0, 380.0, 60.0); - fz_lineto(ctx, path, 380.0, 340.0); - fz_curveto(ctx, path, 380.0, 370.0, 370.0, 380.0, 340.0, 380.0); - fz_lineto(ctx, path, 60.0, 380.0); - fz_curveto(ctx, path, 30.0, 380.0, 20.0, 370.0, 20.0, 340.0); + fz_moveto(ctx, path, 20.0f, 60.0f); + fz_curveto(ctx, path, 20.0f, 30.0f, 30.0f, 20.0f, 60.0f, 20.0f); + fz_lineto(ctx, path, 340.0f, 20.0f); + fz_curveto(ctx, path, 370.0f, 20.0f, 380.0f, 30.0f, 380.0f, 60.0f); + fz_lineto(ctx, path, 380.0f, 340.0f); + fz_curveto(ctx, path, 380.0f, 370.0f, 370.0f, 380.0f, 340.0f, 380.0f); + fz_lineto(ctx, path, 60.0f, 380.0f); + fz_curveto(ctx, path, 30.0f, 380.0f, 20.0f, 370.0f, 20.0f, 340.0f); fz_closepath(ctx, path); } @@ -2077,9 +2077,9 @@ static void draw_speech_bubble(fz_context *ctx, fz_path *path) void pdf_update_text_annot_appearance(fz_context *ctx, pdf_document *doc, pdf_annot *annot) { - static float white[3] = {1.0, 1.0, 1.0}; - static float yellow[3] = {1.0, 1.0, 0.0}; - static float black[3] = {0.0, 0.0, 0.0}; + static float white[3] = {1.0f, 1.0f, 1.0f}; + static float yellow[3] = {1.0f, 1.0f, 0.0f}; + static float black[3] = {0.0f, 0.0f, 0.0f}; fz_display_list *dlist = NULL; fz_device *dev = NULL; diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c index bbfe06d2..23fed0fd 100644 --- a/source/pdf/pdf-device.c +++ b/source/pdf/pdf-device.c @@ -1127,8 +1127,8 @@ fz_device *pdf_new_pdf_device(fz_context *ctx, pdf_document *doc, const fz_matri dev->gstates[0].colorspace[1] = fz_device_gray(ctx); dev->gstates[0].color[0][0] = 1; dev->gstates[0].color[1][0] = 1; - dev->gstates[0].alpha[0] = 1.0; - dev->gstates[0].alpha[1] = 1.0; + dev->gstates[0].alpha[0] = 1.0f; + dev->gstates[0].alpha[1] = 1.0f; dev->gstates[0].font = -1; dev->num_gstates = 1; dev->max_gstates = 1; diff --git a/source/pdf/pdf-font.c b/source/pdf/pdf-font.c index 43390247..037372c1 100644 --- a/source/pdf/pdf-font.c +++ b/source/pdf/pdf-font.c @@ -1489,7 +1489,7 @@ float pdf_text_stride(fz_context *ctx, pdf_font_desc *fontdesc, float fontsize, { pdf_hmtx h; size_t i = 0; - float x = 0.0; + float x = 0.0f; while(i < len) { @@ -1497,7 +1497,7 @@ float pdf_text_stride(fz_context *ctx, pdf_font_desc *fontdesc, float fontsize, h = pdf_lookup_hmtx(ctx, fontdesc, buf[i]); - span = h.w * fontsize / 1000.0; + span = h.w * fontsize / 1000.0f; if (x + span > room) break; diff --git a/source/pdf/pdf-function.c b/source/pdf/pdf-function.c index 1e53291e..b0c4a6ed 100644 --- a/source/pdf/pdf-function.c +++ b/source/pdf/pdf-function.c @@ -231,7 +231,7 @@ ps_push_real(ps_stack *st, float n) { /* Push 1.0, as it's a small known value that won't * cause a divide by 0. Same reason as in fz_atof. */ - n = 1.0; + n = 1.0f; } st->stack[st->sp].u.f = fz_clamp(n, -FLT_MAX, FLT_MAX); st->sp++; diff --git a/source/pdf/pdf-interpret.c b/source/pdf/pdf-interpret.c index ef06b312..577bd818 100644 --- a/source/pdf/pdf-interpret.c +++ b/source/pdf/pdf-interpret.c @@ -265,7 +265,7 @@ pdf_process_extgstate(fz_context *ctx, pdf_processor *proc, pdf_csi *csi, pdf_ob * a test for subtractive color spaces, but this will have * to do for now. */ if (colorspace == fz_device_cmyk(ctx)) - softmask_bc[3] = 1.0; + softmask_bc[3] = 1.0f; bc = pdf_dict_get(ctx, obj, PDF_NAME_BC); if (pdf_is_array(ctx, bc)) diff --git a/source/pdf/pdf-op-run.c b/source/pdf/pdf-op-run.c index 22721173..fddc9b91 100644 --- a/source/pdf/pdf-op-run.c +++ b/source/pdf/pdf-op-run.c @@ -462,10 +462,10 @@ pdf_show_pattern(fz_context *ctx, pdf_run_processor *pr, pdf_pattern *pat, pdf_g * this amount to be smaller than 1/256, we guarantee we won't * cause problems that will be visible even under our most * extreme antialiasing. */ - x0 = floorf(fx0 + 0.001); - y0 = floorf(fy0 + 0.001); - x1 = ceilf(fx1 - 0.001); - y1 = ceilf(fy1 - 0.001); + x0 = floorf(fx0 + 0.001f); + y0 = floorf(fy0 + 0.001f); + x1 = ceilf(fx1 - 0.001f); + y1 = ceilf(fy1 - 0.001f); /* The above adjustments cause problems for sufficiently * large values for xstep/ystep which may be used if the * pattern is expected to be rendered exactly once. */ diff --git a/source/pdf/pdf-write.c b/source/pdf/pdf-write.c index 9a066430..1353f659 100644 --- a/source/pdf/pdf-write.c +++ b/source/pdf/pdf-write.c @@ -1158,7 +1158,7 @@ add_linearization_objs(fz_context *ctx, pdf_document *doc, pdf_write_state *opts opts->renumber_map[params_num] = params_num; opts->rev_renumber_map[params_num] = params_num; opts->gen_list[params_num] = 0; - pdf_dict_put_drop(ctx, params_obj, PDF_NAME_Linearized, pdf_new_real(ctx, doc, 1.0)); + pdf_dict_put_drop(ctx, params_obj, PDF_NAME_Linearized, pdf_new_real(ctx, doc, 1.0f)); opts->linear_l = pdf_new_int(ctx, doc, INT_MIN); pdf_dict_put(ctx, params_obj, PDF_NAME_L, opts->linear_l); opts->linear_h0 = pdf_new_int(ctx, doc, INT_MIN); diff --git a/source/pdf/pdf-xref.c b/source/pdf/pdf-xref.c index 2d046bbe..ba2689b9 100644 --- a/source/pdf/pdf-xref.c +++ b/source/pdf/pdf-xref.c @@ -594,7 +594,7 @@ pdf_load_version(fz_context *ctx, pdf_document *doc) if (memcmp(buf, "%PDF-", 5) != 0) fz_throw(ctx, FZ_ERROR_GENERIC, "cannot recognize version marker"); - doc->version = 10 * (fz_atof(buf+5) + 0.05); + doc->version = 10 * (fz_atof(buf+5) + 0.05f); } static void @@ -1469,7 +1469,7 @@ pdf_init_document(fz_context *ctx, pdf_document *doc) version_str = pdf_to_name(ctx, obj); if (*version_str) { - int version = 10 * (fz_atof(version_str) + 0.05); + int version = 10 * (fz_atof(version_str) + 0.05f); if (version > doc->version) doc->version = version; } 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; } } diff --git a/source/tests/mu-office-test.c b/source/tests/mu-office-test.c index c734500a..aef50981 100644 --- a/source/tests/mu-office-test.c +++ b/source/tests/mu-office-test.c @@ -89,8 +89,8 @@ test_async(MuOfficeLib *mu) fprintf(stderr, "Page size = %g x %g\n", w, h); /* Allocate ourselves a bitmap */ - bitmap.width = (int)(w * 1.5 + 0.5); - bitmap.height = (int)(h * 1.5 + 0.5); + bitmap.width = (int)(w * 1.5f + 0.5f); + bitmap.height = (int)(h * 1.5f + 0.5f); bitmap.lineSkip = bitmap.width * 4; bitmap.memptr = malloc(bitmap.lineSkip * bitmap.height); @@ -99,8 +99,8 @@ test_async(MuOfficeLib *mu) area.origin.y = 0; area.renderArea.x = 0; area.renderArea.y = 0; - area.renderArea.width = (float)bitmap.width; - area.renderArea.height = (float)bitmap.height; + area.renderArea.width = bitmap.width; + area.renderArea.height = bitmap.height; /* Render into the bitmap */ err = MuOfficePage_render(page, 1.5f, &bitmap, &area, render_progress, (void *)5678, &render); @@ -178,8 +178,8 @@ test_sync(MuOfficeLib *mu) fprintf(stderr, "Page size = %g x %g\n", w, h); /* Allocate ourselves a bitmap */ - bitmap.width = (int)(w * 1.5 + 0.5); - bitmap.height = (int)(h * 1.5 + 0.5); + bitmap.width = (int)(w * 1.5f + 0.5f); + bitmap.height = (int)(h * 1.5f + 0.5f); bitmap.lineSkip = bitmap.width * 4; bitmap.memptr = malloc(bitmap.lineSkip * bitmap.height); @@ -188,8 +188,8 @@ test_sync(MuOfficeLib *mu) area.origin.y = 0; area.renderArea.x = 0; area.renderArea.y = 0; - area.renderArea.width = (float)bitmap.width; - area.renderArea.height = (float)bitmap.height; + area.renderArea.width = bitmap.width; + area.renderArea.height = bitmap.height; /* Render into the bitmap */ err = MuOfficePage_render(page, 1.5f, &bitmap, &area, NULL, NULL, &render); diff --git a/source/tools/muraster.c b/source/tools/muraster.c index 12b81ac3..5b92a9d2 100644 --- a/source/tools/muraster.c +++ b/source/tools/muraster.c @@ -71,13 +71,13 @@ MURASTER_CONFIG_WIDTH: The printable page width (in inches) */ -/* #define MURASTER_CONFIG_WIDTH 8.27 */ +/* #define MURASTER_CONFIG_WIDTH 8.27f */ /* MURASTER_CONFIG_HEIGHT: The printable page height (in inches) */ -/* #define MURASTER_CONFIG_HEIGHT 11.69 */ +/* #define MURASTER_CONFIG_HEIGHT 11.69f */ /* MURASTER_CONFIG_STORE_SIZE: The maximum size to use @@ -172,13 +172,13 @@ int gettimeofday(struct timeval *tv, struct timezone *tz); #ifdef MURASTER_CONFIG_WIDTH #define PAPER_WIDTH MURASTER_CONFIG_WIDTH #else -#define PAPER_WIDTH 8.27 +#define PAPER_WIDTH 8.27f #endif #ifdef MURASTER_CONFIG_HEIGHT #define PAPER_HEIGHT MURASTER_CONFIG_HEIGHT #else -#define PAPER_HEIGHT 11.69 +#define PAPER_HEIGHT 11.69f #endif #ifdef MURASTER_CONFIG_STORE_SIZE diff --git a/source/tools/murun.c b/source/tools/murun.c index c817ca96..cbfd2a78 100644 --- a/source/tools/murun.c +++ b/source/tools/murun.c @@ -3626,7 +3626,7 @@ static void ffi_PDFObject_asNumber(js_State *J) { fz_context *ctx = js_getcontext(J); pdf_obj *obj = js_touserdata(J, 0, "pdf_obj"); - double num; + float num; fz_try(ctx) if (pdf_is_int(ctx, obj)) num = pdf_to_int(ctx, obj); diff --git a/source/xps/xps-glyphs.c b/source/xps/xps-glyphs.c index 98a44217..bfe38432 100644 --- a/source/xps/xps-glyphs.c +++ b/source/xps/xps-glyphs.c @@ -64,9 +64,9 @@ xps_measure_font_glyph(fz_context *ctx, xps_document *doc, fz_font *font, int gi FT_Get_Advance(face, gid, mask | FT_LOAD_VERTICAL_LAYOUT, &vadv); fz_unlock(ctx, FZ_LOCK_FREETYPE); - mtx->hadv = hadv / (float)face->units_per_EM; - mtx->vadv = vadv / (float)face->units_per_EM; - mtx->vorg = face->ascender / (float) face->units_per_EM; + mtx->hadv = (float) hadv / face->units_per_EM; + mtx->vadv = (float) vadv / face->units_per_EM; + mtx->vorg = (float) face->ascender / face->units_per_EM; } static fz_font * diff --git a/source/xps/xps-gradient.c b/source/xps/xps-gradient.c index 02279677..a7a7cf44 100644 --- a/source/xps/xps-gradient.c +++ b/source/xps/xps-gradient.c @@ -312,10 +312,10 @@ xps_draw_radial_gradient(fz_context *ctx, xps_document *doc, const fz_matrix *ct char *radius_x_att = fz_xml_att(root, "RadiusX"); char *radius_y_att = fz_xml_att(root, "RadiusY"); - x0 = y0 = 0.0; - x1 = y1 = 1.0; - xrad = 1.0; - yrad = 1.0; + x0 = y0 = 0.0f; + x1 = y1 = 1.0f; + xrad = 1.0f; + yrad = 1.0f; if (origin_att) xps_parse_point(ctx, doc, origin_att, &x0, &y0); @@ -335,7 +335,7 @@ xps_draw_radial_gradient(fz_context *ctx, xps_document *doc, const fz_matrix *ct fz_pre_scale(&local_ctm, 1, yrad/xrad); } - if (yrad != 0.0) + if (yrad != 0.0f) { invscale = xrad / yrad; y0 = y0 * invscale; |