summaryrefslogtreecommitdiff
path: root/pdf/pdf_colorspace.c
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-07-05 16:56:32 +0100
committerRobin Watts <robin.watts@artifex.com>2012-07-05 17:05:08 +0100
commitee382eb9e03bd609bc0da95a77e7b7232d7e56d5 (patch)
tree6485a2e7144657a992c43f445fff6551ca827b5a /pdf/pdf_colorspace.c
parent8ff2db02dba00a0fbc53ee4c89dcab60aab181ec (diff)
downloadmupdf-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 'pdf/pdf_colorspace.c')
-rw-r--r--pdf/pdf_colorspace.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/pdf/pdf_colorspace.c b/pdf/pdf_colorspace.c
index ee5bc5fc..13323ce3 100644
--- a/pdf/pdf_colorspace.c
+++ b/pdf/pdf_colorspace.c
@@ -47,9 +47,9 @@ lab_to_rgb(fz_context *ctx, fz_colorspace *cs, float *lab, float *rgb)
r = (3.240449f * x + -1.537136f * y + -0.498531f * z) * 0.830026f;
g = (-0.969265f * x + 1.876011f * y + 0.041556f * z) * 1.05452f;
b = (0.055643f * x + -0.204026f * y + 1.057229f * z) * 1.1003f;
- rgb[0] = sqrtf(CLAMP(r, 0, 1));
- rgb[1] = sqrtf(CLAMP(g, 0, 1));
- rgb[2] = sqrtf(CLAMP(b, 0, 1));
+ rgb[0] = sqrtf(fz_clamp(r, 0, 1));
+ rgb[1] = sqrtf(fz_clamp(g, 0, 1));
+ rgb[2] = sqrtf(fz_clamp(b, 0, 1));
}
static void
@@ -160,7 +160,7 @@ indexed_to_rgb(fz_context *ctx, fz_colorspace *cs, float *color, float *rgb)
float alt[FZ_MAX_COLORS];
int i, k;
i = color[0] * 255;
- i = CLAMP(i, 0, idx->high);
+ i = fz_clampi(i, 0, idx->high);
for (k = 0; k < idx->base->n; k++)
alt[k] = idx->lookup[i * idx->base->n + k] / 255.0f;
idx->base->to_rgb(ctx, idx->base, alt, rgb);
@@ -203,7 +203,7 @@ pdf_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src)
{
int v = *s++;
int a = *s++;
- v = MIN(v, high);
+ v = fz_mini(v, high);
for (k = 0; k < n; k++)
*d++ = fz_mul255(lookup[v * n + k], a);
*d++ = a;
@@ -240,7 +240,7 @@ load_indexed(pdf_document *xref, pdf_obj *array)
idx->lookup = NULL;
idx->base = base;
idx->high = pdf_to_int(highobj);
- idx->high = CLAMP(idx->high, 0, 255);
+ idx->high = fz_clampi(idx->high, 0, 255);
n = base->n * (idx->high + 1);
idx->lookup = fz_malloc_array(ctx, 1, n);