diff options
author | Robin Watts <robin.watts@artifex.com> | 2013-05-03 13:02:10 +0100 |
---|---|---|
committer | Robin Watts <robin.watts@artifex.com> | 2013-05-03 16:39:02 +0100 |
commit | 09bb1dc2a0cbea13b9ad27f626d2c9e16984ebf9 (patch) | |
tree | 25e7a25b122b1c67805b6982e7f583bd4a34e009 | |
parent | f499ef89525fd596753f1a4e93e8a8c56953e21a (diff) | |
download | mupdf-09bb1dc2a0cbea13b9ad27f626d2c9e16984ebf9.tar.xz |
Simple Image file format recogniser
Now can open jpeg/png/tiff files within mupdf.
-rw-r--r-- | Makefile | 12 | ||||
-rw-r--r-- | android/jni/Core.mk | 4 | ||||
-rw-r--r-- | android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java | 16 | ||||
-rw-r--r-- | apps/win_main.c | 4 | ||||
-rw-r--r-- | cbz/mucbz.c | 2 | ||||
-rw-r--r-- | fitz/doc_document.c | 19 | ||||
-rw-r--r-- | fitz/fitz-internal.h | 3 | ||||
-rw-r--r-- | fitz/res_image.c | 20 | ||||
-rw-r--r-- | image/muimage.c | 142 | ||||
-rw-r--r-- | image/muimage.h | 51 | ||||
-rw-r--r-- | win32/libmupdf.vcproj | 44 | ||||
-rw-r--r-- | xps/xps_image.c | 2 |
12 files changed, 289 insertions, 30 deletions
@@ -12,7 +12,7 @@ default: all # Do not specify CFLAGS or LIBS on the make invocation line - specify # XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that # set a variable that was set on the command line. -CFLAGS += $(XCFLAGS) -Ifitz -Ipdf -Ixps -Icbz -Iscripts +CFLAGS += $(XCFLAGS) -Ifitz -Ipdf -Ixps -Icbz -Iimage -Iscripts LIBS += $(XLIBS) -lfreetype -ljbig2dec -ljpeg -lopenjpeg -lz -lm LIBS_V8 = $(LIBS) $(V8LIBS) @@ -47,6 +47,7 @@ FITZ_HDR := fitz/fitz.h fitz/fitz-internal.h MUPDF_HDR := $(FITZ_HDR) pdf/mupdf.h pdf/mupdf-internal.h MUXPS_HDR := $(FITZ_HDR) xps/muxps.h xps/muxps-internal.h MUCBZ_HDR := $(FITZ_HDR) cbz/mucbz.h +MUIMAGE_HDR := $(FITZ_HDR) image/muimage.h $(OUT) $(GEN) : $(MKDIR_CMD) @@ -70,7 +71,9 @@ $(OUT)/%.o : xps/%.c $(MUXPS_HDR) | $(OUT) $(CC_CMD) $(OUT)/%.o : cbz/%.c $(MUCBZ_HDR) | $(OUT) $(CC_CMD) -$(OUT)/%.o : apps/%.c fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h | $(OUT) +$(OUT)/%.o : image/%.c $(MUCBZ_HDR) | $(OUT) + $(CC_CMD) +$(OUT)/%.o : apps/%.c fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h image/muimage.h | $(OUT) $(CC_CMD) $(OUT)/%.o : scripts/%.c | $(OUT) $(CC_CMD) @@ -90,17 +93,20 @@ MUPDF_V8_SRC := $(filter-out pdf_js_none.c, $(MUPDF_ALL_SRC)) MUPDF_V8_CPP_SRC := $(notdir $(wildcard pdf/*.cpp)) MUXPS_SRC := $(notdir $(wildcard xps/*.c)) MUCBZ_SRC := $(notdir $(wildcard cbz/*.c)) +MUIMAGE_SRC := $(notdir $(wildcard image/*.c)) $(FITZ_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o)) $(FITZ_LIB) : $(addprefix $(OUT)/, $(MUPDF_SRC:%.c=%.o)) $(FITZ_LIB) : $(addprefix $(OUT)/, $(MUXPS_SRC:%.c=%.o)) $(FITZ_LIB) : $(addprefix $(OUT)/, $(MUCBZ_SRC:%.c=%.o)) +$(FITZ_LIB) : $(addprefix $(OUT)/, $(MUIMAGE_SRC:%.c=%.o)) $(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(FITZ_SRC:%.c=%.o)) $(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUPDF_V8_SRC:%.c=%.o)) $(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUPDF_V8_CPP_SRC:%.cpp=%.o)) $(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUXPS_SRC:%.c=%.o)) $(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUCBZ_SRC:%.c=%.o)) +$(FITZ_V8_LIB) : $(addprefix $(OUT)/, $(MUIMAGE_SRC:%.c=%.o)) libs: $(FITZ_LIB) $(THIRD_LIBS) libs_v8: libs $(FITZ_V8_LIB) @@ -211,7 +217,7 @@ mandir ?= $(prefix)/share/man install: $(FITZ_LIB) $(MUVIEW) $(MUDRAW) $(MUTOOL) install -d $(DESTDIR)$(bindir) $(DESTDIR)$(libdir) $(DESTDIR)$(incdir) $(DESTDIR)$(mandir)/man1 install $(FITZ_LIB) $(DESTDIR)$(libdir) - install fitz/memento.h fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h $(DESTDIR)$(incdir) + install fitz/memento.h fitz/fitz.h pdf/mupdf.h xps/muxps.h cbz/mucbz.h image/muimage.h $(DESTDIR)$(incdir) install $(MUVIEW) $(MUDRAW) $(MUTOOL) $(DESTDIR)$(bindir) install $(wildcard apps/man/*.1) $(DESTDIR)$(mandir)/man1 diff --git a/android/jni/Core.mk b/android/jni/Core.mk index 0d7754e1..aed148fc 100644 --- a/android/jni/Core.mk +++ b/android/jni/Core.mk @@ -32,6 +32,7 @@ LOCAL_C_INCLUDES := \ ../pdf \ ../xps \ ../cbz \ + ../image \ ../scripts \ .. ifdef V8_BUILD @@ -145,7 +146,8 @@ LOCAL_SRC_FILES := \ $(MY_ROOT)/xps/xps_tile.c \ $(MY_ROOT)/xps/xps_util.c \ $(MY_ROOT)/xps/xps_zip.c \ - $(MY_ROOT)/cbz/mucbz.c + $(MY_ROOT)/cbz/mucbz.c \ + $(MY_ROOT)/image/muimage.c ifdef MEMENTO LOCAL_SRC_FILES += $(MY_ROOT)/fitz/memento.c endif diff --git a/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java b/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java index 8b8bde8e..c1c9142c 100644 --- a/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java +++ b/android/src/com/artifex/mupdfdemo/ChoosePDFActivity.java @@ -94,6 +94,22 @@ public class ChoosePDFActivity extends ListActivity { return true; if (fname.endsWith(".cbz")) return true; + if (fname.endsWith(".png")) + return true; + if (fname.endsWith(".jpe")) + return true; + if (fname.endsWith(".jpeg")) + return true; + if (fname.endsWith(".jpg")) + return true; + if (fname.endsWith(".jfif")) + return true; + if (fname.endsWith(".jfif-tbnl")) + return true; + if (fname.endsWith(".tif")) + return true; + if (fname.endsWith(".tiff")) + return true; return false; } }); diff --git a/apps/win_main.c b/apps/win_main.c index 47f74512..6de5033b 100644 --- a/apps/win_main.c +++ b/apps/win_main.c @@ -186,7 +186,7 @@ int winfilename(wchar_t *buf, int len) ofn.nMaxFile = len; ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = L"MuPDF: Open PDF file"; - ofn.lpstrFilter = L"Documents (*.pdf;*.xps;*.cbz;*.zip)\0*.zip;*.cbz;*.xps;*.pdf\0PDF Files (*.pdf)\0*.pdf\0XPS Files (*.xps)\0*.xps\0CBZ Files (*.cbz;*.zip)\0*.zip;*.cbz\0All Files\0*\0\0"; + ofn.lpstrFilter = L"Documents (*.pdf;*.xps;*.cbz;*.zip;*.png;*.jpg;*.tif)\0*.zip;*.cbz;*.xps;*.pdf;*.jpe;*.jpg;*.jpeg;*.jfif;*.tif;*.tiff\0PDF Files (*.pdf)\0*.pdf\0XPS Files (*.xps)\0*.xps\0CBZ Files (*.cbz;*.zip)\0*.zip;*.cbz\0Image Files (*.png;*.jpe;*.tif)\0*.png;*.jpg;*.jpe;*.jpeg;*.jfif;*.tif;*.tiff\0All Files\0*\0\0"; ofn.Flags = OFN_FILEMUSTEXIST|OFN_HIDEREADONLY; return GetOpenFileNameW(&ofn); } @@ -204,7 +204,7 @@ int wingetsavepath(pdfapp_t *app, char *buf, int len) ofn.nMaxFile = PATH_MAX; ofn.lpstrInitialDir = NULL; ofn.lpstrTitle = L"MuPDF: Save PDF file"; - ofn.lpstrFilter = L"Documents (*.pdf;*.xps;*.cbz;*.zip)\0*.zip;*.cbz;*.xps;*.pdf\0PDF Files (*.pdf)\0*.pdf\0XPS Files (*.xps)\0*.xps\0CBZ Files (*.cbz;*.zip)\0*.zip;*.cbz\0All Files\0*\0\0"; + ofn.lpstrFilter = L"Documents (*.pdf;*.xps;*.cbz;*.zip;*.png;*.jpg;*.tif)\0*.zip;*.cbz;*.xps;*.pdf;*.jpe;*.jpg;*.jpeg;*.jfif;*.tif;*.tiff\0PDF Files (*.pdf)\0*.pdf\0XPS Files (*.xps)\0*.xps\0CBZ Files (*.cbz;*.zip)\0*.zip;*.cbz\0Image Files (*.png;*.jpe;*.tif)\0*.png;*.jpg;*.jpe;*.jpeg;*.jfif;*.tif;*.tiff\0All Files\0*\0\0"; ofn.Flags = OFN_HIDEREADONLY; if (GetSaveFileName(&ofn)) { diff --git a/cbz/mucbz.c b/cbz/mucbz.c index bcda8562..83ffc4fe 100644 --- a/cbz/mucbz.c +++ b/cbz/mucbz.c @@ -364,7 +364,7 @@ cbz_load_page(cbz_document *doc, int number) data = cbz_read_zip_entry(doc, doc->entry[number].offset, &size); - page->image = fz_new_image_from_buffer(ctx, data, size); + page->image = fz_new_image_from_data(ctx, data, size); } fz_catch(ctx) { diff --git a/fitz/doc_document.c b/fitz/doc_document.c index 564329c4..a23aef27 100644 --- a/fitz/doc_document.c +++ b/fitz/doc_document.c @@ -4,10 +4,12 @@ extern struct pdf_document *pdf_open_document(fz_context *ctx, const char *filename); extern struct xps_document *xps_open_document(fz_context *ctx, const char *filename); extern struct cbz_document *cbz_open_document(fz_context *ctx, const char *filename); +extern struct image_document *image_open_document(fz_context *ctx, const char *filename); extern struct pdf_document *pdf_open_document_with_stream(fz_context *ctx, fz_stream *file); extern struct xps_document *xps_open_document_with_stream(fz_context *ctx, fz_stream *file); extern struct cbz_document *cbz_open_document_with_stream(fz_context *ctx, fz_stream *file); +extern struct image_document *image_open_document_with_stream(fz_context *ctx, fz_stream *file); extern int pdf_js_supported(void); @@ -42,6 +44,11 @@ fz_open_document_with_stream(fz_context *ctx, const char *magic, fz_stream *stre return (fz_document*) cbz_open_document_with_stream(ctx, stream); if (!fz_strcasecmp(ext, ".pdf")) return (fz_document*) pdf_open_document_with_stream(ctx, stream); + if (!fz_strcasecmp(ext, ".png") || !fz_strcasecmp(ext, ".jpg") || + !fz_strcasecmp(ext, ".jpeg") || !fz_strcasecmp(ext, ".jfif") || + !fz_strcasecmp(ext, ".jfif-tbnl") || !fz_strcasecmp(ext, ".jpe") || + !fz_strcasecmp(ext, ".tif") || !fz_strcasecmp(ext, ".tiff")) + return (fz_document*) image_open_document_with_stream(ctx, stream); } if (!strcmp(magic, "cbz") || !strcmp(magic, "application/x-cbz")) @@ -50,6 +57,13 @@ fz_open_document_with_stream(fz_context *ctx, const char *magic, fz_stream *stre return (fz_document*) xps_open_document_with_stream(ctx, stream); if (!strcmp(magic, "pdf") || !strcmp(magic, "application/pdf")) return (fz_document*) pdf_open_document_with_stream(ctx, stream); + if (!strcmp(magic, "png") || !strcmp(magic, "image/png") || + !strcmp(magic, "jpg") || !strcmp(magic, "image/jpeg") || + !strcmp(magic, "jpeg") || !strcmp(magic, "image/pjpeg") || + !strcmp(magic, "jpe") || !strcmp(magic, "jfif") || + !strcmp(magic, "tif") || !strcmp(magic, "image/tiff") || + !strcmp(magic, "tiff") || !strcmp(magic, "image/x-tiff")) + return (fz_document*) image_open_document_with_stream(ctx, stream); /* last guess: pdf */ return (fz_document*) pdf_open_document_with_stream(ctx, stream); @@ -68,6 +82,11 @@ fz_open_document(fz_context *ctx, const char *filename) return (fz_document*) cbz_open_document(ctx, filename); if (!fz_strcasecmp(ext, ".pdf")) return (fz_document*) pdf_open_document(ctx, filename); + if (!fz_strcasecmp(ext, ".png") || !fz_strcasecmp(ext, ".jpg") || + !fz_strcasecmp(ext, ".jpeg") || !fz_strcasecmp(ext, ".jpe") || + !fz_strcasecmp(ext, ".jfif") || !fz_strcasecmp(ext, ".jfif-tbnl") || + !fz_strcasecmp(ext, ".tif") || !fz_strcasecmp(ext, ".tiff")) + return (fz_document*) image_open_document(ctx, filename); } /* last guess: pdf */ diff --git a/fitz/fitz-internal.h b/fitz/fitz-internal.h index bf7d2873..17a919d3 100644 --- a/fitz/fitz-internal.h +++ b/fitz/fitz-internal.h @@ -977,7 +977,8 @@ void fz_free_compressed_buffer(fz_context *ctx, fz_compressed_buffer *buf); fz_image *fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, int xres, int yres, int interpolate, int imagemask, float *decode, int *colorkey, fz_compressed_buffer *buffer, fz_image *mask); fz_image *fz_new_image_from_pixmap(fz_context *ctx, fz_pixmap *pixmap, fz_image *mask); -fz_image *fz_new_image_from_buffer(fz_context *ctx, unsigned char *buf, int len); +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); void fz_free_image(fz_context *ctx, fz_storable *image); fz_pixmap *fz_decomp_image_from_stream(fz_context *ctx, fz_stream *stm, fz_image *image, int in_line, int indexed, int l2factor, int native_l2factor); diff --git a/fitz/res_image.c b/fitz/res_image.c index c8ba8257..82703b50 100644 --- a/fitz/res_image.c +++ b/fitz/res_image.c @@ -416,15 +416,25 @@ fz_new_image(fz_context *ctx, int w, int h, int bpc, fz_colorspace *colorspace, } fz_image * -fz_new_image_from_buffer(fz_context *ctx, unsigned char *buf, int len) +fz_new_image_from_data(fz_context *ctx, unsigned char *data, int len) +{ + fz_buffer *buffer = fz_new_buffer_from_data(ctx, data, len); + + return fz_new_image_from_buffer(ctx, buffer); +} + +fz_image * +fz_new_image_from_buffer(fz_context *ctx, fz_buffer *buffer) { fz_compressed_buffer *bc = NULL; int w, h, xres, yres; fz_colorspace *cspace; - unsigned char *free_buf = buf; + fz_buffer *drop_buffer = buffer; + int len = buffer->len; + unsigned char *buf = buffer->data; fz_var(bc); - fz_var(free_buf); + fz_var(drop_buffer); fz_try(ctx) { @@ -433,7 +443,7 @@ fz_new_image_from_buffer(fz_context *ctx, unsigned char *buf, int len) bc = fz_malloc_struct(ctx, fz_compressed_buffer); bc->buffer = fz_new_buffer_from_data(ctx, buf, len); - free_buf = NULL; + drop_buffer = NULL; if (buf[0] == 0xff && buf[1] == 0xd8) { @@ -458,7 +468,7 @@ fz_new_image_from_buffer(fz_context *ctx, unsigned char *buf, int len) } fz_catch(ctx) { - fz_free(ctx, free_buf); + fz_drop_buffer(ctx, drop_buffer); fz_free_compressed_buffer(ctx, bc); fz_rethrow(ctx); } diff --git a/image/muimage.c b/image/muimage.c new file mode 100644 index 00000000..0577f1c5 --- /dev/null +++ b/image/muimage.c @@ -0,0 +1,142 @@ +#include "fitz-internal.h" +#include "muimage.h" + +#include <ctype.h> /* for tolower */ + +#define DPI 72.0f + +static void image_init_document(image_document *doc); + +struct image_document_s +{ + fz_document super; + + fz_context *ctx; + fz_stream *file; + fz_image *image; +}; + +image_document * +image_open_document_with_stream(fz_context *ctx, fz_stream *file) +{ + image_document *doc; + fz_buffer *buffer = NULL; + + doc = fz_malloc_struct(ctx, image_document); + image_init_document(doc); + doc->ctx = ctx; + doc->file = fz_keep_stream(file); + + fz_var(buffer); + + fz_try(ctx) + { + buffer = fz_read_all(doc->file, 1024); + doc->image = fz_new_image_from_buffer(ctx, buffer); + buffer = NULL; + } + fz_catch(ctx) + { + fz_drop_buffer(ctx, buffer); + image_close_document(doc); + fz_rethrow(ctx); + } + + return doc; +} + +image_document * +image_open_document(fz_context *ctx, const char *filename) +{ + fz_stream *file; + image_document *doc; + + file = fz_open_file(ctx, filename); + if (!file) + fz_throw(ctx, "cannot open file '%s': %s", filename, strerror(errno)); + + fz_try(ctx) { + doc = image_open_document_with_stream(ctx, file); + } fz_always(ctx) { + fz_close(file); + } fz_catch(ctx) { + fz_rethrow(ctx); + } + + return doc; +} + +void +image_close_document(image_document *doc) +{ + fz_context *ctx = doc->ctx; + fz_drop_image(ctx, doc->image); + fz_close(doc->file); + fz_free(ctx, doc); +} + +int +image_count_pages(image_document *doc) +{ + return 1; +} + +image_page * +image_load_page(image_document *doc, int number) +{ + if (number != 0) + return NULL; + + return (image_page *)doc->image; +} + +void +image_free_page(image_document *doc, image_page *page) +{ +} + +fz_rect * +image_bound_page(image_document *doc, image_page *page, fz_rect *bbox) +{ + fz_image *image = (fz_image *)page; + bbox->x0 = bbox->y0 = 0; + bbox->x1 = image->w * DPI / image->xres; + bbox->y1 = image->h * DPI / image->yres; + return bbox; +} + +void +image_run_page(image_document *doc, image_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie) +{ + fz_matrix local_ctm = *ctm; + fz_image *image = (fz_image *)page; + float w = image->w * DPI / image->xres; + float h = image->h * DPI / image->yres; + fz_pre_scale(&local_ctm, w, h); + fz_fill_image(dev, image, &local_ctm, 1); +} + +static int +image_meta(image_document *doc, int key, void *ptr, int size) +{ + switch(key) + { + case FZ_META_FORMAT_INFO: + sprintf((char *)ptr, "IMAGE"); + return FZ_META_OK; + default: + return FZ_META_UNKNOWN_KEY; + } +} + +static void +image_init_document(image_document *doc) +{ + doc->super.close = (void*)image_close_document; + doc->super.count_pages = (void*)image_count_pages; + doc->super.load_page = (void*)image_load_page; + doc->super.bound_page = (void*)image_bound_page; + doc->super.run_page_contents = (void*)image_run_page; + doc->super.free_page = (void*)image_free_page; + doc->super.meta = (void*)image_meta; +} diff --git a/image/muimage.h b/image/muimage.h new file mode 100644 index 00000000..146132f0 --- /dev/null +++ b/image/muimage.h @@ -0,0 +1,51 @@ +#ifndef MUIMAGE_H +#define MUIMAGE_H + +#include "fitz.h" + +typedef struct image_document_s image_document; +typedef struct image_page_s image_page; + +/* + image_open_document: Open a document. + + Open a document for reading so the library is able to locate + objects and pages inside the file. + + The returned image_document should be used when calling most + other functions. Note that it wraps the context, so those + functions implicitly get access to the global state in + context. + + filename: a path to a file as it would be given to open(2). +*/ +image_document *image_open_document(fz_context *ctx, const char *filename); + +/* + image_open_document_with_stream: Opens a document. + + Same as image_open_document, but takes a stream instead of a + filename to locate the document to open. Increments the + reference count of the stream. See fz_open_file, + fz_open_file_w or fz_open_fd for opening a stream, and + fz_close for closing an open stream. +*/ +image_document *image_open_document_with_stream(fz_context *ctx, fz_stream *file); + +/* + image_close_document: Closes and frees an opened document. + + The resource store in the context associated with image_document + is emptied. + + Does not throw exceptions. +*/ +void image_close_document(image_document *doc); + +int image_count_pages(image_document *doc); +image_page *image_load_page(image_document *doc, int number); +fz_rect *image_bound_page(image_document *doc, image_page *page, fz_rect *rect); +void image_free_page(image_document *doc, image_page *page); +void image_run_page(image_document *doc, image_page *page, fz_device *dev, const fz_matrix *ctm, fz_cookie *cookie); + +#endif diff --git a/win32/libmupdf.vcproj b/win32/libmupdf.vcproj index 27f14936..71be9e8b 100644 --- a/win32/libmupdf.vcproj +++ b/win32/libmupdf.vcproj @@ -437,18 +437,6 @@ > </File> <File - RelativePath="..\fitz\text_extract.c" - > - </File> - <File - RelativePath="..\fitz\text_output.c" - > - </File> - <File - RelativePath="..\fitz\text_paragraph.c" - > - </File> - <File RelativePath="..\fitz\dev_trace.c" > </File> @@ -469,10 +457,6 @@ > </File> <File - RelativePath="..\fitz\text_search.c" - > - </File> - <File RelativePath="..\fitz\filt_basic.c" > </File> @@ -604,6 +588,22 @@ RelativePath="..\fitz\stm_read.c" > </File> + <File + RelativePath="..\fitz\text_extract.c" + > + </File> + <File + RelativePath="..\fitz\text_output.c" + > + </File> + <File + RelativePath="..\fitz\text_paragraph.c" + > + </File> + <File + RelativePath="..\fitz\text_search.c" + > + </File> </Filter> <Filter Name="draw" @@ -717,6 +717,18 @@ > </File> </Filter> + <Filter + Name="image" + > + <File + RelativePath="..\image\muimage.c" + > + </File> + <File + RelativePath="..\image\muimage.h" + > + </File> + </Filter> </Files> <Globals> </Globals> diff --git a/xps/xps_image.c b/xps/xps_image.c index ea8d547b..d0561bf7 100644 --- a/xps/xps_image.c +++ b/xps/xps_image.c @@ -6,7 +6,7 @@ xps_load_image(fz_context *ctx, xps_part *part) /* Ownership of data always passes in here */ byte *data = part->data; part->data = NULL; - return fz_new_image_from_buffer(ctx, data, part->size); + return fz_new_image_from_data(ctx, data, part->size); } /* FIXME: area unused! */ |