diff options
Diffstat (limited to 'source/fitz')
-rw-r--r-- | source/fitz/draw-path.c | 14 | ||||
-rw-r--r-- | source/fitz/filter-sgi.c | 10 | ||||
-rw-r--r-- | source/fitz/geometry.c | 8 | ||||
-rw-r--r-- | source/fitz/shade.c | 2 | ||||
-rw-r--r-- | source/fitz/stext-paragraph.c | 2 |
5 files changed, 16 insertions, 20 deletions
diff --git a/source/fitz/draw-path.c b/source/fitz/draw-path.c index 0dec60b8..fe140a56 100644 --- a/source/fitz/draw-path.c +++ b/source/fitz/draw-path.c @@ -338,20 +338,20 @@ fz_add_arc(fz_context *ctx, sctx *s, int n, i; r = fabsf(s->linewidth); - theta = 2 * (float)M_SQRT2 * sqrtf(s->flatness / r); + theta = 2 * FZ_SQRT2 * sqrtf(s->flatness / r); th0 = atan2f(y0, x0); th1 = atan2f(y1, x1); if (r > 0) { if (th0 < th1) - th0 += (float)M_PI * 2; + th0 += FZ_PI * 2; n = ceilf((th0 - th1) / theta); } else { if (th1 < th0) - th1 += (float)M_PI * 2; + th1 += FZ_PI * 2; n = ceilf((th1 - th0) / theta); } @@ -549,12 +549,12 @@ fz_add_line_cap(fz_context *ctx, sctx *s, float ax, float ay, float bx, float by case FZ_LINECAP_ROUND: { int i; - int n = ceilf((float)M_PI / (2.0f * (float)M_SQRT2 * sqrtf(flatness / linewidth))); + int n = ceilf(FZ_PI / (2.0f * FZ_SQRT2 * sqrtf(flatness / linewidth))); float ox = bx - dlx; float oy = by - dly; for (i = 1; i < n; i++) { - float theta = (float)M_PI * i / n; + float theta = FZ_PI * i / n; float cth = cosf(theta); float sth = sinf(theta); float nx = bx - dlx * cth - dly * sth; @@ -595,7 +595,7 @@ fz_add_line_dot(fz_context *ctx, sctx *s, float ax, float ay) { float flatness = s->flatness; float linewidth = s->linewidth; - int n = ceilf((float)M_PI / ((float)M_SQRT2 * sqrtf(flatness / linewidth))); + int n = ceilf(FZ_PI / (FZ_SQRT2 * sqrtf(flatness / linewidth))); float ox = ax - linewidth; float oy = ay; int i; @@ -604,7 +604,7 @@ fz_add_line_dot(fz_context *ctx, sctx *s, float ax, float ay) n = 3; for (i = 1; i < n; i++) { - float theta = (float)M_PI * 2 * i / n; + float theta = FZ_PI * 2 * i / n; float cth = cosf(theta); float sth = sinf(theta); float nx = ax - cth * linewidth; diff --git a/source/fitz/filter-sgi.c b/source/fitz/filter-sgi.c index c0946df2..518751ed 100644 --- a/source/fitz/filter-sgi.c +++ b/source/fitz/filter-sgi.c @@ -180,10 +180,6 @@ static struct { { 0.023659f, 21, 16268 }, }; -#ifndef M_LN2 -#define M_LN2 0.69314718055994530942 -#endif - /* SGI Log 16bit (greyscale) */ typedef struct fz_sgilog16_s fz_sgilog16; @@ -206,7 +202,7 @@ sgilog16val(fz_context *ctx, uint16_t v) Y = 0; else { - Y = expf(M_LN2/256 * (Le + .5f) - M_LN2*64); + Y = expf(FZ_LN2/256 * (Le + .5f) - FZ_LN2*64); if (v & 0x8000) Y = -Y; } @@ -401,7 +397,7 @@ sgilog24val(fz_context *ctx, fz_stream *chain, uint8_t *rgb) /* decode luminance */ p = (luv>>14) & 0x3ff; - Y = (p == 0 ? 0 : expf(M_LN2/64*(p+.5f) - M_LN2*12)); + Y = (p == 0 ? 0 : expf(FZ_LN2/64*(p+.5f) - FZ_LN2*12)); if (Y <= 0) { X = Y = Z = 0; @@ -532,7 +528,7 @@ sgilog32val(fz_context *ctx, uint32_t p, uint8_t *rgb) else { int Le = (p>>16) & 0x7fff; - Y = !Le ? 0 : expf(M_LN2/256*(Le+.5f) - M_LN2*64); + Y = !Le ? 0 : expf(FZ_LN2/256*(Le+.5f) - FZ_LN2*64); /* decode color */ u = (1.f/UVSCALE) * ((p>>8 & 0xff) + .5f); v = (1.f/UVSCALE) * ((p & 0xff) + .5f); diff --git a/source/fitz/geometry.c b/source/fitz/geometry.c index 1940b417..64abd5c4 100644 --- a/source/fitz/geometry.c +++ b/source/fitz/geometry.c @@ -128,8 +128,8 @@ fz_rotate(fz_matrix *m, float theta) } else { - s = sinf(theta * (float)M_PI / 180); - c = cosf(theta * (float)M_PI / 180); + s = sinf(theta * FZ_PI / 180); + c = cosf(theta * FZ_PI / 180); } m->a = c; m->b = s; @@ -177,8 +177,8 @@ fz_pre_rotate(fz_matrix *m, float theta) } else { - float s = sinf(theta * (float)M_PI / 180); - float c = cosf(theta * (float)M_PI / 180); + float s = sinf(theta * FZ_PI / 180); + float c = cosf(theta * FZ_PI / 180); float a = m->a; float b = m->b; m->a = c * a + s * m->c; diff --git a/source/fitz/shade.c b/source/fitz/shade.c index b7e746d7..13788472 100644 --- a/source/fitz/shade.c +++ b/source/fitz/shade.c @@ -201,7 +201,7 @@ fz_paint_annulus(fz_context *ctx, const fz_matrix *ctm, int i; theta = atan2f(p1.y - p0.y, p1.x - p0.x); - step = (float)M_PI / count; + step = FZ_PI / count; a = 0; for (i = 1; i <= count; i++) diff --git a/source/fitz/stext-paragraph.c b/source/fitz/stext-paragraph.c index 0a717c1b..b28cb200 100644 --- a/source/fitz/stext-paragraph.c +++ b/source/fitz/stext-paragraph.c @@ -61,7 +61,7 @@ insert_line_height(line_heights *lh, fz_stext_style *style, float height) for (i=0; i < lh->len; i++) { /* Match if we are within 5% */ - if (lh->lh[i].style == style && lh->lh[i].height * 0.95 <= height && lh->lh[i].height * 1.05 >= height) + if (lh->lh[i].style == style && lh->lh[i].height * 0.95f <= height && lh->lh[i].height * 1.05f >= height) { /* Ensure that the average height is correct */ lh->lh[i].height = (lh->lh[i].height * lh->lh[i].count + height) / (lh->lh[i].count+1); |