diff options
author | Robin Watts <robin.watts@artifex.com> | 2012-07-05 16:56:32 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2012-07-05 17:05:08 +0100 |
commit | ee382eb9e03bd609bc0da95a77e7b7232d7e56d5 (patch) | |
tree | 6485a2e7144657a992c43f445fff6551ca827b5a /draw/draw_edge.c | |
parent | 8ff2db02dba00a0fbc53ee4c89dcab60aab181ec (diff) | |
download | mupdf-ee382eb9e03bd609bc0da95a77e7b7232d7e56d5.tar.xz |
Move to static inline functions from macros.
Instead of using macros for min/max/abs/clamp, we move to using
inline functions. These are more typesafe, and should produce
equivalent code on compilers that support inline (i.e. pretty much
everything we care about these days).
People can always do their own macro versions if they prefer.
Diffstat (limited to 'draw/draw_edge.c')
-rw-r--r-- | draw/draw_edge.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/draw/draw_edge.c b/draw/draw_edge.c index eac7cfba..48496acd 100644 --- a/draw/draw_edge.c +++ b/draw/draw_edge.c @@ -316,7 +316,7 @@ fz_insert_gel_raw(fz_gel *gel, int x0, int y0, int x1, int y1) dy = y1 - y0; dx = x1 - x0; - width = ABS(dx); + width = fz_absi(dx); edge->xdir = dx > 0 ? 1 : -1; edge->ydir = winding; @@ -356,10 +356,10 @@ fz_insert_gel(fz_gel *gel, float fx0, float fy0, float fx1, float fy1) fy0 = floorf(fy0 * fz_aa_vscale); fy1 = floorf(fy1 * fz_aa_vscale); - x0 = CLAMP(fx0, BBOX_MIN * fz_aa_hscale, BBOX_MAX * fz_aa_hscale); - y0 = CLAMP(fy0, BBOX_MIN * fz_aa_vscale, BBOX_MAX * fz_aa_vscale); - x1 = CLAMP(fx1, BBOX_MIN * fz_aa_hscale, BBOX_MAX * fz_aa_hscale); - y1 = CLAMP(fy1, BBOX_MIN * fz_aa_vscale, BBOX_MAX * fz_aa_vscale); + x0 = fz_clampi(fx0, BBOX_MIN * fz_aa_hscale, BBOX_MAX * fz_aa_hscale); + y0 = fz_clampi(fy0, BBOX_MIN * fz_aa_vscale, BBOX_MAX * fz_aa_vscale); + x1 = fz_clampi(fx1, BBOX_MIN * fz_aa_hscale, BBOX_MAX * fz_aa_hscale); + y1 = fz_clampi(fy1, BBOX_MIN * fz_aa_vscale, BBOX_MAX * fz_aa_vscale); d = clip_lerp_y(gel->clip.y0, 0, x0, y0, x1, y1, &v); if (d == OUTSIDE) return; @@ -721,8 +721,8 @@ 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); - x1 = CLAMP(x1, dst->x, dst->x + dst->w); + x0 = fz_clampi(x0, dst->x, dst->x + dst->w); + x1 = fz_clampi(x1, dst->x, dst->x + dst->w); if (x0 < x1) { dp = dst->samples + (unsigned int)(( (y - dst->y) * dst->w + (x0 - dst->x) ) * dst->n); |