summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2015-12-18 15:30:46 +0100
committerTor Andersson <tor.andersson@artifex.com>2015-12-28 13:21:02 +0100
commit497d9f348c23ff0465147734bf5dcb548511b256 (patch)
tree316500b56d3eae73ba90a8cf60ca717643f5c592
parent17db174004b7d94777d2c3d2d09c8fba629b6e78 (diff)
downloadmupdf-497d9f348c23ff0465147734bf5dcb548511b256.tar.xz
Rename fz_image_get_pixmap to fz_get_pixmap_from_image.
-rw-r--r--include/mupdf/fitz/image.h6
-rw-r--r--source/fitz/draw-device.c6
-rw-r--r--source/fitz/image.c15
-rw-r--r--source/fitz/pixmap.c2
-rw-r--r--source/fitz/test-device.c2
-rw-r--r--source/pdf/pdf-device.c2
-rw-r--r--source/tools/pdfextract.c2
7 files changed, 15 insertions, 20 deletions
diff --git a/include/mupdf/fitz/image.h b/include/mupdf/fitz/image.h
index 05bf0d70..41b53475 100644
--- a/include/mupdf/fitz/image.h
+++ b/include/mupdf/fitz/image.h
@@ -20,7 +20,7 @@
typedef struct fz_image_s fz_image;
/*
- fz_new_pixmap_from_image: Called to get a handle to a pixmap from an image.
+ fz_get_pixmap_from_image: Called to get a handle to a pixmap from an image.
image: The image to retrieve a pixmap from.
@@ -34,7 +34,7 @@ typedef struct fz_image_s fz_image;
Returns a non NULL pixmap pointer. May throw exceptions.
*/
-fz_pixmap *fz_new_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h);
+fz_pixmap *fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h);
/*
fz_drop_image: Drop a reference to an image.
@@ -56,7 +56,7 @@ fz_image *fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *co
fz_image *fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image *mask);
fz_image *fz_new_image_from_data(fz_context *ctx, unsigned char *data, int len);
fz_image *fz_new_image_from_buffer(fz_context *ctx, fz_buffer *buffer);
-fz_pixmap *fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h);
+fz_pixmap *fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h);
void fz_drop_image_imp(fz_context *ctx, fz_storable *image);
fz_pixmap *fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, int indexed, int l2factor);
fz_pixmap *fz_expand_indexed_pixmap(fz_context *ctx, fz_pixmap *src);
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 08ab129a..38fe1c19 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -1113,7 +1113,7 @@ fz_draw_fill_image(fz_context *ctx, fz_device *devp, fz_image *image, const fz_m
dx = sqrtf(local_ctm.a * local_ctm.a + local_ctm.b * local_ctm.b);
dy = sqrtf(local_ctm.c * local_ctm.c + local_ctm.d * local_ctm.d);
- pixmap = fz_image_get_pixmap(ctx, image, dx, dy);
+ pixmap = fz_get_pixmap_from_image(ctx, image, dx, dy);
orig_pixmap = pixmap;
/* convert images with more components (cmyk->rgb) before scaling */
@@ -1213,7 +1213,7 @@ fz_draw_fill_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const
dx = sqrtf(local_ctm.a * local_ctm.a + local_ctm.b * local_ctm.b);
dy = sqrtf(local_ctm.c * local_ctm.c + local_ctm.d * local_ctm.d);
- pixmap = fz_image_get_pixmap(ctx, image, dx, dy);
+ pixmap = fz_get_pixmap_from_image(ctx, image, dx, dy);
orig_pixmap = pixmap;
fz_try(ctx)
@@ -1316,7 +1316,7 @@ fz_draw_clip_image_mask(fz_context *ctx, fz_device *devp, fz_image *image, const
fz_try(ctx)
{
- pixmap = fz_image_get_pixmap(ctx, image, dx, dy);
+ pixmap = fz_get_pixmap_from_image(ctx, image, dx, dy);
orig_pixmap = pixmap;
state[1].mask = mask = fz_new_pixmap_with_bbox(ctx, NULL, &bbox);
diff --git a/source/fitz/image.c b/source/fitz/image.c
index a1a3be6a..34f0dd6a 100644
--- a/source/fitz/image.c
+++ b/source/fitz/image.c
@@ -2,14 +2,6 @@
#define SANE_DPI 72.0f
-fz_pixmap *
-fz_new_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h)
-{
- if (image == NULL)
- return NULL;
- return fz_image_get_pixmap(ctx, image, w, h);
-}
-
fz_image *
fz_keep_image(fz_context *ctx, fz_image *image)
{
@@ -103,7 +95,7 @@ fz_mask_color_key(fz_pixmap *pix, int n, int *colorkey)
static void
fz_unblend_masked_tile(fz_context *ctx, fz_pixmap *tile, fz_image *image)
{
- fz_pixmap *mask = fz_image_get_pixmap(ctx, image->mask, tile->w, tile->h);
+ fz_pixmap *mask = fz_get_pixmap_from_image(ctx, image->mask, tile->w, tile->h);
unsigned char *s = mask->samples, *end = s + mask->w * mask->h;
unsigned char *d = tile->samples;
int k;
@@ -293,13 +285,16 @@ standard_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h, int *l
}
fz_pixmap *
-fz_image_get_pixmap(fz_context *ctx, fz_image *image, int w, int h)
+fz_get_pixmap_from_image(fz_context *ctx, fz_image *image, int w, int h)
{
fz_pixmap *tile;
int l2factor, l2factor_remaining;
fz_image_key key;
fz_image_key *keyp;
+ if (!image)
+ return NULL;
+
/* 'Simple' images created direct from pixmaps will have no buffer
* of compressed data. We cannot do any better than just returning
* a pointer to the original 'tile'.
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index ed20265e..3096b6b3 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -943,7 +943,7 @@ png_from_pixmap(fz_context *ctx, fz_pixmap *pix, int drop)
fz_buffer *
fz_new_buffer_from_image_as_png(fz_context *ctx, fz_image *image, int w, int h)
{
- return png_from_pixmap(ctx, fz_image_get_pixmap(ctx, image, image->w, image->h), 1);
+ return png_from_pixmap(ctx, fz_get_pixmap_from_image(ctx, image, image->w, image->h), 1);
}
fz_buffer *
diff --git a/source/fitz/test-device.c b/source/fitz/test-device.c
index 45642cd0..86b39161 100644
--- a/source/fitz/test-device.c
+++ b/source/fitz/test-device.c
@@ -184,7 +184,7 @@ fz_test_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma
return;
}
- pix = fz_image_get_pixmap(ctx, image, 0, 0);
+ pix = fz_get_pixmap_from_image(ctx, image, 0, 0);
if (pix == NULL) /* Should never happen really, but... */
return;
diff --git a/source/pdf/pdf-device.c b/source/pdf/pdf-device.c
index dce26a3a..bcdcb914 100644
--- a/source/pdf/pdf-device.c
+++ b/source/pdf/pdf-device.c
@@ -146,7 +146,7 @@ send_image(fz_context *ctx, pdf_device *pdev, fz_image *image, int mask, int sma
int n;
/* Currently, set to maintain resolution; should we consider
* subsampling here according to desired output res? */
- pixmap = fz_image_get_pixmap(ctx, image, image->w, image->h);
+ pixmap = fz_get_pixmap_from_image(ctx, image, image->w, image->h);
colorspace = pixmap->colorspace; /* May be different to image->colorspace! */
n = (pixmap->n == 1 ? 1 : pixmap->n-1);
size = image->w * image->h * n;
diff --git a/source/tools/pdfextract.c b/source/tools/pdfextract.c
index 6f2ed1ca..e867ca04 100644
--- a/source/tools/pdfextract.c
+++ b/source/tools/pdfextract.c
@@ -72,7 +72,7 @@ static void saveimage(int num)
/* TODO: detect DCTD and save as jpeg */
image = pdf_load_image(ctx, doc, ref);
- pix = fz_image_get_pixmap(ctx, image, 0, 0);
+ pix = fz_get_pixmap_from_image(ctx, image, 0, 0);
fz_drop_image(ctx, image);
snprintf(buf, sizeof(buf), "img-%04d", num);