summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2011-04-08 13:49:11 +0200
committerTor Andersson <tor.andersson@artifex.com>2011-04-08 13:49:11 +0200
commit94e774a8bd2891f36885ae710efd42caebd855ed (patch)
tree883147e1bf5dc8feba5d142b8ffcde8e7e0676f6
parenta1b5f023ccebd339e9a74ef7f3bcc94c0c74d3e0 (diff)
downloadmupdf-94e774a8bd2891f36885ae710efd42caebd855ed.tar.xz
Remove inline keyword where it is not strictly necessary for performance.
Also put the function on the same line for inline functions, so they stick out and are easy to find with grep.
-rw-r--r--draw/draw_blend.c32
-rw-r--r--draw/draw_edge.c30
-rw-r--r--draw/draw_mesh.c12
-rw-r--r--fitz/filt_basic.c15
-rw-r--r--fitz/filt_faxd.c49
-rw-r--r--fitz/filt_predict.c24
-rw-r--r--fitz/obj_dict.c19
-rw-r--r--pdf/pdf_font.c2
-rw-r--r--pdf/pdf_function.c40
-rw-r--r--pdf/pdf_lex.c35
-rw-r--r--pdf/pdf_shade.c16
-rw-r--r--xps/xps_glyphs.c24
-rw-r--r--xps/xps_hash.c3
-rw-r--r--xps/xps_path.c4
-rw-r--r--xps/xps_png.c6
-rw-r--r--xps/xps_tiff.c6
16 files changed, 122 insertions, 195 deletions
diff --git a/draw/draw_blend.c b/draw/draw_blend.c
index 5b4d8e83..2d68758a 100644
--- a/draw/draw_blend.c
+++ b/draw/draw_blend.c
@@ -27,14 +27,12 @@ const char *fz_blendmode_names[] =
/* Separable blend modes */
-static inline int
-fz_screen_byte(int b, int s)
+static inline int fz_screen_byte(int b, int s)
{
return b + s - fz_mul255(b, s);
}
-static inline int
-fz_hard_light_byte(int b, int s)
+static inline int fz_hard_light_byte(int b, int s)
{
int s2 = s << 1;
if (s <= 127)
@@ -43,26 +41,22 @@ fz_hard_light_byte(int b, int s)
return fz_screen_byte(b, s2 - 255);
}
-static inline int
-fz_overlay_byte(int b, int s)
+static inline int fz_overlay_byte(int b, int s)
{
return fz_hard_light_byte(s, b); /* note swapped order */
}
-static inline int
-fz_darken_byte(int b, int s)
+static inline int fz_darken_byte(int b, int s)
{
return MIN(b, s);
}
-static inline int
-fz_lighten_byte(int b, int s)
+static inline int fz_lighten_byte(int b, int s)
{
return MAX(b, s);
}
-static inline int
-fz_color_dodge_byte(int b, int s)
+static inline int fz_color_dodge_byte(int b, int s)
{
s = 255 - s;
if (b == 0)
@@ -73,8 +67,7 @@ fz_color_dodge_byte(int b, int s)
return (0x1fe * b + s) / (s << 1);
}
-static inline int
-fz_color_burn_byte(int b, int s)
+static inline int fz_color_burn_byte(int b, int s)
{
b = 255 - b;
if (b == 0)
@@ -85,8 +78,7 @@ fz_color_burn_byte(int b, int s)
return 0xff - (0x1fe * b + s) / (s << 1);
}
-static inline int
-fz_soft_light_byte(int b, int s)
+static inline int fz_soft_light_byte(int b, int s)
{
/* review this */
if (s < 128) {
@@ -102,21 +94,19 @@ fz_soft_light_byte(int b, int s)
}
}
-static inline int
-fz_difference_byte(int b, int s)
+static inline int fz_difference_byte(int b, int s)
{
return ABS(b - s);
}
-static inline int
-fz_exclusion_byte(int b, int s)
+static inline int fz_exclusion_byte(int b, int s)
{
return b + s - (fz_mul255(b, s)<<1);
}
/* Non-separable blend modes */
-static inline void
+static void
fz_luminosity_rgb(int *rd, int *gd, int *bd, int rb, int gb, int bb, int rs, int gs, int bs)
{
int delta, scale;
diff --git a/draw/draw_edge.c b/draw/draw_edge.c
index 2ef70d6b..ec56d189 100644
--- a/draw/draw_edge.c
+++ b/draw/draw_edge.c
@@ -396,7 +396,7 @@ fz_free_ael(fz_ael *ael)
fz_free(ael);
}
-static inline void
+static void
sort_ael(fz_edge **a, int n)
{
int h, i, k;
@@ -480,8 +480,7 @@ advance_ael(fz_ael *ael)
* Anti-aliased scan conversion.
*/
-static inline void
-add_span_aa(int *list, int x0, int x1, int xofs)
+static inline void add_span_aa(int *list, int x0, int x1, int xofs)
{
int x0pix, x0sub;
int x1pix, x1sub;
@@ -513,8 +512,7 @@ add_span_aa(int *list, int x0, int x1, int xofs)
}
}
-static inline void
-non_zero_winding_aa(fz_ael *ael, int *list, int xofs)
+static inline void non_zero_winding_aa(fz_ael *ael, int *list, int xofs)
{
int winding = 0;
int x = 0;
@@ -529,8 +527,7 @@ non_zero_winding_aa(fz_ael *ael, int *list, int xofs)
}
}
-static inline void
-even_odd_aa(fz_ael *ael, int *list, int xofs)
+static inline void even_odd_aa(fz_ael *ael, int *list, int xofs)
{
int even = 0;
int x = 0;
@@ -545,8 +542,7 @@ even_odd_aa(fz_ael *ael, int *list, int xofs)
}
}
-static inline void
-undelta_aa(unsigned char * restrict out, int * restrict in, int n)
+static inline void undelta_aa(unsigned char * restrict out, int * restrict in, int n)
{
int d = 0;
while (n--)
@@ -556,8 +552,8 @@ undelta_aa(unsigned char * restrict out, int * restrict in, int n)
}
}
-static inline void
-blit_aa(fz_pixmap *dst, int x, int y, unsigned char *mp, int w, unsigned char *color)
+static inline void blit_aa(fz_pixmap *dst, int x, int y,
+ unsigned char *mp, int w, unsigned char *color)
{
unsigned char *dp;
dp = dst->samples + ( (y - dst->y) * dst->w + (x - dst->x) ) * dst->n;
@@ -644,8 +640,8 @@ fz_scan_convert_aa(fz_gel *gel, fz_ael *ael, int eofill, fz_bbox clip,
* Sharp (not anti-aliased) scan conversion
*/
-static inline void
-blit_sharp(int x0, int x1, int y, fz_bbox clip, fz_pixmap *dst, unsigned char *color)
+static inline void blit_sharp(int x0, int x1, int y,
+ fz_bbox clip, fz_pixmap *dst, unsigned char *color)
{
unsigned char *dp;
x0 = CLAMP(x0, dst->x, dst->x + dst->w);
@@ -660,8 +656,8 @@ blit_sharp(int x0, int x1, int y, fz_bbox clip, fz_pixmap *dst, unsigned char *c
}
}
-static inline void
-non_zero_winding_sharp(fz_ael *ael, int y, fz_bbox clip, fz_pixmap *dst, unsigned char *color)
+static inline void non_zero_winding_sharp(fz_ael *ael, int y,
+ fz_bbox clip, fz_pixmap *dst, unsigned char *color)
{
int winding = 0;
int x = 0;
@@ -676,8 +672,8 @@ non_zero_winding_sharp(fz_ael *ael, int y, fz_bbox clip, fz_pixmap *dst, unsigne
}
}
-static inline void
-even_odd_sharp(fz_ael *ael, int y, fz_bbox clip, fz_pixmap *dst, unsigned char *color)
+static inline void even_odd_sharp(fz_ael *ael, int y,
+ fz_bbox clip, fz_pixmap *dst, unsigned char *color)
{
int even = 0;
int x = 0;
diff --git a/draw/draw_mesh.c b/draw/draw_mesh.c
index eeebf0a1..4254cb64 100644
--- a/draw/draw_mesh.c
+++ b/draw/draw_mesh.c
@@ -121,8 +121,7 @@ static int clip_poly(float src[MAXV][MAXN],
* gouraud shaded polygon scan conversion
*/
-static inline void
-paint_scan(fz_pixmap *pix, int y, int x1, int x2, int *v1, int *v2, int n)
+static void paint_scan(fz_pixmap *pix, int y, int x1, int x2, int *v1, int *v2, int n)
{
unsigned char *p = pix->samples + ((y - pix->y) * pix->w + (x1 - pix->x)) * pix->n;
int v[FZ_MAX_COLORS];
@@ -156,8 +155,7 @@ paint_scan(fz_pixmap *pix, int y, int x1, int x2, int *v1, int *v2, int n)
}
}
-static inline int
-find_next(int gel[MAXV][MAXN], int len, int a, int *s, int *e, int d)
+static int find_next(int gel[MAXV][MAXN], int len, int a, int *s, int *e, int d)
{
int b;
@@ -186,8 +184,7 @@ find_next(int gel[MAXV][MAXN], int len, int a, int *s, int *e, int d)
}
}
-static inline void
-load_edge(int gel[MAXV][MAXN], int s, int e, int *ael, int *del, int n)
+static void load_edge(int gel[MAXV][MAXN], int s, int e, int *ael, int *del, int n)
{
int swp, k, dy;
@@ -207,8 +204,7 @@ load_edge(int gel[MAXV][MAXN], int s, int e, int *ael, int *del, int n)
}
}
-static inline void
-step_edge(int *ael, int *del, int n)
+static inline void step_edge(int *ael, int *del, int n)
{
int k;
ael[0] += del[0];
diff --git a/fitz/filt_basic.c b/fitz/filt_basic.c
index 391f06ab..feb13076 100644
--- a/fitz/filt_basic.c
+++ b/fitz/filt_basic.c
@@ -75,14 +75,11 @@ static inline int ishex(int a)
(a >= '0' && a <= '9');
}
-static inline int from_hex(int a)
+static inline int unhex(int a)
{
- if (a >= 'A' && a <= 'F')
- return a - 'A' + 0xA;
- if (a >= 'a' && a <= 'f')
- return a - 'a' + 0xA;
- if (a >= '0' && a <= '9')
- return a - '0';
+ if (a >= 'A' && a <= 'F') return a - 'A' + 0xA;
+ if (a >= 'a' && a <= 'f') return a - 'a' + 0xA;
+ if (a >= '0' && a <= '9') return a - '0';
return 0;
}
@@ -109,12 +106,12 @@ read_ahxd(fz_stream *stm, unsigned char *buf, int len)
{
if (!odd)
{
- a = from_hex(c);
+ a = unhex(c);
odd = 1;
}
else
{
- b = from_hex(c);
+ b = unhex(c);
*p++ = (a << 4) | b;
odd = 0;
}
diff --git a/fitz/filt_faxd.c b/fitz/filt_faxd.c
index 97076f89..dcf56cf3 100644
--- a/fitz/filt_faxd.c
+++ b/fitz/filt_faxd.c
@@ -170,33 +170,12 @@ const cfd_node cf_uncompressed_decode[] = {
/* bit magic */
-static inline void
-print_bits(FILE *f, int code, int nbits)
-{
- int n, b;
- for (n = nbits - 1; n >= 0; n--)
- {
- b = (code >> n) & 1;
- fprintf(f, "%c", b ? '1' : '0');
- }
-}
-
-static inline int
-getbit(const unsigned char *buf, int x)
+static inline int getbit(const unsigned char *buf, int x)
{
return ( buf[x >> 3] >> ( 7 - (x & 7) ) ) & 1;
}
-static inline void
-print_line(FILE *f, unsigned char *line, int w)
-{
- int i;
- for (i = 0; i < w; i++)
- fprintf(f, "%c", getbit(line, i) ? '#' : '.');
- fprintf(f, "\n");
-}
-
-static inline int
+static int
find_changing(const unsigned char *line, int x, int w)
{
int a, b;
@@ -226,7 +205,7 @@ find_changing(const unsigned char *line, int x, int w)
return x;
}
-static inline int
+static int
find_changing_color(const unsigned char *line, int x, int w, int color)
{
if (!line)
@@ -248,8 +227,7 @@ static const unsigned char rm[8] = {
0x00, 0x80, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC, 0xFE
};
-static inline void
-setbits(unsigned char *line, int x0, int x1)
+static inline void setbits(unsigned char *line, int x0, int x1)
{
int a0, a1, b0, b1, a;
@@ -311,14 +289,13 @@ struct fz_faxd_s
unsigned char *rp, *wp;
};
-static inline void
-eat_bits(fz_faxd *fax, int nbits)
+static inline void eat_bits(fz_faxd *fax, int nbits)
{
fax->word <<= nbits;
fax->bidx += nbits;
}
-static inline int
+static int
fill_bits(fz_faxd *fax)
{
while (fax->bidx >= 8)
@@ -332,8 +309,8 @@ fill_bits(fz_faxd *fax)
return 0;
}
-static inline int
-getcode(fz_faxd *fax, const cfd_node *table, int initialbits)
+static int
+get_code(fz_faxd *fax, const cfd_node *table, int initialbits)
{
unsigned int word = fax->word;
int tidx = word >> (32 - initialbits);
@@ -363,9 +340,9 @@ dec1d(fz_faxd *fax)
fax->a = 0;
if (fax->c)
- code = getcode(fax, cf_black_decode, cfd_black_initial_bits);
+ code = get_code(fax, cf_black_decode, cfd_black_initial_bits);
else
- code = getcode(fax, cf_white_decode, cfd_white_initial_bits);
+ code = get_code(fax, cf_white_decode, cfd_white_initial_bits);
if (code == UNCOMPRESSED)
return fz_throw("uncompressed data in faxd");
@@ -404,9 +381,9 @@ dec2d(fz_faxd *fax)
fax->a = 0;
if (fax->c)
- code = getcode(fax, cf_black_decode, cfd_black_initial_bits);
+ code = get_code(fax, cf_black_decode, cfd_black_initial_bits);
else
- code = getcode(fax, cf_white_decode, cfd_white_initial_bits);
+ code = get_code(fax, cf_white_decode, cfd_white_initial_bits);
if (code == UNCOMPRESSED)
return fz_throw("uncompressed data in faxd");
@@ -434,7 +411,7 @@ dec2d(fz_faxd *fax)
return fz_okay;
}
- code = getcode(fax, cf_2d_decode, cfd_2d_initial_bits);
+ code = get_code(fax, cf_2d_decode, cfd_2d_initial_bits);
switch (code)
{
diff --git a/fitz/filt_predict.c b/fitz/filt_predict.c
index 1501fc09..94f2718a 100644
--- a/fitz/filt_predict.c
+++ b/fitz/filt_predict.c
@@ -23,33 +23,31 @@ struct fz_predict_s
unsigned char *rp, *wp;
};
-static inline int
-getcomponent(unsigned char *buf, int x, int bpc)
+static inline int getcomponent(unsigned char *line, int x, int bpc)
{
switch (bpc)
{
- case 1: return buf[x / 8] >> (7 - (x % 8)) & 0x01;
- case 2: return buf[x / 4] >> ((3 - (x % 4)) * 2) & 0x03;
- case 4: return buf[x / 2] >> ((1 - (x % 2)) * 4) & 0x0f;
- case 8: return buf[x];
+ case 1: return (line[x >> 3] >> ( 7 - (x & 7) ) ) & 1;
+ case 2: return (line[x >> 2] >> ( ( 3 - (x & 3) ) << 1 ) ) & 3;
+ case 4: return (line[x >> 1] >> ( ( 1 - (x & 1) ) << 2 ) ) & 15;
+ case 8: return line[x];
}
return 0;
}
-static inline void
-putcomponent(unsigned char *buf, int x, int bpc, int value)
+
+static inline void putcomponent(unsigned char *buf, int x, int bpc, int value)
{
switch (bpc)
{
- case 1: buf[x / 8] |= value << (7 - (x % 8)); break;
- case 2: buf[x / 4] |= value << ((3 - (x % 4)) * 2); break;
- case 4: buf[x / 2] |= value << ((1 - (x % 2)) * 4); break;
+ case 1: buf[x >> 3] |= value << (7 - (x & 7)); break;
+ case 2: buf[x >> 2] |= value << ((3 - (x & 3)) << 1); break;
+ case 4: buf[x >> 1] |= value << ((1 - (x & 1)) << 2); break;
case 8: buf[x] = value; break;
}
}
-static inline int
-paeth(int a, int b, int c)
+static inline int paeth(int a, int b, int c)
{
/* The definitions of ac and bc are correct, not a typo. */
int ac = b - c, bc = a - c, abcc = ac + bc;
diff --git a/fitz/obj_dict.c b/fitz/obj_dict.c
index 6f3ba9da..d165f46d 100644
--- a/fitz/obj_dict.c
+++ b/fitz/obj_dict.c
@@ -6,16 +6,7 @@ static int keyvalcmp(const void *ap, const void *bp)
{
const fz_keyval *a = ap;
const fz_keyval *b = bp;
- if (fz_is_name(a->k) && fz_is_name(b->k))
- return strcmp(fz_to_name(a->k), fz_to_name(b->k));
- return -1;
-}
-
-static inline int keystrcmp(fz_obj *key, char *s)
-{
- if (fz_is_name(key))
- return strcmp(fz_to_name(key), s);
- return -1;
+ return strcmp(fz_to_name(a->k), fz_to_name(b->k));
}
fz_obj *
@@ -95,7 +86,7 @@ fz_dict_get_val(fz_obj *obj, int i)
return obj->u.d.items[i].v;
}
-static inline int
+static int
fz_dict_finds(fz_obj *obj, char *key)
{
if (obj->u.d.sorted)
@@ -105,7 +96,7 @@ fz_dict_finds(fz_obj *obj, char *key)
while (l <= r)
{
int m = (l + r) >> 1;
- int c = -keystrcmp(obj->u.d.items[m].k, key);
+ int c = -strcmp(fz_to_name(obj->u.d.items[m].k), key);
if (c < 0)
r = m - 1;
else if (c > 0)
@@ -119,7 +110,7 @@ fz_dict_finds(fz_obj *obj, char *key)
{
int i;
for (i = 0; i < obj->u.d.len; i++)
- if (keystrcmp(obj->u.d.items[i].k, key) == 0)
+ if (strcmp(fz_to_name(obj->u.d.items[i].k), key) == 0)
return i;
}
@@ -210,7 +201,7 @@ fz_dict_put(fz_obj *obj, fz_obj *key, fz_obj *val)
/* borked! */
if (obj->u.d.len)
- if (keystrcmp(obj->u.d.items[obj->u.d.len - 1].k, s) > 0)
+ if (strcmp(fz_to_name(obj->u.d.items[obj->u.d.len - 1].k), s) > 0)
obj->u.d.sorted = 0;
obj->u.d.items[obj->u.d.len].k = fz_keep_obj(key);
diff --git a/pdf/pdf_font.c b/pdf/pdf_font.c
index b19b516e..448ab330 100644
--- a/pdf/pdf_font.c
+++ b/pdf/pdf_font.c
@@ -105,7 +105,7 @@ static int ft_char_index(FT_Face face, int cid)
return gid;
}
-static inline int ft_cid_to_gid(pdf_font_desc *fontdesc, int cid)
+static int ft_cid_to_gid(pdf_font_desc *fontdesc, int cid)
{
if (fontdesc->to_ttf_cmap)
{
diff --git a/pdf/pdf_function.c b/pdf/pdf_function.c
index c08c5e5b..6237bd42 100644
--- a/pdf/pdf_function.c
+++ b/pdf/pdf_function.c
@@ -59,7 +59,7 @@ struct pdf_function_s
#define RADIAN 57.2957795
-static inline float LERP(float x, float xmin, float xmax, float ymin, float ymax)
+static inline float lerp(float x, float xmin, float xmax, float ymin, float ymax)
{
if (xmin == xmax)
return ymin;
@@ -76,13 +76,15 @@ enum { PS_BOOL, PS_INT, PS_REAL, PS_OPERATOR, PS_BLOCK };
enum
{
- PS_OP_ABS, PS_OP_ADD, PS_OP_AND, PS_OP_ATAN, PS_OP_BITSHIFT, PS_OP_CEILING,
- PS_OP_COPY, PS_OP_COS, PS_OP_CVI, PS_OP_CVR, PS_OP_DIV, PS_OP_DUP, PS_OP_EQ,
- PS_OP_EXCH, PS_OP_EXP, PS_OP_FALSE, PS_OP_FLOOR, PS_OP_GE, PS_OP_GT, PS_OP_IDIV,
- PS_OP_INDEX, PS_OP_LE, PS_OP_LN, PS_OP_LOG, PS_OP_LT, PS_OP_MOD, PS_OP_MUL,
- PS_OP_NE, PS_OP_NEG, PS_OP_NOT, PS_OP_OR, PS_OP_POP, PS_OP_ROLL, PS_OP_ROUND,
- PS_OP_SIN, PS_OP_SQRT, PS_OP_SUB, PS_OP_TRUE, PS_OP_TRUNCATE, PS_OP_XOR,
- PS_OP_IF, PS_OP_IFELSE, PS_OP_RETURN
+ PS_OP_ABS, PS_OP_ADD, PS_OP_AND, PS_OP_ATAN, PS_OP_BITSHIFT,
+ PS_OP_CEILING, PS_OP_COPY, PS_OP_COS, PS_OP_CVI, PS_OP_CVR,
+ PS_OP_DIV, PS_OP_DUP, PS_OP_EQ, PS_OP_EXCH, PS_OP_EXP,
+ PS_OP_FALSE, PS_OP_FLOOR, PS_OP_GE, PS_OP_GT, PS_OP_IDIV,
+ PS_OP_INDEX, PS_OP_LE, PS_OP_LN, PS_OP_LOG, PS_OP_LT, PS_OP_MOD,
+ PS_OP_MUL, PS_OP_NE, PS_OP_NEG, PS_OP_NOT, PS_OP_OR, PS_OP_POP,
+ PS_OP_ROLL, PS_OP_ROUND, PS_OP_SIN, PS_OP_SQRT, PS_OP_SUB,
+ PS_OP_TRUE, PS_OP_TRUNCATE, PS_OP_XOR, PS_OP_IF, PS_OP_IFELSE,
+ PS_OP_RETURN
};
static char *ps_op_names[] =
@@ -154,26 +156,22 @@ ps_init_stack(ps_stack *st)
st->sp = 0;
}
-static inline int
-ps_overflow(ps_stack *st, int n)
+static inline int ps_overflow(ps_stack *st, int n)
{
return n < 0 || st->sp + n >= nelem(st->stack);
}
-static inline int
-ps_underflow(ps_stack *st, int n)
+static inline int ps_underflow(ps_stack *st, int n)
{
return n < 0 || st->sp - n < 0;
}
-static inline int
-ps_is_type(ps_stack *st, int t)
+static inline int ps_is_type(ps_stack *st, int t)
{
return !ps_underflow(st, 1) && st->stack[st->sp - 1].type == t;
}
-static inline int
-ps_is_type2(ps_stack *st, int t)
+static inline int ps_is_type2(ps_stack *st, int t)
{
return !ps_underflow(st, 2) && st->stack[st->sp - 1].type == t && st->stack[st->sp - 2].type == t;
}
@@ -1052,7 +1050,7 @@ eval_sample_func(pdf_function *func, float *in, float *out)
for (i = 0; i < func->m; i++)
{
x = CLAMP(in[i], func->domain[i][0], func->domain[i][1]);
- x = LERP(x, func->domain[i][0], func->domain[i][1],
+ x = lerp(x, func->domain[i][0], func->domain[i][1],
func->u.sa.encode[i][0], func->u.sa.encode[i][1]);
x = CLAMP(x, 0, func->u.sa.size[i] - 1);
e0[i] = floorf(x);
@@ -1073,7 +1071,7 @@ eval_sample_func(pdf_function *func, float *in, float *out)
float ab = a + (b - a) * efrac[0];
- out[i] = LERP(ab, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]);
+ out[i] = lerp(ab, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]);
out[i] = CLAMP(out[i], func->range[i][0], func->range[i][1]);
}
@@ -1091,14 +1089,14 @@ eval_sample_func(pdf_function *func, float *in, float *out)
float cd = c + (d - c) * efrac[0];
float abcd = ab + (cd - ab) * efrac[1];
- out[i] = LERP(abcd, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]);
+ out[i] = lerp(abcd, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]);
out[i] = CLAMP(out[i], func->range[i][0], func->range[i][1]);
}
else
{
float x = interpolate_sample(func, scale, e0, e1, efrac, func->m - 1, i);
- out[i] = LERP(x, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]);
+ out[i] = lerp(x, 0, 1, func->u.sa.decode[i][0], func->u.sa.decode[i][1]);
out[i] = CLAMP(out[i], func->range[i][0], func->range[i][1]);
}
}
@@ -1303,7 +1301,7 @@ eval_stitching_func(pdf_function *func, float in, float *out)
high = bounds[i];
}
- in = LERP(in, low, high, func->u.st.encode[i*2+0], func->u.st.encode[i*2+1]);
+ in = lerp(in, low, high, func->u.st.encode[i*2+0], func->u.st.encode[i*2+1]);
pdf_eval_function(func->u.st.funcs[i], &in, 1, out, func->n);
}
diff --git a/pdf/pdf_lex.c b/pdf/pdf_lex.c
index bb0e6e32..31d8a825 100644
--- a/pdf/pdf_lex.c
+++ b/pdf/pdf_lex.c
@@ -23,8 +23,7 @@
#define RANGE_A_F \
'A':case'B':case'C':case'D':case'E':case'F'
-static inline int
-iswhite(int ch)
+static inline int iswhite(int ch)
{
return
ch == '\000' ||
@@ -35,40 +34,32 @@ iswhite(int ch)
ch == '\040';
}
-static inline int
-from_hex(int ch)
+static inline int unhex(int ch)
{
- if (ch >= '0' && ch <= '9')
- return ch - '0';
- else if (ch >= 'A' && ch <= 'F')
- return ch - 'A' + 0xA;
- else if (ch >= 'a' && ch <= 'f')
- return ch - 'a' + 0xA;
+ if (ch >= '0' && ch <= '9') return ch - '0';
+ if (ch >= 'A' && ch <= 'F') return ch - 'A' + 0xA;
+ if (ch >= 'a' && ch <= 'f') return ch - 'a' + 0xA;
return 0;
}
-static inline void
+static void
lex_white(fz_stream *f)
{
int c;
- do
- {
+ do {
c = fz_read_byte(f);
- }
- while ((c <= 32) && (iswhite(c)));
+ } while ((c <= 32) && (iswhite(c)));
if (c != EOF)
fz_unread_byte(f);
}
-static inline void
+static void
lex_comment(fz_stream *f)
{
int c;
- do
- {
+ do {
c = fz_read_byte(f);
- }
- while ((c != '\012') && (c != '\015') && (c != EOF));
+ } while ((c != '\012') && (c != '\015') && (c != EOF));
}
static int
@@ -329,12 +320,12 @@ lex_hex_string(fz_stream *f, char *buf, int n)
case IS_HEX:
if (x)
{
- *s++ = a * 16 + from_hex(c);
+ *s++ = a * 16 + unhex(c);
x = !x;
}
else
{
- a = from_hex(c);
+ a = unhex(c);
x = !x;
}
break;
diff --git a/pdf/pdf_shade.c b/pdf/pdf_shade.c
index aded5154..1e0bf5ff 100644
--- a/pdf/pdf_shade.c
+++ b/pdf/pdf_shade.c
@@ -95,15 +95,14 @@ triangulate_patch(pdf_tensor_patch p, fz_shade *shade)
pdf_add_quad(shade, &v0, &v1, &v2, &v3);
}
-static inline void
-midcolor(float *c, float *c1, float *c2)
+static inline void midcolor(float *c, float *c1, float *c2)
{
int i;
for (i = 0; i < FZ_MAX_COLORS; i++)
c[i] = (c1[i] + c2[i]) * 0.5f;
}
-static inline void
+static void
split_curve(fz_point *pole, fz_point *q0, fz_point *q1, int polestep)
{
/*
@@ -139,7 +138,7 @@ split_curve(fz_point *pole, fz_point *q0, fz_point *q1, int polestep)
q1[3 * polestep].y = pole[3 * polestep].y;
}
-static inline void
+static void
split_stripe(pdf_tensor_patch *p, pdf_tensor_patch *s0, pdf_tensor_patch *s1)
{
/*
@@ -186,7 +185,7 @@ draw_stripe(pdf_tensor_patch *p, fz_shade *shade, int depth)
}
}
-static inline void
+static void
split_patch(pdf_tensor_patch *p, pdf_tensor_patch *s0, pdf_tensor_patch *s1)
{
/*
@@ -233,7 +232,7 @@ draw_patch(fz_shade *shade, pdf_tensor_patch *p, int depth, int origdepth)
}
}
-static inline fz_point
+static fz_point
pdf_compute_tensor_interior(
fz_point a, fz_point b, fz_point c, fz_point d,
fz_point e, fz_point f, fz_point g, fz_point h)
@@ -259,7 +258,7 @@ pdf_compute_tensor_interior(
return pt;
}
-static inline void
+static void
pdf_make_tensor_patch(pdf_tensor_patch *p, int type, fz_point *pt)
{
if (type == 6)
@@ -531,8 +530,7 @@ pdf_load_radial_shading(fz_shade *shade, pdf_xref *xref, fz_obj *dict, int funcs
/* Type 4-7 -- Triangle and patch mesh shadings */
-static inline float
-read_sample(fz_stream *stream, int bits, float min, float max)
+static inline float read_sample(fz_stream *stream, int bits, float min, float max)
{
/* we use pow(2,x) because (1<<x) would overflow the math on 32-bit samples */
float bitscale = 1 / (powf(2, bits) - 1);
diff --git a/xps/xps_glyphs.c b/xps/xps_glyphs.c
index 605938be..9222d922 100644
--- a/xps/xps_glyphs.c
+++ b/xps/xps_glyphs.c
@@ -7,7 +7,9 @@
static inline int ishex(int a)
{
- return (a >= 'A' && a <= 'F') || (a >= 'a' && a <= 'f') || (a >= '0' && a <= '9');
+ return (a >= 'A' && a <= 'F') ||
+ (a >= 'a' && a <= 'f') ||
+ (a >= '0' && a <= '9');
}
static inline int unhex(int a)
@@ -175,7 +177,8 @@ xps_parse_digits(char *s, int *digit)
static inline int is_real_num_char(int c)
{
- return (c >= '0' && c <= '9') || c == 'e' || c == 'E' || c == '+' || c == '-' || c == '.';
+ return (c >= '0' && c <= '9') ||
+ c == 'e' || c == 'E' || c == '+' || c == '-' || c == '.';
}
static char *
@@ -228,9 +231,10 @@ xps_parse_glyph_metrics(char *s, float *advance, float *uofs, float *vofs)
* Calculate metrics for positioning.
*/
static fz_text *
-xps_parse_glyphs_imp(xps_context *ctx, fz_matrix ctm, fz_font *font, float size,
- float originx, float originy, int is_sideways, int bidi_level,
- char *indices, char *unicode)
+xps_parse_glyphs_imp(xps_context *ctx, fz_matrix ctm,
+ fz_font *font, float size, float originx, float originy,
+ int is_sideways, int bidi_level,
+ char *indices, char *unicode)
{
xps_glyph_metrics mtx;
fz_text *text;
@@ -275,7 +279,7 @@ xps_parse_glyphs_imp(xps_context *ctx, fz_matrix ctm, fz_font *font, float size,
if (glyph_count < 1)
glyph_count = 1;
- /* TODO: add code chars with cluster mappings for proper text extraction */
+ /* TODO: add code chars with cluster mappings for text extraction */
while (code_count--)
{
@@ -516,9 +520,7 @@ xps_parse_glyphs(xps_context *ctx, fz_matrix ctm,
xps_begin_opacity(ctx, ctm, area, opacity_mask_uri, dict, opacity_att, opacity_mask_tag);
- /*
- * If it's a solid color brush fill/stroke do a simple fill
- */
+ /* If it's a solid color brush fill/stroke do a simple fill */
if (fill_tag && !strcmp(xml_tag(fill_tag), "SolidColorBrush"))
{
@@ -541,9 +543,7 @@ xps_parse_glyphs(xps_context *ctx, fz_matrix ctm,
ctx->colorspace, ctx->color, ctx->alpha);
}
- /*
- * If it's a visual brush or image, use the charpath as a clip mask to paint brush
- */
+ /* If it's a complex brush, use the charpath as a clip mask */
if (fill_tag)
{
diff --git a/xps/xps_hash.c b/xps/xps_hash.c
index c0df8c1c..c750717a 100644
--- a/xps/xps_hash.c
+++ b/xps/xps_hash.c
@@ -30,8 +30,7 @@ struct xps_hash_table_s
xps_hash_entry *entries;
};
-static inline int
-xps_tolower(int c)
+static inline int xps_tolower(int c)
{
if (c >= 'A' && c <= 'Z')
return c + 32;
diff --git a/xps/xps_path.c b/xps/xps_path.c
index 3e76787b..547deed8 100644
--- a/xps/xps_path.c
+++ b/xps/xps_path.c
@@ -40,7 +40,7 @@ fz_currentpoint(fz_path *path)
* circular arcs, we need to transform the line to make them elliptical but
* without transforming the line width.
*/
-static inline void
+static void
xps_draw_arc_segment(fz_path *path, fz_matrix mtx, float th0, float th1, int iscw)
{
float t, d;
@@ -91,7 +91,7 @@ xps_draw_arc_segment(fz_path *path, fz_matrix mtx, float th0, float th1, int isc
}
/* Given two vectors find the angle between them. */
-static inline float
+static float
angle_between(const fz_point u, const fz_point v)
{
float det = u.x * v.y - u.y * v.x;
diff --git a/xps/xps_png.c b/xps/xps_png.c
index 38c9d473..a86aa54f 100644
--- a/xps/xps_png.c
+++ b/xps/xps_png.c
@@ -20,8 +20,7 @@ static inline int getint(unsigned char *p)
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
}
-static inline int
-getcomp(unsigned char *line, int x, int bpc)
+static inline int getcomp(unsigned char *line, int x, int bpc)
{
switch (bpc)
{
@@ -34,8 +33,7 @@ getcomp(unsigned char *line, int x, int bpc)
return 0;
}
-static inline void
-putcomp(unsigned char *line, int x, int bpc, int value)
+static inline void putcomp(unsigned char *line, int x, int bpc, int value)
{
int maxval = (1 << bpc) - 1;
diff --git a/xps/xps_tiff.c b/xps/xps_tiff.c
index 3d905130..13c4d7f1 100644
--- a/xps/xps_tiff.c
+++ b/xps/xps_tiff.c
@@ -223,8 +223,7 @@ xps_decode_tiff_jpeg(struct tiff *tiff, fz_stream *chain, byte *wp, int wlen)
return fz_okay;
}
-static inline int
-getcomp(byte *line, int x, int bpc)
+static inline int getcomp(byte *line, int x, int bpc)
{
switch (bpc)
{
@@ -237,8 +236,7 @@ getcomp(byte *line, int x, int bpc)
return 0;
}
-static inline void
-putcomp(byte *line, int x, int bpc, int value)
+static inline void putcomp(byte *line, int x, int bpc, int value)
{
int maxval = (1 << bpc) - 1;