diff options
Diffstat (limited to 'draw')
-rw-r--r-- | draw/draw_blend.c | 38 | ||||
-rw-r--r-- | draw/draw_edge.c | 14 | ||||
-rw-r--r-- | draw/draw_path.c | 26 | ||||
-rw-r--r-- | draw/draw_unpack.c | 6 |
4 files changed, 42 insertions, 42 deletions
diff --git a/draw/draw_blend.c b/draw/draw_blend.c index 8a751c08..e70699d4 100644 --- a/draw/draw_blend.c +++ b/draw/draw_blend.c @@ -63,12 +63,12 @@ static inline int fz_overlay_byte(int b, int s) static inline int fz_darken_byte(int b, int s) { - return MIN(b, s); + return fz_mini(b, s); } static inline int fz_lighten_byte(int b, int s) { - return MAX(b, s); + return fz_maxi(b, s); } static inline int fz_color_dodge_byte(int b, int s) @@ -111,7 +111,7 @@ static inline int fz_soft_light_byte(int b, int s) static inline int fz_difference_byte(int b, int s) { - return ABS(b - s); + return fz_absi(b - s); } static inline int fz_exclusion_byte(int b, int s) @@ -139,13 +139,13 @@ fz_luminosity_rgb(unsigned char *rd, unsigned char *gd, unsigned char *bd, int r if (delta > 0) { int max; - max = MAX(r, MAX(g, b)); + max = fz_maxi(r, fz_maxi(g, b)); scale = (max == y ? 0 : ((255 - y) << 16) / (max - y)); } else { int min; - min = MIN(r, MIN(g, b)); + min = fz_mini(r, fz_mini(g, b)); scale = (y == min ? 0 : (y << 16) / (y - min)); } r = y + (((r - y) * scale + 0x8000) >> 16); @@ -153,9 +153,9 @@ fz_luminosity_rgb(unsigned char *rd, unsigned char *gd, unsigned char *bd, int r b = y + (((b - y) * scale + 0x8000) >> 16); } - *rd = CLAMP(r, 0, 255); - *gd = CLAMP(g, 0, 255); - *bd = CLAMP(b, 0, 255); + *rd = fz_clampi(r, 0, 255); + *gd = fz_clampi(g, 0, 255); + *bd = fz_clampi(b, 0, 255); } static void @@ -167,20 +167,20 @@ fz_saturation_rgb(unsigned char *rd, unsigned char *gd, unsigned char *bd, int r int scale; int r, g, b; - minb = MIN(rb, MIN(gb, bb)); - maxb = MAX(rb, MAX(gb, bb)); + minb = fz_mini(rb, fz_mini(gb, bb)); + maxb = fz_maxi(rb, fz_maxi(gb, bb)); if (minb == maxb) { /* backdrop has zero saturation, avoid divide by 0 */ - gb = CLAMP(gb, 0, 255); + gb = fz_clampi(gb, 0, 255); *rd = gb; *gd = gb; *bd = gb; return; } - mins = MIN(rs, MIN(gs, bs)); - maxs = MAX(rs, MAX(gs, bs)); + mins = fz_mini(rs, fz_mini(gs, bs)); + maxs = fz_maxi(rs, fz_maxi(gs, bs)); scale = ((maxs - mins) << 16) / (maxb - minb); y = (rb * 77 + gb * 151 + bb * 28 + 0x80) >> 8; @@ -193,8 +193,8 @@ fz_saturation_rgb(unsigned char *rd, unsigned char *gd, unsigned char *bd, int r int scalemin, scalemax; int min, max; - min = MIN(r, MIN(g, b)); - max = MAX(r, MAX(g, b)); + min = fz_mini(r, fz_mini(g, b)); + max = fz_maxi(r, fz_maxi(g, b)); if (min < 0) scalemin = (y << 16) / (y - min); @@ -206,15 +206,15 @@ fz_saturation_rgb(unsigned char *rd, unsigned char *gd, unsigned char *bd, int r else scalemax = 0x10000; - scale = MIN(scalemin, scalemax); + scale = fz_mini(scalemin, scalemax); r = y + (((r - y) * scale + 0x8000) >> 16); g = y + (((g - y) * scale + 0x8000) >> 16); b = y + (((b - y) * scale + 0x8000) >> 16); } - *rd = CLAMP(r, 0, 255); - *gd = CLAMP(g, 0, 255); - *bd = CLAMP(b, 0, 255); + *rd = fz_clampi(r, 0, 255); + *gd = fz_clampi(g, 0, 255); + *bd = fz_clampi(b, 0, 255); } static void 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); diff --git a/draw/draw_path.c b/draw/draw_path.c index 755283b7..b0889279 100644 --- a/draw/draw_path.c +++ b/draw/draw_path.c @@ -28,10 +28,10 @@ bezier(fz_gel *gel, fz_matrix *ctm, float flatness, float xabcd, yabcd; /* termination check */ - dmax = ABS(xa - xb); - dmax = MAX(dmax, ABS(ya - yb)); - dmax = MAX(dmax, ABS(xd - xc)); - dmax = MAX(dmax, ABS(yd - yc)); + dmax = fz_abs(xa - xb); + dmax = fz_max(dmax, fz_abs(ya - yb)); + dmax = fz_max(dmax, fz_abs(xd - xc)); + dmax = fz_max(dmax, fz_abs(yd - yc)); if (dmax < flatness || depth >= MAX_DEPTH) { line(gel, ctm, xa, ya, xd, yd); @@ -499,10 +499,10 @@ fz_stroke_bezier(struct sctx *s, float xabcd, yabcd; /* termination check */ - dmax = ABS(xa - xb); - dmax = MAX(dmax, ABS(ya - yb)); - dmax = MAX(dmax, ABS(xd - xc)); - dmax = MAX(dmax, ABS(yd - yc)); + dmax = fz_abs(xa - xb); + dmax = fz_max(dmax, fz_abs(ya - yb)); + dmax = fz_max(dmax, fz_abs(xd - xc)); + dmax = fz_max(dmax, fz_abs(yd - yc)); if (dmax < s->flatness || depth >= MAX_DEPTH) { fz_point p; @@ -705,10 +705,10 @@ fz_dash_bezier(struct sctx *s, float xabcd, yabcd; /* termination check */ - dmax = ABS(xa - xb); - dmax = MAX(dmax, ABS(ya - yb)); - dmax = MAX(dmax, ABS(xd - xc)); - dmax = MAX(dmax, ABS(yd - yc)); + dmax = fz_abs(xa - xb); + dmax = fz_max(dmax, fz_abs(ya - yb)); + dmax = fz_max(dmax, fz_abs(xd - xc)); + dmax = fz_max(dmax, fz_abs(yd - yc)); if (dmax < s->flatness || depth >= MAX_DEPTH) { fz_point p; @@ -780,7 +780,7 @@ fz_flatten_dash_path(fz_gel *gel, fz_path *path, fz_stroke_state *stroke, fz_mat phase_len = 0; for (i = 0; i < stroke->dash_len; i++) phase_len += stroke->dash_list[i]; - max_expand = MAX(MAX(fabs(ctm.a),fabs(ctm.b)),MAX(fabs(ctm.c),fabs(ctm.d))); + max_expand = fz_max(fz_max(fz_abs(ctm.a),fz_abs(ctm.b)),fz_max(fz_abs(ctm.c),fz_abs(ctm.d))); if (phase_len < 0.01f || phase_len * max_expand < 0.5f) { fz_flatten_stroke_path(gel, path, stroke, ctm, flatness, linewidth); diff --git a/draw/draw_unpack.c b/draw/draw_unpack.c index 39c287c6..e7952d04 100644 --- a/draw/draw_unpack.c +++ b/draw/draw_unpack.c @@ -199,7 +199,7 @@ fz_decode_indexed_tile(fz_pixmap *pix, float *decode, int maxval) for (k = 0; k < n; k++) { int value = (add[k] + (((p[k] << 8) * mul[k]) >> 8)) >> 8; - p[k] = CLAMP(value, 0, 255); + p[k] = fz_clampi(value, 0, 255); } p += n + 1; } @@ -212,7 +212,7 @@ fz_decode_tile(fz_pixmap *pix, float *decode) int mul[FZ_MAX_COLORS]; unsigned char *p = pix->samples; int len = pix->w * pix->h; - int n = MAX(1, pix->n - 1); + int n = fz_maxi(1, pix->n - 1); int needed; int k; @@ -234,7 +234,7 @@ fz_decode_tile(fz_pixmap *pix, float *decode) for (k = 0; k < n; k++) { int value = add[k] + fz_mul255(p[k], mul[k]); - p[k] = CLAMP(value, 0, 255); + p[k] = fz_clampi(value, 0, 255); } p += pix->n; } |