summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2012-03-12 14:45:25 +0000
committerRobin Watts <robin.watts@artifex.com>2012-03-12 14:45:25 +0000
commit2b7f3d1035f4bae9c189e0e6fcbb907ca46538c4 (patch)
tree38d0e1a3d8d9fc9d5a94514cbe46389a23d8518f
parentbc9e8f1d6c18b8b37678a07e9266f269fe5bf0dc (diff)
downloadmupdf-2b7f3d1035f4bae9c189e0e6fcbb907ca46538c4.tar.xz
Change order of params in fz_convert_pixmap to C standard.
C's standard is copy(dst, src), so we move to adopt that here. Hopefully no one is calling this routine other than us - if they are, then I apologise! Better to aim for consistency before we freeze the API at v1.0 than to carry an inconsistent API around ever after.
-rw-r--r--draw/draw_device.c4
-rw-r--r--fitz/fitz.h6
-rw-r--r--fitz/image_jpx.c2
-rw-r--r--fitz/image_save.c2
-rw-r--r--fitz/image_tiff.c2
-rw-r--r--fitz/res_colorspace.c56
6 files changed, 36 insertions, 36 deletions
diff --git a/draw/draw_device.c b/draw/draw_device.c
index de81ccec..e8356f6e 100644
--- a/draw/draw_device.c
+++ b/draw/draw_device.c
@@ -927,7 +927,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha)
if (pixmap->colorspace != model && !after)
{
converted = fz_new_pixmap_with_rect(ctx, model, fz_bound_pixmap(pixmap));
- fz_convert_pixmap(ctx, pixmap, converted);
+ fz_convert_pixmap(ctx, converted, pixmap);
pixmap = converted;
}
@@ -957,7 +957,7 @@ fz_draw_fill_image(fz_device *devp, fz_image *image, fz_matrix ctm, float alpha)
else
{
converted = fz_new_pixmap_with_rect(ctx, model, fz_bound_pixmap(pixmap));
- fz_convert_pixmap(ctx, pixmap, converted);
+ fz_convert_pixmap(ctx, converted, pixmap);
pixmap = converted;
}
}
diff --git a/fitz/fitz.h b/fitz/fitz.h
index 03cb6f25..fedf6ea4 100644
--- a/fitz/fitz.h
+++ b/fitz/fitz.h
@@ -1292,11 +1292,11 @@ void fz_unmultiply_pixmap(fz_context *ctx, fz_pixmap *pix);
fz_convert_pixmap: Convert from one pixmap to another (assumed to be
the same size, but possibly with a different colorspace).
- src: the source pixmap.
+ dst: the source pixmap.
- dst: the destination pixmap.
+ src: the destination pixmap.
*/
-void fz_convert_pixmap(fz_context *ctx, fz_pixmap *src, fz_pixmap *dst);
+void fz_convert_pixmap(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src);
/*
fz_save_pixmap: Save a pixmap out.
diff --git a/fitz/image_jpx.c b/fitz/image_jpx.c
index b2fc3601..ac1db35a 100644
--- a/fitz/image_jpx.c
+++ b/fitz/image_jpx.c
@@ -144,7 +144,7 @@ fz_load_jpx(fz_context *ctx, unsigned char *data, int size, fz_colorspace *defcs
if (n == 4)
{
fz_pixmap *tmp = fz_new_pixmap(ctx, fz_device_rgb, w, h);
- fz_convert_pixmap(ctx, img, tmp);
+ fz_convert_pixmap(ctx, tmp, img);
fz_drop_pixmap(ctx, img);
img = tmp;
}
diff --git a/fitz/image_save.c b/fitz/image_save.c
index ef5dbfa5..29d3e8fc 100644
--- a/fitz/image_save.c
+++ b/fitz/image_save.c
@@ -11,7 +11,7 @@ void fz_save_pixmap(fz_context *ctx, fz_pixmap *img, char *file, int rgb)
if (rgb && img->colorspace && img->colorspace != fz_device_rgb)
{
converted = fz_new_pixmap_with_rect(ctx, fz_device_rgb, fz_bound_pixmap(img));
- fz_convert_pixmap(ctx, img, converted);
+ fz_convert_pixmap(ctx, converted, img);
img = converted;
}
diff --git a/fitz/image_tiff.c b/fitz/image_tiff.c
index 76f08447..ffd0ea88 100644
--- a/fitz/image_tiff.c
+++ b/fitz/image_tiff.c
@@ -789,7 +789,7 @@ fz_load_tiff(fz_context *ctx, unsigned char *buf, int len)
if (image->n == 5)
{
fz_pixmap *rgb = fz_new_pixmap(tiff.ctx, fz_device_rgb, image->w, image->h);
- fz_convert_pixmap(tiff.ctx, image, rgb);
+ fz_convert_pixmap(tiff.ctx, rgb, image);
rgb->xres = image->xres;
rgb->yres = image->yres;
fz_drop_pixmap(ctx, image);
diff --git a/fitz/res_colorspace.c b/fitz/res_colorspace.c
index 1c26d1b3..45d57113 100644
--- a/fitz/res_colorspace.c
+++ b/fitz/res_colorspace.c
@@ -180,7 +180,7 @@ fz_find_device_colorspace(char *name)
/* Fast pixmap color conversions */
-static void fast_gray_to_rgb(fz_pixmap *src, fz_pixmap *dst)
+static void fast_gray_to_rgb(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -196,7 +196,7 @@ static void fast_gray_to_rgb(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_gray_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
+static void fast_gray_to_cmyk(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -213,7 +213,7 @@ static void fast_gray_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_rgb_to_gray(fz_pixmap *src, fz_pixmap *dst)
+static void fast_rgb_to_gray(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -227,7 +227,7 @@ static void fast_rgb_to_gray(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_bgr_to_gray(fz_pixmap *src, fz_pixmap *dst)
+static void fast_bgr_to_gray(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -241,7 +241,7 @@ static void fast_bgr_to_gray(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_rgb_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
+static void fast_rgb_to_cmyk(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -262,7 +262,7 @@ static void fast_rgb_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_bgr_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
+static void fast_bgr_to_cmyk(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -283,7 +283,7 @@ static void fast_bgr_to_cmyk(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_cmyk_to_gray(fz_pixmap *src, fz_pixmap *dst)
+static void fast_cmyk_to_gray(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -300,7 +300,7 @@ static void fast_cmyk_to_gray(fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_cmyk_to_rgb(fz_context *ctx, fz_pixmap *src, fz_pixmap *dst)
+static void fast_cmyk_to_rgb(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -328,7 +328,7 @@ static void fast_cmyk_to_rgb(fz_context *ctx, fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_cmyk_to_bgr(fz_context *ctx, fz_pixmap *src, fz_pixmap *dst)
+static void fast_cmyk_to_bgr(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -356,7 +356,7 @@ static void fast_cmyk_to_bgr(fz_context *ctx, fz_pixmap *src, fz_pixmap *dst)
}
}
-static void fast_rgb_to_bgr(fz_pixmap *src, fz_pixmap *dst)
+static void fast_rgb_to_bgr(fz_pixmap *dst, fz_pixmap *src)
{
unsigned char *s = src->samples;
unsigned char *d = dst->samples;
@@ -373,7 +373,7 @@ static void fast_rgb_to_bgr(fz_pixmap *src, fz_pixmap *dst)
}
static void
-fz_std_conv_pixmap(fz_context *ctx, fz_pixmap *src, fz_pixmap *dst)
+fz_std_conv_pixmap(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src)
{
float srcv[FZ_MAX_COLORS];
float dstv[FZ_MAX_COLORS];
@@ -499,7 +499,7 @@ fz_std_conv_pixmap(fz_context *ctx, fz_pixmap *src, fz_pixmap *dst)
}
void
-fz_convert_pixmap(fz_context *ctx, fz_pixmap *sp, fz_pixmap *dp)
+fz_convert_pixmap(fz_context *ctx, fz_pixmap *dp, fz_pixmap *sp)
{
fz_colorspace *ss = sp->colorspace;
fz_colorspace *ds = dp->colorspace;
@@ -510,37 +510,37 @@ fz_convert_pixmap(fz_context *ctx, fz_pixmap *sp, fz_pixmap *dp)
if (ss == fz_device_gray)
{
- if (ds == fz_device_rgb) fast_gray_to_rgb(sp, dp);
- else if (ds == fz_device_bgr) fast_gray_to_rgb(sp, dp); /* bgr == rgb here */
- else if (ds == fz_device_cmyk) fast_gray_to_cmyk(sp, dp);
- else fz_std_conv_pixmap(ctx, sp, dp);
+ if (ds == fz_device_rgb) fast_gray_to_rgb(dp, sp);
+ else if (ds == fz_device_bgr) fast_gray_to_rgb(dp, sp); /* bgr == rgb here */
+ else if (ds == fz_device_cmyk) fast_gray_to_cmyk(dp, sp);
+ else fz_std_conv_pixmap(ctx, dp, sp);
}
else if (ss == fz_device_rgb)
{
- if (ds == fz_device_gray) fast_rgb_to_gray(sp, dp);
- else if (ds == fz_device_bgr) fast_rgb_to_bgr(sp, dp);
- else if (ds == fz_device_cmyk) fast_rgb_to_cmyk(sp, dp);
- else fz_std_conv_pixmap(ctx, sp, dp);
+ if (ds == fz_device_gray) fast_rgb_to_gray(dp, sp);
+ else if (ds == fz_device_bgr) fast_rgb_to_bgr(dp, sp);
+ else if (ds == fz_device_cmyk) fast_rgb_to_cmyk(dp, sp);
+ else fz_std_conv_pixmap(ctx, dp, sp);
}
else if (ss == fz_device_bgr)
{
- if (ds == fz_device_gray) fast_bgr_to_gray(sp, dp);
- else if (ds == fz_device_rgb) fast_rgb_to_bgr(sp, dp); /* bgr = rgb here */
+ if (ds == fz_device_gray) fast_bgr_to_gray(dp, sp);
+ else if (ds == fz_device_rgb) fast_rgb_to_bgr(dp, sp); /* bgr = rgb here */
else if (ds == fz_device_cmyk) fast_bgr_to_cmyk(sp, dp);
- else fz_std_conv_pixmap(ctx, sp, dp);
+ else fz_std_conv_pixmap(ctx, dp, sp);
}
else if (ss == fz_device_cmyk)
{
- if (ds == fz_device_gray) fast_cmyk_to_gray(sp, dp);
- else if (ds == fz_device_bgr) fast_cmyk_to_bgr(ctx, sp, dp);
- else if (ds == fz_device_rgb) fast_cmyk_to_rgb(ctx, sp, dp);
- else fz_std_conv_pixmap(ctx, sp, dp);
+ if (ds == fz_device_gray) fast_cmyk_to_gray(dp, sp);
+ else if (ds == fz_device_bgr) fast_cmyk_to_bgr(ctx, dp, sp);
+ else if (ds == fz_device_rgb) fast_cmyk_to_rgb(ctx, dp, sp);
+ else fz_std_conv_pixmap(ctx, dp, sp);
}
- else fz_std_conv_pixmap(ctx, sp, dp);
+ else fz_std_conv_pixmap(ctx, dp, sp);
}
/* Convert a single color */