summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor.andersson@artifex.com>2016-06-17 15:13:24 +0200
committerTor Andersson <tor.andersson@artifex.com>2016-06-17 15:13:47 +0200
commit4e8160a9098990ba59962ae6b0a253d9294ab8e3 (patch)
treed806aaae2f920d45492859249a8def159d375453
parent8393f20185b0e3e73450096f7b76e1a3d9b5a0e2 (diff)
downloadmupdf-4e8160a9098990ba59962ae6b0a253d9294ab8e3.tar.xz
Set pixmap resolution when creating pixmaps for draw device.
-rw-r--r--include/mupdf/fitz/pixmap.h5
-rw-r--r--source/fitz/draw-device.c3
-rw-r--r--source/fitz/pixmap.c6
-rw-r--r--source/tools/mudraw.c4
4 files changed, 11 insertions, 7 deletions
diff --git a/include/mupdf/fitz/pixmap.h b/include/mupdf/fitz/pixmap.h
index 9ae78164..ee5520dc 100644
--- a/include/mupdf/fitz/pixmap.h
+++ b/include/mupdf/fitz/pixmap.h
@@ -167,7 +167,10 @@ unsigned char *fz_pixmap_samples(fz_context *ctx, fz_pixmap *pix);
*/
int fz_pixmap_stride(fz_context *ctx, fz_pixmap *pix);
-void fz_pixmap_set_resolution(fz_pixmap *pix, int res);
+/*
+ fz_pixmap_set_resolution: Set the pixels per inch resolution of the pixmap.
+*/
+void fz_set_pixmap_resolution(fz_context *ctx, fz_pixmap *pix, int xres, int yres);
/*
fz_clear_pixmap_with_value: Clears a pixmap with the given value.
diff --git a/source/fitz/draw-device.c b/source/fitz/draw-device.c
index 5d7088a6..527d7e08 100644
--- a/source/fitz/draw-device.c
+++ b/source/fitz/draw-device.c
@@ -81,7 +81,7 @@ fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, co
fz_matrix transform;
fz_device *dev;
- fz_pre_scale(fz_rotate(&transform, opts->rotate), x_zoom, y_zoom);
+ fz_pre_rotate(fz_scale(&transform, x_zoom, y_zoom), opts->rotate);
bounds = *mediabox;
fz_round_rect(&ibounds, fz_transform_rect(&bounds, &transform));
@@ -116,6 +116,7 @@ fz_new_draw_device_with_options(fz_context *ctx, const fz_draw_options *opts, co
*pixmap = fz_new_pixmap_with_bbox(ctx, opts->colorspace, &ibounds, opts->alpha);
fz_try(ctx)
{
+ fz_set_pixmap_resolution(ctx, *pixmap, opts->x_resolution, opts->y_resolution);
if (opts->alpha)
fz_clear_pixmap(ctx, *pixmap);
else
diff --git a/source/fitz/pixmap.c b/source/fitz/pixmap.c
index 0631e909..6a7f8919 100644
--- a/source/fitz/pixmap.c
+++ b/source/fitz/pixmap.c
@@ -1227,10 +1227,10 @@ fz_subsample_pixmap(fz_context *ctx, fz_pixmap *tile, int factor)
}
void
-fz_pixmap_set_resolution(fz_pixmap *pix, int res)
+fz_set_pixmap_resolution(fz_context *ctx, fz_pixmap *pix, int xres, int yres)
{
- pix->xres = res;
- pix->yres = res;
+ pix->xres = xres;
+ pix->yres = yres;
}
void
diff --git a/source/tools/mudraw.c b/source/tools/mudraw.c
index ecdadc22..3dfd25e5 100644
--- a/source/tools/mudraw.c
+++ b/source/tools/mudraw.c
@@ -853,7 +853,7 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
memset(&workers[band].cookie, 0, sizeof(fz_cookie));
workers[band].list = list;
workers[band].pix = fz_new_pixmap_with_bbox(ctx, colorspace, &band_ibounds, alpha);
- fz_pixmap_set_resolution(workers[band].pix, resolution);
+ fz_set_pixmap_resolution(ctx, workers[band].pix, resolution, resolution);
DEBUG_THREADS(("Worker %d, Pre-triggering band %d\n", band, band));
SEMAPHORE_TRIGGER(workers[band].start);
ctm.f -= drawheight;
@@ -863,7 +863,7 @@ static void dodrawpage(fz_context *ctx, fz_page *page, fz_display_list *list, in
else
{
pix = fz_new_pixmap_with_bbox(ctx, colorspace, &band_ibounds, alpha);
- fz_pixmap_set_resolution(pix, resolution);
+ fz_set_pixmap_resolution(ctx, pix, resolution, resolution);
}
/* Output any page level headers (for banded formats) */