From b944f16a564f8a31d9a064980318ad690be31f8e Mon Sep 17 00:00:00 2001 From: Robin Watts Date: Thu, 7 Apr 2016 11:08:42 +0100 Subject: Partial image decode. Update the core fz_get_pixmap_from_image code to allow fetching a subarea of a pixmap. We pass in the required subarea, together with the transformation matrix for the whole image. On return, we have a pixmap at least as big as was requested, and the transformation matrix is updated to map the supplied area to the correct place on the screen. The draw device is updated to use this as required. Everywhere else passes NULLs in, and so gets unchanged behaviour. The standard 'get_pixmap' function has been updated to decode just the required areas of the bitmaps. This means that banded rendering of pages will decode just the image subareas that are required for each band, limiting the memory use. The downside to this is that each band will redecode the image again to extract just the section we want. The image subareas are put into the fz_store in the same way as full images. Currently image areas in the store are only matched when they match exactly; subareas are not identified as being able to use existing images. --- source/fitz/svg-device.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/fitz/svg-device.c') diff --git a/source/fitz/svg-device.c b/source/fitz/svg-device.c index d36a5872..5f60cf75 100644 --- a/source/fitz/svg-device.c +++ b/source/fitz/svg-device.c @@ -743,7 +743,7 @@ svg_dev_fill_image(fz_context *ctx, fz_device *dev, fz_image *image, const fz_ma break; default: { - fz_buffer *buf = fz_new_buffer_from_image_as_png(ctx, image, image->w, image->h); + fz_buffer *buf = fz_new_buffer_from_image_as_png(ctx, image); fz_printf(ctx, out, "image/png;base64,"); send_data_base64(ctx, out, buf); fz_drop_buffer(ctx, buf); @@ -830,7 +830,7 @@ svg_dev_fill_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const break; default: { - fz_buffer *buf = fz_new_buffer_from_image_as_png(ctx, image, image->w, image->h); + fz_buffer *buf = fz_new_buffer_from_image_as_png(ctx, image); fz_printf(ctx, out, "image/png;base64,"); send_data_base64(ctx, out, buf); fz_drop_buffer(ctx, buf); @@ -874,7 +874,7 @@ svg_dev_clip_image_mask(fz_context *ctx, fz_device *dev, fz_image *image, const break; default: { - fz_buffer *buf = fz_new_buffer_from_image_as_png(ctx, image, image->w, image->h); + fz_buffer *buf = fz_new_buffer_from_image_as_png(ctx, image); fz_printf(ctx, out, "image/png;base64,"); send_data_base64(ctx, out, buf); fz_drop_buffer(ctx, buf); -- cgit v1.2.3