summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
Diffstat (limited to 'source')
-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
6 files changed, 12 insertions, 17 deletions
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);