summaryrefslogtreecommitdiff
path: root/xps
diff options
context:
space:
mode:
authorRobin Watts <robin.watts@artifex.com>2011-12-15 00:43:54 +0000
committerRobin Watts <robin.watts@artifex.com>2011-12-15 00:43:54 +0000
commitba4cca2c65677aeffb088117169abbc12ebec3fc (patch)
tree08379a140cd14f2164114d43a722fabf111a0fff /xps
parent313e8f82816c839b3de47e1137a91414bb95a327 (diff)
downloadmupdf-ba4cca2c65677aeffb088117169abbc12ebec3fc.tar.xz
Remove 'soft limit' on pixmaps in favour of fz_store.
Change the fz_store to be limited to 256 Megs. Remove the soft limit for pixmaps; the store will automatically throw old resources away to stay below the limit.
Diffstat (limited to 'xps')
-rw-r--r--xps/xps_jpeg.c7
-rw-r--r--xps/xps_png.c7
-rw-r--r--xps/xps_tiff.c7
3 files changed, 15 insertions, 6 deletions
diff --git a/xps/xps_jpeg.c b/xps/xps_jpeg.c
index 381baffd..4e937a31 100644
--- a/xps/xps_jpeg.c
+++ b/xps/xps_jpeg.c
@@ -94,8 +94,11 @@ xps_decode_jpeg(fz_context *ctx, byte *rbuf, int rlen)
else
fz_throw(ctx, "bad number of components in jpeg: %d", cinfo.output_components);
- image = fz_new_pixmap_with_limit(ctx, colorspace, cinfo.output_width, cinfo.output_height);
- if (!image)
+ fz_try(ctx)
+ {
+ image = fz_new_pixmap(ctx, colorspace, cinfo.output_width, cinfo.output_height);
+ }
+ fz_catch(ctx)
{
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
diff --git a/xps/xps_png.c b/xps/xps_png.c
index a396b433..719e522f 100644
--- a/xps/xps_png.c
+++ b/xps/xps_png.c
@@ -516,8 +516,11 @@ xps_decode_png(fz_context *ctx, byte *p, int total)
stride = (png.width * png.n * png.depth + 7) / 8;
- image = fz_new_pixmap_with_limit(ctx, colorspace, png.width, png.height);
- if (!image)
+ fz_try(ctx)
+ {
+ image = fz_new_pixmap(ctx, colorspace, png.width, png.height);
+ }
+ fz_catch(ctx)
{
fz_free(png.ctx, png.samples);
fz_throw(ctx, "out of memory");
diff --git a/xps/xps_tiff.c b/xps/xps_tiff.c
index 38430710..01e5be9b 100644
--- a/xps/xps_tiff.c
+++ b/xps/xps_tiff.c
@@ -782,8 +782,11 @@ xps_decode_tiff(fz_context *ctx, byte *buf, int len)
/* Expand into fz_pixmap struct */
- image = fz_new_pixmap_with_limit(tiff.ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength);
- if (!image)
+ fz_try(ctx)
+ {
+ image = fz_new_pixmap(tiff.ctx, tiff.colorspace, tiff.imagewidth, tiff.imagelength);
+ }
+ fz_catch(ctx)
{
if (tiff.colormap) fz_free(ctx, tiff.colormap);
if (tiff.stripoffsets) fz_free(ctx, tiff.stripoffsets);